Exemple #1
0
void ApplicationList::onDragDataGet(const Glib::RefPtr<Gdk::DragContext>& context, 
                             Gtk::SelectionData& data, guint info, guint time)
{
    Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_TreeView.get_selection();
    Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();

    if(iter && ((*iter)[m_appColumns.m_col_type] == MODULE))
    {
        Glib::ustring name = (*iter)[m_appColumns.m_col_name];
        data.set(data.get_target(), MODULE,
                (const guchar*)name.c_str(), name.size()+1);  
    }
    else if(iter && ((*iter)[m_appColumns.m_col_type] == RESOURCE))
    {
        Glib::ustring name = (*iter)[m_appColumns.m_col_name];
        data.set(data.get_target(), RESOURCE,
                (const guchar*)name.c_str(), name.size()+1);  
    }
    else if(iter && ((*iter)[m_appColumns.m_col_type] == APPLICATION))
    {
        Glib::ustring name = (*iter)[m_appColumns.m_col_name];
        data.set(data.get_target(), APPLICATION,
                (const guchar*)name.c_str(), name.size()+1);  
    }
}
Exemple #2
0
void
Dockable::on_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, Gtk::SelectionData& selection_data, guint /*info*/, guint /*time*/)
{
	Dockable* tmp(this);
	dnd_success_=true;

	selection_data.set(8, reinterpret_cast<const guchar*>(&tmp), sizeof(Dockable**));
}
void DnDWindow::on_button_drag_data_get(
        const Glib::RefPtr<Gdk::DragContext>&,
        Gtk::SelectionData& selection_data, guint, guint)
{
  selection_data.set(selection_data.get_target(), 8 /* 8 bits format */,
          (const guchar*)"I'm Data!",
          9 /* the length of I'm Data! in bytes */);
}
Exemple #4
0
void ImportClassesBox::ClassesTreeView::on_drag_data_get(
    const Glib::RefPtr<Gdk::DragContext>& ,
    Gtk::SelectionData& selection_data, guint, guint)
{
    Glib::RefPtr<Gtk::TreeSelection> srcSelect(get_selection());
    if (srcSelect) {
	Gtk::TreeModel::iterator iter = srcSelect->get_selected();
	if (iter) {
	    Gtk::TreeModel::Row row = *iter;
	    std::string className = row.get_value(mColumns.m_col_name);
	    selection_data.set(selection_data.get_target(), className);
	}
    }
}
Exemple #5
0
bool HierTreeMdl::drag_data_get_vfunc(const TreeModel::Path& path, Gtk::SelectionData& selection_data) const
{
    bool res = false;
    // Set selection. This will evolve DnD process 
    iterator iter((TreeModel*)this);
    bool ires = get_iter_vfunc(path, iter);
    Elem* node = (Elem*) (*iter).get_value(ColRec().elem);
    GUri uri;
    node->GetUri(uri);
    //selection_data.set_text(uri.GetUri());
    selection_data.set(KDnDTarg_Comp, uri.GetUri());

    //
    /*
    int row_index = path[0];
    Elem* node = iRoot->Comps().at(row_index);
    string data = node->Name();
    selection_data.set_text(data);
    */
    res = true;
    return res;
}
void ClipSelector::dragFunction( const Glib::RefPtr<Gdk::DragContext>& context,
                       Gtk::SelectionData& selection_data, guint info, guint time)
{
  cout << "ClipSelector::dragFunction() called!" << endl;
  
  // drag target is of string type, send
  cout << "DRAG from block " << block << endl;
  
  // get state of clip selector
  ClipSelectorState* state = &stateStore->clipSelectorState.at(ID);
  
  // get block info, to retrieve its bufferID
  std::list<ClipInfo>::iterator iter = state->clipInfo.begin();
  std::advance(iter, block);
  
  stringstream s;
  s << (*iter).bufferID;
  
  // send data to drop
  selection_data.set( selection_data.get_target(), 8, (guchar*) s.str().c_str(), s.str().size() );
  
}
Exemple #7
0
void SetData(Gtk::SelectionData& selection_data, void* dat, int dat_sz)
{
    selection_data.set(selection_data.get_target(), 8 /* 8 bits format */,
                       (const guchar*)dat, dat_sz /* the length of data in bytes */);
}
//------------------------------------------------------------------------------
bool ListModelWrapper::drag_data_get_vfunc(const Gtk::TreeModel::Path& path, Gtk::SelectionData& selection_data) const {
  selection_data.set("text/path", path.to_string());
  return true;
}