Mercurial > vba-clojure
comparison src/win32/AcceleratorManager.h @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:8ced16adf2e1 | 1:f9f4f1b99eed |
---|---|
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_ | |
30 | |
31 #if _MSC_VER >= 1000 | |
32 #pragma once | |
33 #endif // _MSC_VER >= 1000 | |
34 | |
35 #include "afxtempl.h" | |
36 | |
37 class CCmdAccelOb; | |
38 | |
39 // Helper map | |
40 #ifndef CMapStringToWord | |
41 typedef CMap< CString, LPCSTR, WORD, WORD & > CMapStringToWord; | |
42 #endif | |
43 | |
44 #ifndef CMapWordToCCmdAccelOb | |
45 typedef CMap< WORD, WORD &, CCmdAccelOb *, CCmdAccelOb * & > CMapWordToCCmdAccelOb; | |
46 #endif | |
47 | |
48 //////////////////////////////////////////////////////////////////////////////// | |
49 // All Registry stuff removed | |
50 | |
51 class CAcceleratorManager : public CObject | |
52 { | |
53 friend class AccelEditor; | |
54 public: | |
55 CAcceleratorManager(); | |
56 virtual ~CAcceleratorManager(); | |
57 | |
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 } | |
79 | |
80 bool IsAutoSave() {return m_bAutoSave;} | |
81 void SetAutoSave(bool bAutoSave) {m_bAutoSave = bAutoSave;} | |
82 | |
83 // Helper fct, used for new menus strings | |
84 bool GetStringFromACCEL(ACCEL*pACCEL, CString& szAccel); | |
85 bool GetStringFromACCEL(BYTE cVirt, WORD nCode, CString& szAccel); | |
86 | |
87 // Update the ACCELS table in the application, from the specified | |
88 // datas in the manager. | |
89 bool UpdateWndTable(); | |
90 | |
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); | |
96 | |
97 bool DeleteEntry(LPCTSTR szCommand); | |
98 bool DeleteEntry(WORD wIDCommand); | |
99 bool DeleteAccel(BYTE cVirt, WORD wIDCommand, WORD wNewCaract); | |
100 | |
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); | |
114 | |
115 // Attributes | |
116 protected: | |
117 CWnd *m_pWndConnected; | |
118 | |
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; | |
130 | |
131 // if true, there is an auto-save, when the destructor is called | |
132 bool m_bAutoSave; | |
133 }; | |
134 | |
135 #endif // !defined(AFX_ACCELERATORMANAGER_H__A6D76F4B_26C6_11D2_BE72_006097AC8D00__INCLUDED_) |