1 /* 2 * Part of WCM Commander 3 * https://github.com/corporateshark/WCMCommander 4 * wcm@linderdaum.com 5 */ 6 7 #pragma once 8 9 #include "ncdialogs.h" 10 11 #include <vector> 12 13 enum eFileAssociation 14 { 15 eFileAssociation_Execute, 16 eFileAssociation_ExecuteSecondary, 17 eFileAssociation_View, 18 eFileAssociation_ViewSecondary, 19 eFileAssociation_Edit, 20 eFileAssociation_EditSecondary, 21 }; 22 23 class clNCFileAssociation 24 { 25 public: clNCFileAssociation()26 clNCFileAssociation() 27 : m_HasTerminal( true ) 28 {} GetMask()29 const std::vector<unicode_t>& GetMask() const { return m_Mask; } GetDescription()30 const std::vector<unicode_t>& GetDescription() const { return m_Description; } GetExecuteCommand()31 const std::vector<unicode_t>& GetExecuteCommand() const { return m_ExecuteCommand; } GetExecuteCommandSecondary()32 const std::vector<unicode_t>& GetExecuteCommandSecondary() const { return m_ExecuteCommandSecondary; } GetViewCommand()33 const std::vector<unicode_t>& GetViewCommand() const { return m_ViewCommand; } GetViewCommandSecondary()34 const std::vector<unicode_t>& GetViewCommandSecondary() const { return m_ViewCommandSecondary; } GetEditCommand()35 const std::vector<unicode_t>& GetEditCommand() const { return m_EditCommand; } GetEditCommandSecondary()36 const std::vector<unicode_t>& GetEditCommandSecondary() const { return m_EditCommandSecondary; } GetHasTerminal()37 bool GetHasTerminal() const { return m_HasTerminal; } 38 Get(eFileAssociation Mode)39 const std::vector<unicode_t>& Get( eFileAssociation Mode ) const 40 { 41 switch ( Mode ) 42 { 43 case eFileAssociation_Execute: 44 return GetExecuteCommand(); 45 46 case eFileAssociation_ExecuteSecondary: 47 return GetExecuteCommandSecondary(); 48 49 case eFileAssociation_View: 50 return GetViewCommand(); 51 52 case eFileAssociation_ViewSecondary: 53 return GetViewCommandSecondary(); 54 55 case eFileAssociation_Edit: 56 return GetEditCommand(); 57 58 case eFileAssociation_EditSecondary: 59 return GetEditCommandSecondary(); 60 } 61 62 return GetExecuteCommand(); 63 } 64 SetMask(const std::vector<unicode_t> & S)65 void SetMask( const std::vector<unicode_t>& S ) { m_Mask = S; } SetDescription(const std::vector<unicode_t> & S)66 void SetDescription( const std::vector<unicode_t>& S ) { m_Description = S; } SetExecuteCommand(const std::vector<unicode_t> & S)67 void SetExecuteCommand( const std::vector<unicode_t>& S ) { m_ExecuteCommand = S; } SetExecuteCommandSecondary(const std::vector<unicode_t> & S)68 void SetExecuteCommandSecondary( const std::vector<unicode_t>& S ) { m_ExecuteCommandSecondary = S; } SetViewCommand(const std::vector<unicode_t> & S)69 void SetViewCommand( const std::vector<unicode_t>& S ) { m_ViewCommand = S; } SetViewCommandSecondary(const std::vector<unicode_t> & S)70 void SetViewCommandSecondary( const std::vector<unicode_t>& S ) { m_ViewCommandSecondary = S; } SetEditCommand(const std::vector<unicode_t> & S)71 void SetEditCommand( const std::vector<unicode_t>& S ) { m_EditCommand = S; } SetEditCommandSecondary(const std::vector<unicode_t> & S)72 void SetEditCommandSecondary( const std::vector<unicode_t>& S ) { m_EditCommandSecondary = S; } SetHasTerminal(bool HasTerminal)73 void SetHasTerminal( bool HasTerminal ) { m_HasTerminal = HasTerminal; } 74 75 private: 76 std::vector<unicode_t> m_Mask; 77 std::vector<unicode_t> m_Description; 78 std::vector<unicode_t> m_ExecuteCommand; 79 std::vector<unicode_t> m_ExecuteCommandSecondary; 80 std::vector<unicode_t> m_ViewCommand; 81 std::vector<unicode_t> m_ViewCommandSecondary; 82 std::vector<unicode_t> m_EditCommand; 83 std::vector<unicode_t> m_EditCommandSecondary; 84 bool m_HasTerminal; 85 }; 86 87 bool FileAssociationsDlg( NCDialogParent* Parent, std::vector<clNCFileAssociation>* Associations ); 88