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

#include <ExtImportPrefs.h>

Inheritance diagram for ExtImportPrefsDropTarget:
[legend]
Collaboration diagram for ExtImportPrefsDropTarget:
[legend]

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 33 of file ExtImportPrefs.h.

Constructor & Destructor Documentation

◆ ExtImportPrefsDropTarget()

ExtImportPrefsDropTarget::ExtImportPrefsDropTarget ( wxDataObject *  dataObject = nullptr)

Definition at line 721 of file ExtImportPrefs.cpp.

722 : wxDropTarget(dataObject)
723{
724 mPrefs = NULL;
725}
ExtImportPrefs * mPrefs

References mPrefs.

◆ ~ExtImportPrefsDropTarget()

ExtImportPrefsDropTarget::~ExtImportPrefsDropTarget ( )

Definition at line 727 of file ExtImportPrefs.cpp.

728{
729}

Member Function Documentation

◆ OnData()

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

Definition at line 736 of file ExtImportPrefs.cpp.

738{
739 return def;
740}

◆ OnDragOver()

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

Definition at line 798 of file ExtImportPrefs.cpp.

800{
801 if (mPrefs == NULL)
802 return wxDragNone;
803 wxListCtrl *PluginList = mPrefs->GetPluginList();
804 Grid *RuleTable = mPrefs->GetRuleTable();
805 if (mPrefs->GetDragFocus() == RuleTable)
806 {
807 int row;
808 row = RuleTable->YToRow(RuleTable->CalcUnscrolledPosition(wxPoint(x, y)).y);
809 if (row == wxNOT_FOUND)
810 return wxDragNone;
811
812
813 int cRow = RuleTable->GetGridCursorRow ();
814 if (row != cRow)
815 {
816 mPrefs->SwapRows (cRow, row);
817 RuleTable->SetGridCursor (row, 0);
818 RuleTable->SelectRow (row);
819 }
820 }
821 else if (mPrefs->GetDragFocus() == PluginList)
822 {
823#if defined(__WXMSW__)
824 long item = wxCustomFindItem (PluginList, x, y);
825#else
826 int flags = 0;
827 long item = PluginList->HitTest (wxPoint (x, y), flags, NULL);
828#endif
829 if (item < 0)
830 return wxDragNone;
831
832 long selected = -1;
833 selected = PluginList->GetNextItem(selected,
834 wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
835 if (selected == -1)
836 return wxDragNone;
837
838 if (item != selected)
839 {
840 mPrefs->SwapPluginRows(selected, item);
841 PluginList->SetItemState (selected, 0, wxLIST_STATE_SELECTED);
842 PluginList->SetItemState (item, wxLIST_STATE_SELECTED,
843 wxLIST_STATE_SELECTED);
844 }
845 }
846 return wxDragMove;
847}
long wxCustomFindItem(wxListCtrl *list, int x, int y)
Grid * GetRuleTable()
wxListCtrl * GetPluginList()
wxWindow * GetDragFocus()
void SwapPluginRows(int row1, int row2)
void SwapRows(int row1, int row2)
Supplies an accessible grid based on wxGrid.
Definition: Grid.h:190

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

Referenced by OnEnter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnDrop()

bool ExtImportPrefsDropTarget::OnDrop ( wxCoord  x,
wxCoord  y 
)

Definition at line 765 of file ExtImportPrefs.cpp.

766{
767 if (mPrefs == NULL)
768 return false;
769 wxListCtrl *PluginList = mPrefs->GetPluginList();
770 Grid *RuleTable = mPrefs->GetRuleTable();
771 if (mPrefs->GetDragFocus() == RuleTable)
772 {
773 if (RuleTable->YToRow(
774 RuleTable->CalcUnscrolledPosition(wxPoint(x, y)).y) == wxNOT_FOUND)
775 return false;
776 }
777 else if (mPrefs->GetDragFocus() == PluginList)
778 {
779#if defined(__WXMSW__)
780 long item = wxCustomFindItem (PluginList, x, y);
781#else
782 int flags = 0;
783 long item = PluginList->HitTest (wxPoint (x, y), flags, NULL);
784#endif
785 if (item < 0)
786 return false;
787 }
788
789 return true;
790}

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

Here is the call graph for this function:

◆ OnEnter()

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

Definition at line 792 of file ExtImportPrefs.cpp.

794{
795 return OnDragOver(x, y, def);
796}
wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def)

References OnDragOver().

Here is the call graph for this function:

◆ OnLeave()

void ExtImportPrefsDropTarget::OnLeave ( )

Definition at line 849 of file ExtImportPrefs.cpp.

850{
851}

◆ SetPrefs()

void ExtImportPrefsDropTarget::SetPrefs ( ExtImportPrefs prefs)

Definition at line 731 of file ExtImportPrefs.cpp.

732{
733 mPrefs = prefs;
734}
MockedPrefs prefs

References mPrefs, and prefs.

Member Data Documentation

◆ mPrefs

ExtImportPrefs* ExtImportPrefsDropTarget::mPrefs
private

Definition at line 46 of file ExtImportPrefs.h.

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


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