soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SAccelerator.h
Go to the documentation of this file.
1/**
2 * Copyright (C) 2014-2050
3 * All rights reserved.
4 *
5 * @file SAccelerator.h
6 * @brief Accelerator management module
7 * @version v1.0
8 * @author SOUI group
9 * @date 2014/08/02
10 *
11 * @details SOUI accelerator management module
12 */
13
14#ifndef __SACCELERATOR__H__
15#define __SACCELERATOR__H__
16
17#include <interface/SAccelerator-i.h>
18
19SNSBEGIN
20
21/**
22 * @class SAccelerator
23 * @brief Accelerator key mapping
24 *
25 * @details This class manages accelerator keys, allowing for the creation and manipulation of
26 * accelerator key mappings within the SOUI framework.
27 */
28class SOUI_EXP SAccelerator : public IAccelerator {
29 public:
30 /**
31 * @brief Constructor
32 * @param dwAccel Accelerator key value
33 *
34 * @details Initializes the accelerator with a given accelerator key value.
35 */
36 SAccelerator(DWORD dwAccel);
37
38 /**
39 * @brief Constructor
40 * @param vKey Key value
41 * @param bCtrl TRUE if combined with Ctrl
42 * @param bAlt TRUE if combined with Alt
43 * @param bShift TRUE if combined with Shift
44 *
45 * @details Initializes the accelerator with a key value and modifier keys (Ctrl, Alt, Shift).
46 */
47 SAccelerator(WORD vKey = 0, bool bCtrl = false, bool bAlt = false, bool bShift = false);
48
49 /**
50 * @brief Destructor
51 *
52 * @details Cleans up the accelerator object.
53 */
54 ~SAccelerator(void);
55
56 /**
57 * @brief Gets the modifier keys
58 * @return Modifier keys as a WORD
59 *
60 * @details Returns the modifier keys (Ctrl, Alt, Shift) as a WORD.
61 */
62 STDMETHOD_(WORD, GetModifier)(THIS) SCONST OVERRIDE;
63
64 /**
65 * @brief Gets the key value
66 * @return Key value as a WORD
67 *
68 * @details Returns the key value associated with the accelerator.
69 */
70 STDMETHOD_(WORD, GetKey)(THIS) SCONST OVERRIDE;
71
72 /**
73 * @brief Gets the accelerator key value
74 * @return Accelerator key value as a DWORD
75 *
76 * @details Returns the complete accelerator key value, including modifiers and key.
77 */
78 STDMETHOD_(DWORD, GetAcc)(THIS) SCONST OVERRIDE;
79
80 /**
81 * @brief Formats the accelerator key as a string
82 * @return SStringT - Formatted string representation of the accelerator key
83 *
84 * @details Converts the accelerator key into a human-readable string format.
85 */
86 SStringT FormatHotkey();
87
88 /**
89 * @brief Converts a string to a virtual key code
90 * @param pszKey String representation of the key
91 * @return Virtual key code as a WORD
92 *
93 * @details Converts a string representation of a key (e.g., "Ctrl+C") to its corresponding virtual key code.
94 */
95 static WORD VkFromString(LPCTSTR pszKey);
96
97 /**
98 * @brief Converts a virtual key code to its string representation
99 * @param vk Virtual key code
100 * @return SStringT - String representation of the key
101 *
102 * @details Converts a virtual key code to its human-readable string format.
103 */
104 static SStringT GetKeyName(WORD vk);
105
106 /**
107 * @brief Formats an accelerator key as a string
108 * @param dwAccel Accelerator key value
109 * @return SStringT - Formatted string representation of the accelerator key
110 *
111 * @details Converts an accelerator key value into a human-readable string format.
112 */
113 static SStringT FormatAccelKey(DWORD dwAccel);
114
115 /**
116 * @brief Translates a string to an accelerator key value
117 * @param pszKeyName String representation of the accelerator key
118 * @return DWORD - Accelerator key value
119 *
120 * @details Converts a string representation of an accelerator key (e0.g., "Ctrl+C") to its corresponding accelerator key value.
121 */
122 static DWORD TranslateAccelKey(LPCTSTR pszKeyName);
123
124 protected:
125 WORD m_wModifier; /**< Modifier keys (Ctrl, Alt, Shift) as a WORD. */
126 WORD m_wVK; /**< Key value as a WORD. */
127};
128
129SNSEND
130#endif // __SACCELERATOR__H__
WORD GetModifier() SCONST OVERRIDE
Gets the modifier keys.
static SStringT FormatAccelKey(DWORD dwAccel)
Formats an accelerator key as a string.
SAccelerator(DWORD dwAccel)
Constructor.
static DWORD TranslateAccelKey(LPCTSTR pszKeyName)
Translates a string to an accelerator key value.
DWORD GetAcc() SCONST OVERRIDE
Gets the accelerator key value.
static WORD VkFromString(LPCTSTR pszKey)
Converts a string to a virtual key code.
static SStringT GetKeyName(WORD vk)
Converts a virtual key code to its string representation.
SStringT FormatHotkey()
Formats the accelerator key as a string.
WORD GetKey() SCONST OVERRIDE
Gets the key value.
Interface for an accelerator key.