view src/win32/AcceleratorManager.h @ 4:5f6f2134e8ce

apu appears to not be used
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:35:58 -0600
parents f9f4f1b99eed
children
line wrap: on
line source
1 ////////////////////////////////////////////////////////////////////////////////
2 // Copyright (C) 1998 by Thierry Maurel
3 // All rights reserved
4 //
5 // Distribute freely, except: don't remove my name from the source or
6 // documentation (don't take credit for my work), mark your changes (don't
7 // get me blamed for your possible bugs), don't alter or remove this
8 // notice.
9 // No warrantee of any kind, express or implied, is included with this
10 // software; use at your own risk, responsibility for damages (if any) to
11 // anyone resulting from the use of this software rests entirely with the
12 // user.
13 //
14 // Send bug reports, bug fixes, enhancements, requests, flames, etc., and
15 // 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.h
20 // Project : AccelsEditor
21 ////////////////////////////////////////////////////////////////////////////////
22 // Version : 1.0 * Author : T.Maurel
23 // Date : 17.08.98
24 //
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 >= 1000
32 #pragma once
33 #endif // _MSC_VER >= 1000
35 #include "afxtempl.h"
37 class CCmdAccelOb;
39 // Helper map
40 #ifndef CMapStringToWord
41 typedef CMap< CString, LPCSTR, WORD, WORD & > CMapStringToWord;
42 #endif
44 #ifndef CMapWordToCCmdAccelOb
45 typedef CMap< WORD, WORD &, CCmdAccelOb *, CCmdAccelOb * & > CMapWordToCCmdAccelOb;
46 #endif
48 ////////////////////////////////////////////////////////////////////////////////
49 // All Registry stuff removed
51 class CAcceleratorManager : public CObject
52 {
53 friend class AccelEditor;
54 public:
55 CAcceleratorManager();
56 virtual ~CAcceleratorManager();
58 // Operations
59 public:
60 void UpdateMenu(HMENU menu);
61 // Connection to the main application wnd
62 void Connect(CWnd *pWnd, bool bAutoSave = true);
63 // In/Out
64 bool Load();
65 bool Write();
66 // Get the initials accels, not the user's
67 bool Default();
68 // Save a copy in the 2 maps called xxxSaved, which are used in case
69 // 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 else
77 return false;
78 }
80 bool IsAutoSave() {return m_bAutoSave;}
81 void SetAutoSave(bool bAutoSave) {m_bAutoSave = bAutoSave;}
83 // Helper fct, used for new menus strings
84 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 specified
88 // datas in the manager.
89 bool UpdateWndTable();
91 // Modification helper fcts
92 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 operator
102 CAcceleratorManager & operator=(const CAcceleratorManager& accelmgr);
103 public:
104 #ifdef _DEBUG
105 virtual void AssertValid() const;
106 virtual void Dump(CDumpContext& dc) const;
107 #endif
108 protected:
109 // Erase all the datas
110 void Reset();
111 // Internal affect fct.
112 bool AddAccel(BYTE cVirt, WORD wIDCommand, WORD wKey,
113 LPCTSTR szCommand, bool bLocked);
115 // Attributes
116 protected:
117 CWnd *m_pWndConnected;
119 // User datas
120 /*TEMP HACK*/
121 public:
122 CMapStringToWord m_mapAccelString;
123 /*TEMP HACK*/
124 public:
125 CMapWordToCCmdAccelOb m_mapAccelTable;
126 protected:
127 // Default datas
128 CMapWordToCCmdAccelOb m_mapAccelTableSaved;
129 bool m_bDefaultTable;
131 // if true, there is an auto-save, when the destructor is called
132 bool m_bAutoSave;
133 };
135 #endif // !defined(AFX_ACCELERATORMANAGER_H__A6D76F4B_26C6_11D2_BE72_006097AC8D00__INCLUDED_)