Mercurial > vba-linux
view src/win32/AcceleratorManager.h @ 3:b05d00f19d80
fix some formatting
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:33:11 -0600 |
parents | f9f4f1b99eed |
children |
line wrap: on
line source
1 ////////////////////////////////////////////////////////////////////////////////2 // Copyright (C) 1998 by Thierry Maurel3 // All rights reserved4 //5 // Distribute freely, except: don't remove my name from the source or6 // documentation (don't take credit for my work), mark your changes (don't7 // get me blamed for your possible bugs), don't alter or remove this8 // notice.9 // No warrantee of any kind, express or implied, is included with this10 // software; use at your own risk, responsibility for damages (if any) to11 // anyone resulting from the use of this software rests entirely with the12 // user.13 //14 // Send bug reports, bug fixes, enhancements, requests, flames, etc., and15 // I'll try to keep a version up to date. I can be reached as follows:16 // tmaurel@caramail.com (or tmaurel@hol.fr)17 //18 ////////////////////////////////////////////////////////////////////////////////19 // File : AcceleratorManager.h20 // Project : AccelsEditor21 ////////////////////////////////////////////////////////////////////////////////22 // Version : 1.0 * Author : T.Maurel23 // Date : 17.08.9824 //25 // Remarks : interface for the CAcceleratorManager class.26 //27 ////////////////////////////////////////////////////////////////////////////////28 #if !defined(AFX_ACCELERATORMANAGER_H__A6D76F4B_26C6_11D2_BE72_006097AC8D00__INCLUDED_)29 #define AFX_ACCELERATORMANAGER_H__A6D76F4B_26C6_11D2_BE72_006097AC8D00__INCLUDED_31 #if _MSC_VER >= 100032 #pragma once33 #endif // _MSC_VER >= 100035 #include "afxtempl.h"37 class CCmdAccelOb;39 // Helper map40 #ifndef CMapStringToWord41 typedef CMap< CString, LPCSTR, WORD, WORD & > CMapStringToWord;42 #endif44 #ifndef CMapWordToCCmdAccelOb45 typedef CMap< WORD, WORD &, CCmdAccelOb *, CCmdAccelOb * & > CMapWordToCCmdAccelOb;46 #endif48 ////////////////////////////////////////////////////////////////////////////////49 // All Registry stuff removed51 class CAcceleratorManager : public CObject52 {53 friend class AccelEditor;54 public:55 CAcceleratorManager();56 virtual ~CAcceleratorManager();58 // Operations59 public:60 void UpdateMenu(HMENU menu);61 // Connection to the main application wnd62 void Connect(CWnd *pWnd, bool bAutoSave = true);63 // In/Out64 bool Load();65 bool Write();66 // Get the initials accels, not the user's67 bool Default();68 // Save a copy in the 2 maps called xxxSaved, which are used in case69 // of Default(), to reload the defaults accels.70 bool CreateDefaultTable();71 bool IsDefaultTableAvailable() {return m_bDefaultTable;}72 bool IsMapStringCommandsEmpty()73 {74 if (m_mapAccelString.IsEmpty())75 return true;76 else77 return false;78 }80 bool IsAutoSave() {return m_bAutoSave;}81 void SetAutoSave(bool bAutoSave) {m_bAutoSave = bAutoSave;}83 // Helper fct, used for new menus strings84 bool GetStringFromACCEL(ACCEL*pACCEL, CString& szAccel);85 bool GetStringFromACCEL(BYTE cVirt, WORD nCode, CString& szAccel);87 // Update the ACCELS table in the application, from the specified88 // datas in the manager.89 bool UpdateWndTable();91 // Modification helper fcts92 bool SetAccel(BYTE cVirt, WORD wIDCommand, WORD wNewCaract,93 LPCTSTR szCommand, bool bLocked = false);94 bool AddCommandAccel(WORD wIDCommand, LPCTSTR szCommand, bool bLocked = true);95 bool CreateEntry(WORD wIDCommand, LPCTSTR szCommand);97 bool DeleteEntry(LPCTSTR szCommand);98 bool DeleteEntry(WORD wIDCommand);99 bool DeleteAccel(BYTE cVirt, WORD wIDCommand, WORD wNewCaract);101 // Affectation operator102 CAcceleratorManager & operator=(const CAcceleratorManager& accelmgr);103 public:104 #ifdef _DEBUG105 virtual void AssertValid() const;106 virtual void Dump(CDumpContext& dc) const;107 #endif108 protected:109 // Erase all the datas110 void Reset();111 // Internal affect fct.112 bool AddAccel(BYTE cVirt, WORD wIDCommand, WORD wKey,113 LPCTSTR szCommand, bool bLocked);115 // Attributes116 protected:117 CWnd *m_pWndConnected;119 // User datas120 /*TEMP HACK*/121 public:122 CMapStringToWord m_mapAccelString;123 /*TEMP HACK*/124 public:125 CMapWordToCCmdAccelOb m_mapAccelTable;126 protected:127 // Default datas128 CMapWordToCCmdAccelOb m_mapAccelTableSaved;129 bool m_bDefaultTable;131 // if true, there is an auto-save, when the destructor is called132 bool m_bAutoSave;133 };135 #endif // !defined(AFX_ACCELERATORMANAGER_H__A6D76F4B_26C6_11D2_BE72_006097AC8D00__INCLUDED_)