wxDragResult wxDropTarget::GTKFigureOutSuggestedAction() { if (!m_dragContext) return wxDragError; // GTK+ always supposes that we want to copy the data by default while we // might want to move it, so examine not only suggested_action - which is // only good if we don't have our own preferences - but also the actions // field wxDragResult suggested_action = wxDragNone; const GdkDragAction actions = gdk_drag_context_get_actions(m_dragContext); if (GetDefaultAction() == wxDragNone) { // use default action set by wxDropSource::DoDragDrop() if ( (gs_flagsForDrag & wxDrag_DefaultMove) == wxDrag_DefaultMove && (actions & GDK_ACTION_MOVE)) { // move is requested by the program and allowed by GTK+ - do it, even // though suggested_action may be currently wxDragCopy suggested_action = wxDragMove; } else // use whatever GTK+ says we should { suggested_action = ConvertFromGTK(gdk_drag_context_get_suggested_action(m_dragContext)); #if 0 // RR: I don't understand the code below: if the drag comes from // a different app, the gs_flagsForDrag is invalid; if it // comes from the same wx app, then GTK+ hopefully won't // suggest something we didn't allow in the frist place // in DoDrop() if ( (suggested_action == wxDragMove) && !(gs_flagsForDrag & wxDrag_AllowMove) ) { // we're requested to move but we can't suggested_action = wxDragCopy; } #endif } } else if (GetDefaultAction() == wxDragMove && (actions & GDK_ACTION_MOVE)) { suggested_action = wxDragMove; } else { if (actions & GDK_ACTION_COPY) suggested_action = wxDragCopy; else if (actions & GDK_ACTION_MOVE) suggested_action = wxDragMove; else if (actions & GDK_ACTION_LINK) suggested_action = wxDragLink; else suggested_action = wxDragNone; } return suggested_action; }
void ActionComponentEditor::Update() { ui->tableActions->resizeColumnsToContents(); ui->tableActions->resizeRowsToContents(); ui->buttonAddItem->setEnabled(!IsActionPresent(GetDefaultAction())); }
void ActionComponentEditor::SetComponent(DAVA::ActionComponent* component) { editDelegate.SetComponent(component); targetComponent = component; UpdateTableFromComponent(targetComponent); ui->buttonAddItem->setEnabled(!IsActionPresent(GetDefaultAction())); }
void ActionComponentEditor::OnAddAction() { //add action with default values DAVA::ActionComponent::Action action = GetDefaultAction(); bool duplicateAction = IsActionPresent(action); if(duplicateAction) { ShowErrorDialog("Duplicate actions not allowed!"); } else { targetComponent->Add(action); UpdateTableFromComponent(targetComponent); ui->buttonAddItem->setEnabled(false); } }
void ActionComponentEditor::OnRemoveAction() { int currentRow = ui->tableActions->currentRow(); if(currentRow >= 0 && currentRow < targetComponent->GetCount()) { targetComponent->Remove(targetComponent->Get(currentRow)); UpdateTableFromComponent(targetComponent); bool itemsPresent = (targetComponent->GetCount() > 0); ui->buttonRemoveItem->setEnabled(itemsPresent); if(itemsPresent) { ui->tableActions->setCurrentCell(0, 0); } ui->buttonAddItem->setEnabled(!IsActionPresent(GetDefaultAction())); } }