示例#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);  
    }
}
//------------------------------------------------------------------------------
void DbMySQLRoutineGroupEditor::on_routine_drop(const Glib::RefPtr<Gdk::DragContext>& context
                                               ,int x, int y
                                               , const Gtk::SelectionData& selection_data
                                               , guint info, guint time)
{
  bool dnd_status = false;
  
  if ( selection_data.get_target() == WB_DBOBJECT_DRAG_TYPE)
  {
    std::list<db_DatabaseObjectRef> objects;

    const std::string selection = selection_data.get_data_as_string();

    objects= bec::CatalogHelper::dragdata_to_dbobject_list(_be->get_catalog(), selection);
    
    for (std::list<db_DatabaseObjectRef>::const_iterator obj= objects.begin(); 
         obj != objects.end(); ++obj)
    {
      if (obj->is_instance<db_mysql_Routine>())
      {
        db_mysql_RoutineRef routine = db_mysql_RoutineRef::cast_from(*obj);
        if ( routine.is_valid() )
          _be->append_routine_with_id(routine.id());
      }
    }

    recreate_model_from_string_list(_routines_model, _be->get_routines_names());

    dnd_status = true;
  }
  context->drag_finish(dnd_status, false, time);
}
示例#3
0
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 */);
}
示例#4
0
//
// D&Dで受信側がデータ送信を要求してきた
//
void TabLabel::on_drag_data_get( const Glib::RefPtr<Gdk::DragContext>& context,
                                 Gtk::SelectionData& selection_data, guint info, guint time )
{
#ifdef _DEBUG
    std::cout << "TabLabel::on_drag_data_get target = " << selection_data.get_target()
              << " " << m_fulltext << std::endl;;
#endif

    Gtk::EventBox::on_drag_data_get( context, selection_data, info, time );

    m_sig_tab_drag_data_get( selection_data );
}
示例#5
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);
	}
    }
}
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() );
  
}
示例#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 */);
}
示例#8
0
void PrintSelectionData(const Gtk::SelectionData& selection_data, const std::string& location_str)
{
    io::cout << "\nFrom " << location_str << ":" << io::endl;
    io::cout << "Target: " << selection_data.get_target() << io::endl;
    io::cout << "Selection: " << gdk_atom_name(selection_data.get_selection()) << io::endl;
}