diff options
author | Deniz Türkoglu <denizt@users.noreply.github.com> | 2024-09-17 08:05:21 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-17 00:05:21 +0200 |
commit | e0a46f6b2b4bb5b5b77c22f1d2b12cbc3b7bf89c (patch) | |
tree | 82da3181639c72a07e90950ae49fe40ca9b02e35 | |
parent | eb0eec7b39534b0bec5566ef92985f163e1f7025 (diff) | |
download | VeraCrypt-e0a46f6b2b4bb5b5b77c22f1d2b12cbc3b7bf89c.tar.gz VeraCrypt-e0a46f6b2b4bb5b5b77c22f1d2b12cbc3b7bf89c.zip |
Add Option to Enable/Disable Screen Capture (#1418)
Veracrypt currently appears in screenshots and screen captures,
which can unintentionally expose sensitive information, such as
the fact that Veracrypt is running or the location of your volumes.
Both Windows and macOS offer mechanisms to exclude specific windows
from being captured. While not foolproof, this is a useful preventative
measure. The method is a no-op for Linux/FreeBSD.
For more details on the wxWidgets API, see:
https://docs.wxwidgets.org/3.2/classwx_top_level_window.html#a337b9cec62b0cbd3b1b1545a83270f64
-rw-r--r-- | src/Main/CommandLineInterface.cpp | 4 | ||||
-rw-r--r-- | src/Main/CommandLineInterface.h | 1 | ||||
-rw-r--r-- | src/Main/Forms/MainFrame.cpp | 7 | ||||
-rw-r--r-- | src/Main/Forms/MainFrame.h | 1 | ||||
-rw-r--r-- | src/Main/GraphicUserInterface.cpp | 8 | ||||
-rw-r--r-- | src/Main/GraphicUserInterface.h | 1 |
6 files changed, 22 insertions, 0 deletions
diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp index 1b4a0c1b..e26a5ee3 100644 --- a/src/Main/CommandLineInterface.cpp +++ b/src/Main/CommandLineInterface.cpp @@ -1,78 +1,80 @@ /* Derived from source code of TrueCrypt 7.1a, which is Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed by the TrueCrypt License 3.0. Modifications and additions to the original source code (contained in this file) and all other portions of this file are Copyright (c) 2013-2017 IDRIX and are governed by the Apache License 2.0 the full text of which is contained in the file License.txt included in VeraCrypt binary and source code distribution packages. */ #include "System.h" #include <wx/cmdline.h> #include <wx/tokenzr.h> #include "Core/Core.h" #include "Application.h" #include "CommandLineInterface.h" #include "LanguageStrings.h" #include "UserInterfaceException.h" namespace VeraCrypt { CommandLineInterface::CommandLineInterface (int argc, wchar_t** argv, UserInterfaceType::Enum interfaceType) : ArgCommand (CommandId::None), ArgFilesystem (VolumeCreationOptions::FilesystemType::Unknown), ArgNewPim (-1), ArgNoHiddenVolumeProtection (false), ArgPim (-1), ArgSize (0), ArgVolumeType (VolumeType::Unknown), + ArgAllowScreencapture (false), ArgDisableFileSizeCheck (false), ArgUseLegacyPassword (false), #if defined(TC_LINUX ) || defined (TC_FREEBSD) ArgUseDummySudoPassword (false), #endif StartBackgroundTask (false) { wxCmdLineParser parser; parser.SetCmdLine (argc, argv); parser.SetSwitchChars (L"-"); + parser.AddSwitch (L"", L"allow-screencapture", _("Allow window to be included in screenshots and screen captures (Windows/MacOS)")); parser.AddOption (L"", L"auto-mount", _("Auto mount device-hosted/favorite volumes")); parser.AddSwitch (L"", L"backup-headers", _("Backup volume headers")); parser.AddSwitch (L"", L"background-task", _("Start Background Task")); #ifdef TC_WINDOWS parser.AddSwitch (L"", L"cache", _("Cache passwords and keyfiles")); #endif parser.AddSwitch (L"C", L"change", _("Change password or keyfiles")); parser.AddSwitch (L"c", L"create", _("Create new volume")); parser.AddSwitch (L"", L"create-keyfile", _("Create new keyfile")); parser.AddSwitch (L"", L"delete-token-keyfiles", _("Delete security token keyfiles")); parser.AddSwitch (L"d", L"dismount", _("Dismount volume")); parser.AddSwitch (L"", L"display-password", _("Display password while typing")); parser.AddOption (L"", L"encryption", _("Encryption algorithm")); parser.AddSwitch (L"", L"explore", _("Open explorer window for mounted volume")); parser.AddSwitch (L"", L"export-token-keyfile",_("Export keyfile from token")); parser.AddOption (L"", L"filesystem", _("Filesystem type")); parser.AddSwitch (L"f", L"force", _("Force mount/dismount/overwrite")); #if !defined(TC_WINDOWS) && !defined(TC_MACOSX) parser.AddOption (L"", L"fs-options", _("Filesystem mount options")); #endif parser.AddOption (L"", L"hash", _("Hash algorithm")); parser.AddSwitch (L"h", L"help", _("Display detailed command line help"), wxCMD_LINE_OPTION_HELP); parser.AddSwitch (L"", L"import-token-keyfiles", _("Import keyfiles to security token")); parser.AddOption (L"k", L"keyfiles", _("Keyfiles")); parser.AddSwitch (L"l", L"list", _("List mounted volumes")); parser.AddSwitch (L"", L"list-token-keyfiles", _("List token keyfiles")); parser.AddSwitch (L"", L"list-securitytoken-keyfiles", _("List security token keyfiles")); parser.AddSwitch (L"", L"list-emvtoken-keyfiles", _("List EMV token keyfiles")); parser.AddSwitch (L"", L"load-preferences", _("Load user preferences")); parser.AddSwitch (L"", L"mount", _("Mount volume interactively")); parser.AddOption (L"m", L"mount-options", _("VeraCrypt volume mount options")); parser.AddOption (L"", L"new-hash", _("New hash algorithm")); parser.AddOption (L"", L"new-keyfiles", _("New keyfiles")); parser.AddOption (L"", L"new-password", _("New password")); parser.AddOption (L"", L"new-pim", _("New PIM")); @@ -110,70 +112,72 @@ namespace VeraCrypt bool param1IsVolume = false; bool param1IsMountedVolumeSpec = false; bool param1IsMountPoint = false; bool param1IsFile = false; if (parser.Parse () > 0) throw_err (_("Incorrect command line specified.")); if (parser.Found (L"help")) { ArgCommand = CommandId::Help; return; } if (parser.Found (L"text") && interfaceType != UserInterfaceType::Text) { wstring msg = wstring (_("Option -t or --text must be specified as the first argument.")); wcerr << msg << endl; throw_err (msg); } if (parser.Found (L"version")) { ArgCommand = CommandId::DisplayVersion; return; } // Preferences if (parser.Found (L"load-preferences")) { // Load preferences first to allow command line options to override them Preferences.Load(); ArgMountOptions = Preferences.DefaultMountOptions; } + ArgAllowScreencapture = parser.Found (L"allow-screencapture"); + // Commands if (parser.Found (L"auto-mount", &str)) { CheckCommandSingle(); wxStringTokenizer tokenizer (str, L","); while (tokenizer.HasMoreTokens()) { wxString token = tokenizer.GetNextToken(); if (token == L"devices") { if (ArgCommand == CommandId::AutoMountFavorites) ArgCommand = CommandId::AutoMountDevicesFavorites; else ArgCommand = CommandId::AutoMountDevices; param1IsMountPoint = true; } else if (token == L"favorites") { if (ArgCommand == CommandId::AutoMountDevices) ArgCommand = CommandId::AutoMountDevicesFavorites; else ArgCommand = CommandId::AutoMountFavorites; } else { throw_err (LangString["UNKNOWN_OPTION"] + L": " + token); } } } if (parser.Found (L"backup-headers")) { diff --git a/src/Main/CommandLineInterface.h b/src/Main/CommandLineInterface.h index 4003dc05..f773ca6f 100644 --- a/src/Main/CommandLineInterface.h +++ b/src/Main/CommandLineInterface.h @@ -52,61 +52,62 @@ namespace VeraCrypt Test }; }; struct CommandLineInterface { public: CommandLineInterface (int argc, wchar_t** argv, UserInterfaceType::Enum interfaceType); virtual ~CommandLineInterface (); CommandId::Enum ArgCommand; bool ArgDisplayPassword; shared_ptr <EncryptionAlgorithm> ArgEncryptionAlgorithm; shared_ptr <FilePath> ArgFilePath; VolumeCreationOptions::FilesystemType::Enum ArgFilesystem; bool ArgForce; shared_ptr <Hash> ArgHash; shared_ptr <KeyfileList> ArgKeyfiles; MountOptions ArgMountOptions; shared_ptr <DirectoryPath> ArgMountPoint; shared_ptr <Hash> ArgNewHash; shared_ptr <KeyfileList> ArgNewKeyfiles; shared_ptr <VolumePassword> ArgNewPassword; int ArgNewPim; bool ArgNoHiddenVolumeProtection; shared_ptr <VolumePassword> ArgPassword; int ArgPim; bool ArgQuick; FilesystemPath ArgRandomSourcePath; uint64 ArgSize; shared_ptr <VolumePath> ArgVolumePath; VolumeInfoList ArgVolumes; VolumeType::Enum ArgVolumeType; shared_ptr<SecureBuffer> ArgTokenPin; + bool ArgAllowScreencapture; bool ArgDisableFileSizeCheck; bool ArgUseLegacyPassword; #if defined(TC_LINUX ) || defined (TC_FREEBSD) bool ArgUseDummySudoPassword; #endif bool StartBackgroundTask; UserPreferences Preferences; protected: void CheckCommandSingle () const; shared_ptr <KeyfileList> ToKeyfileList (const wxString &arg) const; VolumeInfoList GetMountedVolumes (const wxString &filter) const; private: CommandLineInterface (const CommandLineInterface &); CommandLineInterface &operator= (const CommandLineInterface &); }; shared_ptr<VolumePassword> ToUTF8Password (const wchar_t* str, size_t charCount, size_t maxUtf8Len); shared_ptr<SecureBuffer> ToUTF8Buffer (const wchar_t* str, size_t charCount, size_t maxUtf8Len); extern unique_ptr <CommandLineInterface> CmdLine; } #endif // TC_HEADER_Main_CommandInterface diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp index 6355f139..77f371d8 100644 --- a/src/Main/Forms/MainFrame.cpp +++ b/src/Main/Forms/MainFrame.cpp @@ -52,70 +52,71 @@ namespace VeraCrypt ListItemRightClickEventPending (false), SelectedItemIndex (-1), SelectedSlotNumber (0), ShowRequestFifo (-1) { wxBusyCursor busy; SetName (Application::GetName()); SetTitle (Application::GetName()); SetIcon (Resources::GetVeraCryptIcon()); #if defined(TC_UNIX) && !defined(TC_MACOSX) try { string fifoPath = GetShowRequestFifoPath(); remove (fifoPath.c_str()); throw_sys_if (mkfifo (fifoPath.c_str(), S_IRUSR | S_IWUSR) == -1); ShowRequestFifo = open (fifoPath.c_str(), O_RDONLY | O_NONBLOCK); throw_sys_if (ShowRequestFifo == -1); } catch (...) { #ifdef DEBUG throw; #endif } #endif InitControls(); InitPreferences(); InitTaskBarIcon(); InitEvents(); InitMessageFilter(); + InitWindowPrivacy(); if (!GetPreferences().SecurityTokenModule.IsEmpty() && !SecurityToken::IsInitialized()) { try { Gui->InitSecurityTokenLibrary(); } catch (exception &e) { Gui->ShowError (e); } } Connect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnQuit ) ); Connect( wxID_ANY, wxEVT_COMMAND_UPDATE_VOLUME_LIST, wxCommandEventHandler( MainFrame::OnUpdateVolumeList ) ); Connect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) ); Connect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) ); #ifdef TC_MACOSX Connect( wxID_ANY, wxEVT_MOVE, wxMoveEventHandler( MainFrame::OnMoveHandler ) ); #endif } MainFrame::~MainFrame () { #if defined(TC_UNIX) && !defined(TC_MACOSX) if (ShowRequestFifo != -1) { try { close (ShowRequestFifo); remove (string (GetShowRequestFifoPath()).c_str()); } catch (...) { } } @@ -438,70 +439,76 @@ namespace VeraCrypt static LRESULT CALLBACK MainFrameWndProcFilter (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { if (message == WM_DEVICECHANGE && !Core->IsDeviceChangeInProgress()) { MainFrame *frame = dynamic_cast <MainFrame *> (Gui->GetMainFrame()); PDEV_BROADCAST_HDR hdr = (PDEV_BROADCAST_HDR) lParam; if (wParam == DBT_DEVICEREMOVECOMPLETE && hdr->dbch_devicetype == DBT_DEVTYP_VOLUME) { PDEV_BROADCAST_VOLUME vol = (PDEV_BROADCAST_VOLUME) lParam; for (wchar_t driveNo = 0; driveNo < 26; ++driveNo) { if (vol->dbcv_unitmask & (1 << driveNo)) frame->OnDeviceChange (wstring (StringFormatter (L"{0}:\\", wchar_t (L'A' + driveNo)))); } } else { frame->OnDeviceChange (); } } return CallWindowProc (MainFrameWndProc, hwnd, message, wParam, lParam); } #endif void MainFrame::InitMessageFilter () { #ifdef TC_WINDOWS HWND mainFrameHwnd = static_cast <HWND> (GetHandle()); MainFrameWndProc = (WNDPROC) GetWindowLongPtr (mainFrameHwnd, GWL_WNDPROC); SetWindowLongPtr (mainFrameHwnd, GWL_WNDPROC, (LONG_PTR) MainFrameWndProcFilter); #endif } + + void MainFrame::InitWindowPrivacy () + { + Gui->SetContentProtection(!CmdLine->ArgAllowScreencapture); + } + void MainFrame::InitPreferences () { try { LoadPreferences(); VolumeSlotNumber lastSelectedSlotNumber = GetPreferences().LastSelectedSlotNumber; if (Core->IsSlotNumberValid (lastSelectedSlotNumber)) { long slotIndex = SlotNumberToItemIndex (lastSelectedSlotNumber); if (slotIndex >= 0) { SlotListCtrl->SetItemState (slotIndex, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); SlotListCtrl->EnsureVisible (slotIndex); } } LoadFavoriteVolumes(); VolumeHistory::Load(); if (VolumePathComboBox->GetValue().empty() && !VolumeHistory::Get().empty()) SetVolumePath (VolumeHistory::Get().front()); } catch (exception &e) { Gui->ShowError (e); Gui->ShowError (LangString["LINUX_ERROR_LOADING_CONFIG"] + wstring (Application::GetConfigFilePath (L""))); } } void MainFrame::InitTaskBarIcon () { class TaskBarIcon : public wxTaskBarIcon { public: diff --git a/src/Main/Forms/MainFrame.h b/src/Main/Forms/MainFrame.h index ab70eae3..ed1c44f7 100644 --- a/src/Main/Forms/MainFrame.h +++ b/src/Main/Forms/MainFrame.h @@ -52,70 +52,71 @@ namespace VeraCrypt GtkWidget *indicator_item_mountfavorites; GtkWidget *indicator_item_dismountall; GtkWidget *indicator_item_prefs; GtkWidget *indicator_item_exit; void SetBusy (bool busy); #endif protected: enum { ColumnSlot = 0, ColumnPath, ColumnSize, #ifdef TC_WINDOWS ColumnEA, #else ColumnMountPoint, #endif ColumnType }; void AddToFavorites (const VolumeInfoList &volumes); bool CanExit () const; void ChangePassword (ChangePasswordDialog::Mode::Enum mode = ChangePasswordDialog::Mode::ChangePasswordAndKeyfiles); void CheckFilesystem (bool repair = false); bool CheckVolumePathNotEmpty () const; void DismountVolume (shared_ptr <VolumeInfo> volume = shared_ptr <VolumeInfo> ()); const UserPreferences &GetPreferences () const { return Gui->GetPreferences(); } shared_ptr <VolumeInfo> GetSelectedVolume () const; shared_ptr <VolumePath> GetSelectedVolumePath () const { return make_shared <VolumePath> (wstring (VolumePathComboBox->GetValue())); } void InitControls (); void InitEvents (); void InitMessageFilter (); void InitPreferences (); void InitTaskBarIcon (); + void InitWindowPrivacy(); bool IsFreeSlotSelected () const { return SlotListCtrl->GetSelectedItemCount() == 1 && Gui->GetListCtrlSubItemText (SlotListCtrl, SelectedItemIndex, ColumnPath).empty(); } bool IsMountedSlotSelected () const { return SlotListCtrl->GetSelectedItemCount() == 1 && !Gui->GetListCtrlSubItemText (SlotListCtrl, SelectedItemIndex, ColumnPath).empty(); } void LoadFavoriteVolumes (); void LoadPreferences (); void MountAllDevices (); void MountVolume (); void OnAboutMenuItemSelected (wxCommandEvent& event); void OnQuit(wxCommandEvent& event) { Close(true); } void OnActivate (wxActivateEvent& event); void OnAddAllMountedToFavoritesMenuItemSelected (wxCommandEvent& event); void OnAddToFavoritesMenuItemSelected (wxCommandEvent& event); void OnBackupVolumeHeadersMenuItemSelected (wxCommandEvent& event); void OnBeginnersTutorialMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"tutorial"); } void OnBenchmarkMenuItemSelected (wxCommandEvent& event); void OnChangeKeyfilesMenuItemSelected (wxCommandEvent& event) { ChangePassword (ChangePasswordDialog::Mode::ChangeKeyfiles); } void OnChangePasswordMenuItemSelected (wxCommandEvent& event) { ChangePassword (); } void OnChangePkcs5PrfMenuItemSelected (wxCommandEvent& event) { ChangePassword (ChangePasswordDialog::Mode::ChangePkcs5Prf); } void OnCheckFilesystemMenuItemSelected( wxCommandEvent& event ) { CheckFilesystem (); } void OnClearSlotSelectionMenuItemSelected (wxCommandEvent& event); void OnClose (wxCloseEvent& event); void OnCloseAllSecurityTokenSessionsMenuItemSelected (wxCommandEvent& event); void OnDonateMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"donate"); } void OnContactMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"contact"); } void OnCreateKeyfileMenuItemSelected (wxCommandEvent& event) { #ifdef TC_MACOSX if (Gui->IsInBackgroundMode()) Gui->SetBackgroundMode (false); #endif Gui->CreateKeyfile(); } void OnCreateVolumeButtonClick (wxCommandEvent& event); void OnDefaultKeyfilesMenuItemSelected (wxCommandEvent& event); void OnDefaultMountParametersMenuItemSelected( wxCommandEvent& event ); void OnDismountAllButtonClick (wxCommandEvent& event); diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp index 41bfa100..1cb62671 100644 --- a/src/Main/GraphicUserInterface.cpp +++ b/src/Main/GraphicUserInterface.cpp @@ -1842,70 +1842,78 @@ namespace VeraCrypt listCtrl->GetItemRect (0, itemRect); if (addedCols) listCtrl->ClearAll(); else listCtrl->DeleteAllItems(); } else listCtrl->GetItemRect (0, itemRect); int headerHeight = itemRect.y; #ifdef TC_WINDOWS headerHeight += 4; #elif defined (TC_MACOSX) headerHeight += 7; #elif defined (__WXGTK__) headerHeight += 5; #endif int rowHeight = itemRect.height; #ifdef TC_MACOSX rowHeight += 1; #endif listCtrl->SetMinSize (wxSize (listCtrl->GetMinSize().GetWidth(), rowHeight * rowCount + headerHeight)); } void GraphicUserInterface::SetListCtrlWidth (wxListCtrl *listCtrl, size_t charCount, bool hasVerticalScrollbar) const { int width = GetCharWidth (listCtrl) * charCount; #ifdef TC_MACOSX if (!hasVerticalScrollbar) width += GetScrollbarWidth (listCtrl); #endif listCtrl->SetMinSize (wxSize (width, listCtrl->GetMinSize().GetHeight())); } + + void GraphicUserInterface::SetContentProtection (bool enable) const + { +#if defined(TC_WINDOWS) || defined(TC_MACOSX) + GetActiveWindow()->SetContentProtection(enable ? wxCONTENT_PROTECTION_ENABLED : wxCONTENT_PROTECTION_NONE); +#endif + } + void GraphicUserInterface::ShowErrorTopMost (const wxString &message) const { ShowMessage (message, wxOK | wxICON_ERROR, true); } void GraphicUserInterface::ShowInfoTopMost (const wxString &message) const { ShowMessage (message, wxOK | wxICON_INFORMATION, true); } int GraphicUserInterface::ShowMessage (const wxString &message, long style, bool topMost) const { wxString caption = Application::GetName(); wxString subMessage = message; #ifdef TC_MACOSX size_t p = message.find (L"\n"); if (p != string::npos) { // Divide message to caption and info message caption = message.substr (0, p); p = message.find_first_not_of (L'\n', p); if (p != string::npos) subMessage = message.substr (p); else subMessage.clear(); if (subMessage.EndsWith (L"?")) { // Move question to caption caption += wstring (L" "); p = subMessage.find_last_of (L".\n"); if (p != string::npos) { diff --git a/src/Main/GraphicUserInterface.h b/src/Main/GraphicUserInterface.h index d48b7973..d333551c 100644 --- a/src/Main/GraphicUserInterface.h +++ b/src/Main/GraphicUserInterface.h @@ -54,70 +54,71 @@ namespace VeraCrypt virtual int GetDefaultBorderSize () const { return 5; } virtual wxFont GetDefaultBoldFont (wxWindow *window) const; virtual wxString GetHomepageLinkURL (const wxString &linkId, const wxString &extraVars = wxEmptyString) const; virtual wxFrame *GetMainFrame () const { return mMainFrame; } virtual int GetScrollbarWidth (wxWindow *window, bool noScrollBar = false) const; virtual list <long> GetListCtrlSelectedItems (wxListCtrl *listCtrl) const; virtual wxString GetListCtrlSubItemText (wxListCtrl *listCtrl, long itemIndex, int columnIndex) const; virtual void ImportTokenKeyfiles () const { ThrowTextModeRequired(); } virtual void InitSecurityTokenLibrary () const; virtual void InsertToListCtrl (wxListCtrl *listCtrl, long itemIndex, const vector <wstring> &itemFields, int imageIndex = -1, void *itemDataPtr = nullptr) const; virtual bool IsInBackgroundMode () const { return BackgroundMode; } virtual bool IsTheOnlyTopLevelWindow (const wxWindow *window) const; virtual void ListTokenKeyfiles () const; virtual void ListSecurityTokenKeyfiles () const; virtual void ListEMVTokenKeyfiles () const; virtual VolumeInfoList MountAllDeviceHostedVolumes (MountOptions &options) const; virtual shared_ptr <VolumeInfo> MountVolume (MountOptions &options) const; virtual void MoveListCtrlItem (wxListCtrl *listCtrl, long itemIndex, long newItemIndex) const; virtual void OnAutoDismountAllEvent (); virtual bool OnInit (); virtual void OnLogOff (); virtual void OpenDocument (wxWindow *parent, const wxFileName &document); virtual void OpenHomepageLink (wxWindow *parent, const wxString &linkId, const wxString &extraVars = wxEmptyString); virtual void OpenOnlineHelp (wxWindow *parent); virtual void OpenUserGuide (wxWindow *parent); virtual void RestoreVolumeHeaders (shared_ptr <VolumePath> volumePath) const; virtual DevicePath SelectDevice (wxWindow *parent) const; virtual DirectoryPath SelectDirectory (wxWindow *parent, const wxString &message = wxEmptyString, bool existingOnly = true) const; virtual FilePathList SelectFiles (wxWindow *parent, const wxString &caption, bool saveMode = false, bool allowMultiple = false, const list < pair <wstring, wstring> > &fileExtensions = (list < pair <wstring, wstring> > ()), const DirectoryPath &directory = DirectoryPath()) const; virtual FilePath SelectVolumeFile (wxWindow *parent, bool saveMode = false, const DirectoryPath &directory = DirectoryPath()) const; virtual void SetActiveFrame (wxFrame *frame) { ActiveFrame = frame; } virtual void SetBackgroundMode (bool state); virtual void SetListCtrlColumnWidths (wxListCtrl *listCtrl, list <int> columnWidthPermilles, bool hasVerticalScrollbar = true) const; virtual void SetListCtrlHeight (wxListCtrl *listCtrl, size_t rowCount) const; virtual void SetListCtrlWidth (wxListCtrl *listCtrl, size_t charCount, bool hasVerticalScrollbar = true) const; + virtual void SetContentProtection(bool enable) const; virtual void ShowErrorTopMost (char *langStringId) const { ShowErrorTopMost (LangString[langStringId]); } virtual void ShowErrorTopMost (const wxString &message) const; virtual void ShowInfoTopMost (char *langStringId) const { ShowInfoTopMost (LangString[langStringId]); } virtual void ShowInfoTopMost (const wxString &message) const; virtual void ShowWarningTopMost (char *langStringId) const { ShowWarningTopMost (LangString[langStringId]); } virtual void ShowWarningTopMost (const wxString &message) const; virtual bool UpdateListCtrlItem (wxListCtrl *listCtrl, long itemIndex, const vector <wstring> &itemFields) const; virtual void UserEnrichRandomPool (wxWindow *parent, shared_ptr <Hash> hash = shared_ptr <Hash>()) const; virtual void Yield () const; virtual shared_ptr <VolumeInfo> MountVolumeThread (MountOptions &options) const; WaitDialog* GetWaitDialog () { return mWaitDialog; } void ExecuteWaitThreadRoutine (wxWindow *parent, WaitThreadRoutine *pRoutine) const; #ifdef TC_MACOSX virtual void MacOpenFiles (const wxArrayString &fileNames); virtual void MacReopenApp (); static bool HandlePasswordEntryCustomEvent (wxEvent& event); static void InstallPasswordEntryCustomKeyboardShortcuts (wxWindow* window); #endif template <class T> T *GetSelectedData (wxControlWithItems *control) const { int sel = control->GetSelection(); if (sel == wxNOT_FOUND) return nullptr; return reinterpret_cast <T *> (control->GetClientData (sel)); } Event OpenVolumeSystemRequestEvent; protected: virtual void OnEndSession (wxCloseEvent& event) { OnLogOff(); } #ifdef wxHAS_POWER_EVENTS |