| 1 |
////////////////////////////////////////////////////////////////////////////// |
| 2 |
////////////////////////////////////////////////////////////////////////////// |
| 3 |
// |
| 4 |
// Copyright : (C) 2015 Eran Ifrah |
| 5 |
// File name : clFileSystemEvent.h |
| 6 |
// |
| 7 |
// ------------------------------------------------------------------------- |
| 8 |
// A |
| 9 |
// _____ _ _ _ _ |
| 10 |
// / __ \ | | | | (_) | |
| 11 |
// | / \/ ___ __| | ___| | _| |_ ___ |
| 12 |
// | | / _ \ / _ |/ _ \ | | | __/ _ ) |
| 13 |
// | \__/\ (_) | (_| | __/ |___| | || __/ |
| 14 |
// \____/\___/ \__,_|\___\_____/_|\__\___| |
| 15 |
// |
| 16 |
// F i l e |
| 17 |
// |
| 18 |
// This program is free software; you can redistribute it and/or modify |
| 19 |
// it under the terms of the GNU General Public License as published by |
| 20 |
// the Free Software Foundation; either version 2 of the License, or |
| 21 |
// (at your option) any later version. |
| 22 |
// |
| 23 |
////////////////////////////////////////////////////////////////////////////// |
| 24 |
////////////////////////////////////////////////////////////////////////////// |
| 25 |
|
| 26 |
#ifndef CLFILESYSTEMEVENT_H |
| 27 |
#define CLFILESYSTEMEVENT_H |
| 28 |
|
| 29 |
#include "cl_command_event.h" // Base class: clCommandEvent |
| 30 |
|
| 31 |
class WXDLLIMPEXP_CL clFileSystemEvent : public clCommandEvent |
| 32 |
{ |
| 33 |
enum clFileSystemEventFlags { |
| 34 |
IS_REMOTE = (1 << 0), |
| 35 |
}; |
| 36 |
|
| 37 |
protected: |
| 38 |
wxString m_path; |
| 39 |
wxString m_newpath; |
| 40 |
wxArrayString m_paths; |
| 41 |
size_t m_flags = 0; |
| 42 |
|
| 43 |
protected: |
| 44 |
void SetBit(bool b, size_t bit) |
| 45 |
{ |
| 46 |
if(b) { |
| 47 |
m_flags |= bit; |
| 48 |
} else { |
| 49 |
m_flags &= ~bit; |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
bool HasBit(size_t bit) const { return m_flags & bit; } |
| 54 |
|
| 55 |
public: |
| 56 |
clFileSystemEvent(wxEventType commandType = wxEVT_NULL, int winid = 0); |
| 57 |
clFileSystemEvent(const clFileSystemEvent& event); |
| 58 |
clFileSystemEvent& operator=(const clFileSystemEvent& src); |
| 59 |
|
| 60 |
virtual ~clFileSystemEvent(); |
| 61 |
virtual wxEvent* Clone() const { return new clFileSystemEvent(*this); } |
| 62 |
void SetPath(const wxString& path) { this->m_path = path; } |
| 63 |
const wxString& GetPath() const { return m_path; } |
| 64 |
void SetNewpath(const wxString& newpath) { this->m_newpath = newpath; } |
| 65 |
const wxString& GetNewpath() const { return m_newpath; } |
| 66 |
void SetPaths(const wxArrayString& paths) { this->m_paths = paths; } |
| 67 |
const wxArrayString& GetPaths() const { return m_paths; } |
| 68 |
wxArrayString& GetPaths() { return m_paths; } |
| 69 |
|
| 70 |
void SetIsRemoteFile(bool remote) { SetBit(IS_REMOTE, remote); }; |
| 71 |
bool IsRemoteFile() const { return HasBit(IS_REMOTE); } |
| 72 |
}; |
| 73 |
|
| 74 |
typedef void (wxEvtHandler::*clFileSystemEventFunction)(clFileSystemEvent&); |
| 75 |
#define clFileSystemEventHandler(func) wxEVENT_HANDLER_CAST(clFileSystemEventFunction, func) |
| 76 |
|
| 77 |
#endif // CLFILESYSTEMEVENT_H |