Annotation of truecrypt/main/graphicuserinterface.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
                      3: 
                      4:  Governed by the TrueCrypt License 2.4 the full text of which is contained
                      5:  in the file License.txt included in TrueCrypt binary and source code
                      6:  distribution packages.
                      7: */
                      8: 
                      9: #ifndef TC_HEADER_Main_GraphicUserInterface
                     10: #define TC_HEADER_Main_GraphicUserInterface
                     11: 
                     12: #include "System.h"
                     13: #include <utility>
                     14: #include "Main.h"
                     15: #include "UserInterface.h"
                     16: 
                     17: namespace TrueCrypt
                     18: {
                     19:        class GraphicUserInterface : public UserInterface
                     20:        {
                     21:        public:
                     22:                GraphicUserInterface ();
                     23:                virtual ~GraphicUserInterface ();
                     24: 
                     25:                virtual void AppendToListCtrl (wxListCtrl *listCtrl, const vector <wstring> &itemFields, int imageIndex = -1, void *itemDataPtr = nullptr) const;
                     26:                virtual wxMenuItem *AppendToMenu (wxMenu &menu, const wxString &label, wxEvtHandler *handler = nullptr, wxObjectEventFunction handlerFunction = nullptr, int itemId = wxID_ANY) const;
                     27:                virtual bool AskYesNo (const wxString &message, bool defaultYes = false, bool warning = false) const;
                     28:                virtual void AutoDismountVolumes (VolumeInfoList mountedVolumes, bool alwaysForce = true);
                     29:                virtual void BeginBusyState () const { wxBeginBusyCursor(); }
                     30:                virtual void BeginInteractiveBusyState (wxWindow *window);
                     31:                virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>()) const;
                     32:                virtual void ClearListCtrlSelection (wxListCtrl *listCtrl) const;
                     33:                virtual void DoShowError (const wxString &message) const;
                     34:                virtual void DoShowInfo (const wxString &message) const;
                     35:                virtual void DoShowString (const wxString &str) const;
                     36:                virtual void DoShowWarning (const wxString &message) const;
                     37:                virtual void EndBusyState () const { wxEndBusyCursor(); }
                     38:                virtual void EndInteractiveBusyState (wxWindow *window) const;
                     39:                virtual wxTopLevelWindow *GetActiveWindow () const;
                     40:                virtual shared_ptr <GetStringFunctor> GetAdminPasswordRequestHandler ();
                     41:                virtual int GetCharHeight (wxWindow *window) const;
                     42:                virtual int GetCharWidth (wxWindow *window) const;
                     43:                virtual int GetDefaultBorderSize () const { return 5; }
                     44:                virtual wxFont GetDefaultBoldFont (wxWindow *window) const;
                     45:                virtual wxString GetHomepageLinkURL (const wxString &linkId, const wxString &extraVars = wxEmptyString) const;
                     46:                virtual wxFrame *GetMainFrame () const { return mMainFrame; }
                     47:                virtual int GetScrollbarWidth (wxWindow *window, bool noScrollBar = false) const;
                     48:                virtual list <long> GetListCtrlSelectedItems (wxListCtrl *listCtrl) const;
                     49:                virtual wxString GetListCtrlSubItemText (wxListCtrl *listCtrl, long itemIndex, int columnIndex) const;
                     50:                virtual void InsertToListCtrl (wxListCtrl *listCtrl, long itemIndex, const vector <wstring> &itemFields, int imageIndex = -1, void *itemDataPtr = nullptr) const;
                     51:                virtual bool IsInBackgroundMode () const { return BackgroundMode; }
                     52:                virtual bool IsTheOnlyTopLevelWindow (const wxWindow *window) const;
                     53:                virtual VolumeInfoList MountAllDeviceHostedVolumes (MountOptions &options) const;
                     54:                virtual shared_ptr <VolumeInfo> MountVolume (MountOptions &options) const;
                     55:                virtual void MoveListCtrlItem (wxListCtrl *listCtrl, long itemIndex, long newItemIndex) const;
                     56:                virtual void OnAutoDismountAllEvent ();
                     57:                virtual bool OnInit ();
                     58:                virtual void OnLogOff ();
                     59:                virtual void OpenDocument (wxWindow *parent, const wxFileName &document);
                     60:                virtual void OpenHomepageLink (wxWindow *parent, const wxString &linkId, const wxString &extraVars = wxEmptyString);
                     61:                virtual void OpenOnlineHelp (wxWindow *parent);
                     62:                virtual void OpenUserGuide (wxWindow *parent);
                     63:                virtual DevicePath SelectDevice (wxWindow *parent) const;
                     64:                virtual DirectoryPath SelectDirectory (wxWindow *parent, const wxString &message = wxEmptyString, bool existingOnly = true) const;
                     65:                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;
                     66:                virtual FilePath SelectVolumeFile (wxWindow *parent, bool saveMode = false, const DirectoryPath &directory = DirectoryPath()) const;
                     67:                virtual void SetBackgroundMode (bool state);
                     68:                virtual void SetListCtrlColumnWidths (wxListCtrl *listCtrl, list <int> columnWidthPermilles, bool hasVerticalScrollbar = true) const;
                     69:                virtual void SetListCtrlHeight (wxListCtrl *listCtrl, size_t rowCount) const;
                     70:                virtual void SetListCtrlWidth (wxListCtrl *listCtrl, size_t charCount, bool hasVerticalScrollbar = true) const;
                     71:                virtual void ShowErrorTopMost (char *langStringId) const { ShowErrorTopMost (LangString[langStringId]); }
                     72:                virtual void ShowErrorTopMost (const wxString &message) const;
                     73:                virtual void ShowInfoTopMost (char *langStringId) const { ShowInfoTopMost (LangString[langStringId]); }
                     74:                virtual void ShowInfoTopMost (const wxString &message) const;
                     75:                virtual void ShowWarningTopMost (char *langStringId) const { ShowWarningTopMost (LangString[langStringId]); }
                     76:                virtual void ShowWarningTopMost (const wxString &message) const;
                     77:                virtual bool UpdateListCtrlItem (wxListCtrl *listCtrl, long itemIndex, const vector <wstring> &itemFields) const;
                     78:                virtual void Yield () const;
                     79: 
                     80:                template <class T>
                     81:                T *GetSelectedData (wxControlWithItems *control) const
                     82:                {
                     83:                        int sel = control->GetSelection();
                     84:                        if (sel == wxNOT_FOUND)
                     85:                                return nullptr;
                     86: 
                     87:                        return reinterpret_cast <T *> (control->GetClientData (sel));
                     88:                }
                     89: 
                     90:        protected:
                     91:                virtual void OnEndSession (wxCloseEvent& event) { OnLogOff(); }
                     92: #ifdef wxHAS_POWER_EVENTS
                     93:                virtual void OnPowerSuspending (wxPowerEvent& event);
                     94: #endif
                     95:                static void OnSignal (int signal);
                     96:                virtual void OnVolumesAutoDismounted ();
                     97:                virtual int ShowMessage (const wxString &message, long style, bool topMost = false) const;
                     98:                
                     99:                bool BackgroundMode;
                    100: #ifdef TC_WINDOWS
                    101:                auto_ptr <wxDDEServer> DDEServer;
                    102: #endif
                    103:                wxFrame *mMainFrame;
                    104:                auto_ptr <wxSingleInstanceChecker> SingleInstanceChecker;
                    105: 
                    106:        private:
                    107:                GraphicUserInterface (const GraphicUserInterface &);
                    108:                GraphicUserInterface &operator= (const GraphicUserInterface &);
                    109:        };
                    110: 
                    111:        class FreezeScope
                    112:        {
                    113:        public:
                    114:                FreezeScope (wxWindow *window) : Window (window)
                    115:                {
                    116:                        Window->Freeze();
                    117:                }
                    118: 
                    119:                ~FreezeScope ()
                    120:                {
                    121:                        Window->Thaw();
                    122:                }
                    123: 
                    124:                wxWindow *Window;
                    125:        };
                    126: 
                    127:        DECLARE_EVENT_TYPE (TC_EVENT_THREAD_EXITING, -1);
                    128: 
                    129:        extern GraphicUserInterface *Gui;
                    130: }
                    131: 
                    132: #endif // TC_HEADER_Main_GraphicUserInterface

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.