Audacity  2.2.2
Public Member Functions | Private Attributes | List of all members
ExtImportPrefsDropTarget Class Referencefinal

#include <ExtImportPrefs.h>

Inheritance diagram for ExtImportPrefsDropTarget:

Public Member Functions

 ExtImportPrefsDropTarget (wxDataObject *dataObject=nullptr)
 
 ~ExtImportPrefsDropTarget ()
 
wxDragResult OnData (wxCoord x, wxCoord y, wxDragResult def)
 
bool OnDrop (wxCoord x, wxCoord y)
 
wxDragResult OnEnter (wxCoord x, wxCoord y, wxDragResult def)
 
wxDragResult OnDragOver (wxCoord x, wxCoord y, wxDragResult def)
 
void OnLeave ()
 
void SetPrefs (ExtImportPrefs *prefs)
 

Private Attributes

ExtImportPrefsmPrefs
 

Detailed Description

Definition at line 30 of file ExtImportPrefs.h.

Constructor & Destructor Documentation

ExtImportPrefsDropTarget::ExtImportPrefsDropTarget ( wxDataObject *  dataObject = nullptr)

Definition at line 682 of file ExtImportPrefs.cpp.

References mPrefs.

683  : wxDropTarget(dataObject)
684 {
685  mPrefs = NULL;
686 }
ExtImportPrefs * mPrefs
ExtImportPrefsDropTarget::~ExtImportPrefsDropTarget ( )

Definition at line 688 of file ExtImportPrefs.cpp.

689 {
690 }

Member Function Documentation

wxDragResult ExtImportPrefsDropTarget::OnData ( wxCoord  x,
wxCoord  y,
wxDragResult  def 
)

Definition at line 697 of file ExtImportPrefs.cpp.

699 {
700  return def;
701 }
wxDragResult ExtImportPrefsDropTarget::OnDragOver ( wxCoord  x,
wxCoord  y,
wxDragResult  def 
)

Definition at line 759 of file ExtImportPrefs.cpp.

References ExtImportPrefs::GetDragFocus(), ExtImportPrefs::GetPluginList(), ExtImportPrefs::GetRuleTable(), mPrefs, ExtImportPrefs::SwapPluginRows(), and ExtImportPrefs::SwapRows().

Referenced by OnEnter().

761 {
762  if (mPrefs == NULL)
763  return wxDragNone;
764  wxListCtrl *PluginList = mPrefs->GetPluginList();
765  Grid *RuleTable = mPrefs->GetRuleTable();
766  if (mPrefs->GetDragFocus() == RuleTable)
767  {
768  int row;
769  row = RuleTable->YToRow(RuleTable->CalcUnscrolledPosition(wxPoint(x, y)).y);
770  if (row == wxNOT_FOUND)
771  return wxDragNone;
772 
773 
774  int cRow = RuleTable->GetGridCursorRow ();
775  if (row != cRow)
776  {
777  mPrefs->SwapRows (cRow, row);
778  RuleTable->SetGridCursor (row, 0);
779  RuleTable->SelectRow (row);
780  }
781  }
782  else if (mPrefs->GetDragFocus() == PluginList)
783  {
784 #if defined(__WXMSW__)
785  long item = wxCustomFindItem (PluginList, x, y);
786 #else
787  int flags = 0;
788  long item = PluginList->HitTest (wxPoint (x, y), flags, NULL);
789 #endif
790  if (item < 0)
791  return wxDragNone;
792 
793  long selected = -1;
794  selected = PluginList->GetNextItem(selected,
795  wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
796  if (selected == -1)
797  return wxDragNone;
798 
799  if (item != selected)
800  {
801  mPrefs->SwapPluginRows(selected, item);
802  PluginList->SetItemState (selected, 0, wxLIST_STATE_SELECTED);
803  PluginList->SetItemState (item, wxLIST_STATE_SELECTED,
804  wxLIST_STATE_SELECTED);
805  }
806  }
807  return wxDragMove;
808 }
void SwapRows(int row1, int row2)
Grid * GetRuleTable()
void SwapPluginRows(int row1, int row2)
ExtImportPrefs * mPrefs
wxListCtrl * GetPluginList()
wxWindow * GetDragFocus()
Supplies an accessible grid based on wxGrid.
Definition: Grid.h:193
bool ExtImportPrefsDropTarget::OnDrop ( wxCoord  x,
wxCoord  y 
)

Definition at line 726 of file ExtImportPrefs.cpp.

References ExtImportPrefs::GetDragFocus(), ExtImportPrefs::GetPluginList(), ExtImportPrefs::GetRuleTable(), and mPrefs.

727 {
728  if (mPrefs == NULL)
729  return false;
730  wxListCtrl *PluginList = mPrefs->GetPluginList();
731  Grid *RuleTable = mPrefs->GetRuleTable();
732  if (mPrefs->GetDragFocus() == RuleTable)
733  {
734  if (RuleTable->YToRow(
735  RuleTable->CalcUnscrolledPosition(wxPoint(x, y)).y) == wxNOT_FOUND)
736  return false;
737  }
738  else if (mPrefs->GetDragFocus() == PluginList)
739  {
740 #if defined(__WXMSW__)
741  long item = wxCustomFindItem (PluginList, x, y);
742 #else
743  int flags = 0;
744  long item = PluginList->HitTest (wxPoint (x, y), flags, NULL);
745 #endif
746  if (item < 0)
747  return false;
748  }
749 
750  return true;
751 }
Grid * GetRuleTable()
ExtImportPrefs * mPrefs
wxListCtrl * GetPluginList()
wxWindow * GetDragFocus()
Supplies an accessible grid based on wxGrid.
Definition: Grid.h:193
wxDragResult ExtImportPrefsDropTarget::OnEnter ( wxCoord  x,
wxCoord  y,
wxDragResult  def 
)

Definition at line 753 of file ExtImportPrefs.cpp.

References OnDragOver().

755 {
756  return OnDragOver(x, y, def);
757 }
wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def)
void ExtImportPrefsDropTarget::OnLeave ( )

Definition at line 810 of file ExtImportPrefs.cpp.

811 {
812 }
void ExtImportPrefsDropTarget::SetPrefs ( ExtImportPrefs prefs)

Definition at line 692 of file ExtImportPrefs.cpp.

References mPrefs.

693 {
694  mPrefs = prefs;
695 }
ExtImportPrefs * mPrefs

Member Data Documentation

ExtImportPrefs* ExtImportPrefsDropTarget::mPrefs
private

Definition at line 43 of file ExtImportPrefs.h.

Referenced by ExtImportPrefsDropTarget(), OnDragOver(), OnDrop(), and SetPrefs().


The documentation for this class was generated from the following files: