drag and drop multiple widgets in Fixed container
- From: "halski ." <halski gmail com>
- To: gtkmm-list gnome org
- Subject: drag and drop multiple widgets in Fixed container
- Date: Mon, 6 Mar 2006 02:51:06 +0100
hello,
I need to be able to drag and drop multiple boxes with text on the
canvas (like a UML class diagram) .I am trying to use the Fixed
container and Gtk::Button as a box - I have the code to add
buttons to the canvas, however whenever I try to drag any of the
buttons it moves all of the buttons into the place where I drop it.
probably the problem is the Fixed container's signal_drag_drop() ,
I don't know if i get it right but buttons should have each one a
handler for this, no ?
that is how the buttons are added (once clicked some other button) :
void UmlModellerWindow::class_button_clicked(UmlModellerButton *temp)
{
/* Create a new button. */
UmlModellerButton* t = new UmlModellerButton();
/* Add signal handler to button. */
canvas_fixed->signal_drag_drop().connect(sigc::bind<UmlModellerButton*>(sigc::mem_fun(*this,&UmlModellerWindow::on_drag_drop),t));
canvas_fixed->put(*user_classes.back(), x, y);
x+=10;
y+=10;
show_all();
}
and that is the handler of th drag drop :
bool UmlModellerWindow::on_drag_drop(const
Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint
time,UmlModellerButton *button)
{
cout << "x=" << x << ", y=" << y << endl;
canvas_fixed->move(*button,x,y);
}
Do you know where could be the problem ?
If this is not the easiest/best approach , please propose something else ?
jakub
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]