ReactOS 0.4.16-dev-2498-g8632030
CLangBarItemList Class Reference
Inheritance diagram for CLangBarItemList:
Collaboration diagram for CLangBarItemList:

Public Member Functions

BOOL IsStartedIntentionally (REFCLSID rclsid)
 
LANGBARITEMSTATEAddItem (REFCLSID rclsid)
 
void Clear ()
 
BOOL SetDemoteLevel (REFCLSID rclsid, DWORD dwDemoteLevel)
 
LANGBARITEMSTATEFindItem (REFCLSID rclsid)
 
LANGBARITEMSTATEGetItemStateFromTimerId (UINT_PTR nTimerID)
 
void Load ()
 
void SaveItem (CicRegKey *pRegKey, const LANGBARITEMSTATE *pState)
 
void StartDemotingTimer (REFCLSID rclsid, BOOL bIntentional)
 
UINT_PTR FindDemotingTimerId ()
 
- Public Member Functions inherited from CicArray< LANGBARITEMSTATE >
 CicArray ()
 
LANGBARITEMSTATEdata () const
 
size_t size () const
 
bool empty () const
 
void clear ()
 
LANGBARITEMSTATEoperator[] (size_t iItem)
 
const LANGBARITEMSTATEoperator[] (size_t iItem) const
 
LANGBARITEMSTATEAppend (size_t cGrow)
 
BOOL Add (const LANGBARITEMSTATE &item)
 
ptrdiff_t Find (const LANGBARITEMSTATE &item) const
 
BOOL Insert (size_t iItem, size_t cGrow)
 
void Remove (size_t iItem, size_t cRemove=1)
 

Additional Inherited Members

- Protected Member Functions inherited from CicArrayBase
 CicArrayBase (size_t cbItem)
 
virtual ~CicArrayBase ()
 
BOOL Insert (size_t iItem, size_t cGrow)
 
LPVOID Append (size_t cGrow)
 
void Remove (size_t iItem, size_t cRemove=1)
 
- Protected Attributes inherited from CicArrayBase
LPBYTE m_pb
 
size_t m_cItems
 
size_t m_cbItem
 
size_t m_cCapacity
 

Detailed Description

Definition at line 1075 of file msutb.cpp.

Member Function Documentation

◆ AddItem()

LANGBARITEMSTATE * CLangBarItemList::AddItem ( REFCLSID  rclsid)

Definition at line 3927 of file msutb.cpp.

3928{
3929 auto *pItem = FindItem(rclsid);
3930 if (pItem)
3931 return pItem;
3932
3933 pItem = Append(1);
3934 if (!pItem)
3935 return NULL;
3936
3937 ZeroMemory(pItem, sizeof(*pItem));
3938 pItem->m_clsid = rclsid;
3939 pItem->m_dwDemoteLevel = 0;
3940 return pItem;
3941}
LANGBARITEMSTATE * FindItem(REFCLSID rclsid)
Definition: msutb.cpp:3977
LANGBARITEMSTATE * Append(size_t cGrow)
Definition: cicarray.h:52
#define NULL
Definition: types.h:112
#define ZeroMemory
Definition: minwinbase.h:31

◆ Clear()

void CLangBarItemList::Clear ( )

Definition at line 3943 of file msutb.cpp.

3944{
3945 clear();
3946
3947 CicRegKey regKey;
3948 LSTATUS error;
3949 error = regKey.Open(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\CTF\\LangBar", KEY_ALL_ACCESS);
3950 if (error == ERROR_SUCCESS)
3951 regKey.RecurseDeleteKey(L"ItemState");
3952}
LSTATUS Open(HKEY hKey, LPCTSTR lpSubKey, REGSAM samDesired=KEY_READ)
Definition: cicreg.h:51
LSTATUS RecurseDeleteKey(LPCTSTR lpSubKey)
Definition: cicreg.h:113
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define L(x)
Definition: resources.c:13
#define error(str)
Definition: mkdosfs.c:1605
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by CTipbarWnd::ClearLBItemList().

◆ FindDemotingTimerId()

UINT_PTR CLangBarItemList::FindDemotingTimerId ( )

Definition at line 4114 of file msutb.cpp.

4115{
4116 UINT_PTR nTimerID = 10000;
4117
4118 if (empty())
4119 return nTimerID;
4120
4121 for (;;)
4122 {
4123 size_t iItem = 0;
4124
4125 while ((*this)[iItem].m_nTimerID != nTimerID)
4126 {
4127 ++iItem;
4128 if (iItem >= size())
4129 return nTimerID;
4130 }
4131
4132 ++nTimerID;
4133 if (nTimerID >= 10050)
4134 return 0;
4135 }
4136}
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274

Referenced by StartDemotingTimer().

◆ FindItem()

LANGBARITEMSTATE * CLangBarItemList::FindItem ( REFCLSID  rclsid)

Definition at line 3977 of file msutb.cpp.

3978{
3979 for (size_t iItem = 0; iItem < size(); ++iItem)
3980 {
3981 auto& item = (*this)[iItem];
3982 if (IsEqualCLSID(item.m_clsid, rclsid))
3983 return &item;
3984 }
3985 return NULL;
3986}
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96

Referenced by AddItem(), and IsStartedIntentionally().

◆ GetItemStateFromTimerId()

LANGBARITEMSTATE * CLangBarItemList::GetItemStateFromTimerId ( UINT_PTR  nTimerID)

Definition at line 3988 of file msutb.cpp.

3989{
3990 for (size_t iItem = 0; iItem < size(); ++iItem)
3991 {
3992 auto& item = (*this)[iItem];
3993 if (item.m_nTimerID == nTimerID)
3994 return &item;
3995 }
3996 return NULL;
3997}

◆ IsStartedIntentionally()

BOOL CLangBarItemList::IsStartedIntentionally ( REFCLSID  rclsid)

Definition at line 3919 of file msutb.cpp.

3920{
3921 auto *pItem = FindItem(rclsid);
3922 if (!pItem)
3923 return FALSE;
3924 return pItem->m_bStartedIntentionally;
3925}
#define FALSE
Definition: types.h:117

◆ Load()

void CLangBarItemList::Load ( )

Definition at line 3999 of file msutb.cpp.

4000{
4001 CicRegKey regKey;
4002 LSTATUS error;
4003 error = regKey.Open(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\CTF\\LangBar\\ItemState");
4004 if (error != ERROR_SUCCESS)
4005 return;
4006
4007 WCHAR szKeyName[MAX_PATH];
4008 for (DWORD dwIndex = 0; ; ++dwIndex)
4009 {
4010 error = ::RegEnumKeyW(regKey, dwIndex, szKeyName, _countof(szKeyName));
4011 if (error != ERROR_SUCCESS)
4012 break;
4013
4014 CLSID clsid;
4015 if (::CLSIDFromString(szKeyName, &clsid) != S_OK)
4016 continue;
4017
4018 CicRegKey regKey2;
4019 error = regKey2.Open(regKey, szKeyName);
4020 if (error != ERROR_SUCCESS)
4021 continue;
4022
4023 auto *pItem = AddItem(clsid);
4024 if (!pItem)
4025 continue;
4026
4027 DWORD Data = 0;
4028 regKey2.QueryDword(L"DemoteLevel", &Data);
4029 pItem->m_dwDemoteLevel = Data;
4030 regKey2.QueryDword(L"DisableDemoting", &Data);
4031 pItem->m_bDisableDemoting = !!Data;
4032 }
4033}
LSTATUS QueryDword(LPCTSTR pszValueName, LPDWORD pdwValue)
Definition: cicreg.h:61
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2393
HRESULT WINAPI CLSIDFromString(LPCOLESTR str, LPCLSID clsid)
Definition: combase.c:1470
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:52
const CLSID * clsid
Definition: msctf.cpp:50
#define _countof(array)
Definition: sndvol32.h:70
#define AddItem
Definition: userenv.h:209
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ SaveItem()

void CLangBarItemList::SaveItem ( CicRegKey pRegKey,
const LANGBARITEMSTATE pState 
)

Definition at line 4035 of file msutb.cpp.

4036{
4037 LSTATUS error;
4038 CicRegKey regKey;
4039
4040 if (!pRegKey)
4041 {
4042 error = regKey.Create(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\CTF\\LangBar\\ItemState");
4043 if (error != ERROR_SUCCESS)
4044 return;
4045
4046 pRegKey = &regKey;
4047 }
4048
4049 WCHAR szSubKey[MAX_PATH];
4050 ::StringFromGUID2(pState->m_clsid, szSubKey, _countof(szSubKey));
4051
4052 if (pState->m_dwDemoteLevel || pState->m_bDisableDemoting)
4053 {
4054 CicRegKey regKey2;
4055 error = regKey2.Create(*pRegKey, szSubKey);
4056 if (error == ERROR_SUCCESS)
4057 {
4058 DWORD dwDemoteLevel = pState->m_dwDemoteLevel;
4059 if (dwDemoteLevel)
4060 regKey2.SetDword(L"DemoteLevel", dwDemoteLevel);
4061 else
4062 regKey2.DeleteValue(L"DemoteLevel");
4063
4064 regKey2.SetDword(L"DisableDemoting", pState->m_bDisableDemoting);
4065 }
4066 }
4067 else
4068 {
4069 pRegKey->RecurseDeleteKey(szSubKey);
4070 }
4071}
LSTATUS DeleteValue(LPCTSTR pszValueName)
Definition: cicreg.h:98
LSTATUS SetDword(LPCTSTR pszValueName, DWORD dwValue)
Definition: cicreg.h:67
LSTATUS Create(HKEY hKey, LPCTSTR lpSubKey)
Definition: cicreg.h:56
INT WINAPI StringFromGUID2(REFGUID guid, LPOLESTR str, INT cmax)
Definition: combase.c:1525
DWORD m_dwDemoteLevel
Definition: msutb.cpp:17
BOOL m_bDisableDemoting
Definition: msutb.cpp:21
CLSID m_clsid
Definition: msutb.cpp:16

Referenced by SetDemoteLevel().

◆ SetDemoteLevel()

BOOL CLangBarItemList::SetDemoteLevel ( REFCLSID  rclsid,
DWORD  dwDemoteLevel 
)

Definition at line 3954 of file msutb.cpp.

3955{
3956 auto *pItem = AddItem(rclsid);
3957 if (!pItem)
3958 return TRUE;
3959
3960 pItem->m_dwDemoteLevel = dwDemoteLevel;
3961 if (!pItem->IsShown())
3962 {
3963 if (pItem->m_nTimerID)
3964 {
3965 if (g_pTipbarWnd)
3966 g_pTipbarWnd->KillTimer(pItem->m_nTimerID);
3967 pItem->m_nTimerID = 0;
3968 pItem->m_uTimeOut = 0;
3969 }
3970 pItem->m_bDisableDemoting = FALSE;
3971 }
3972
3973 SaveItem(0, pItem);
3974 return TRUE;
3975}
void SaveItem(CicRegKey *pRegKey, const LANGBARITEMSTATE *pState)
Definition: msutb.cpp:4035
BOOL KillTimer(UINT_PTR uIDEvent)
Definition: msutb.cpp:4710
#define TRUE
Definition: types.h:120
CTipbarWnd * g_pTipbarWnd
Definition: msutb.cpp:99

◆ StartDemotingTimer()

void CLangBarItemList::StartDemotingTimer ( REFCLSID  rclsid,
BOOL  bIntentional 
)

Definition at line 4073 of file msutb.cpp.

4074{
4075 if (!g_bIntelliSense)
4076 return;
4077
4078 auto *pItem = AddItem(rclsid);
4079 if (!pItem || pItem->m_bDisableDemoting)
4080 return;
4081
4082 if (pItem->m_nTimerID)
4083 {
4084 if (!bIntentional)
4085 return;
4086
4087 if (g_pTipbarWnd)
4088 g_pTipbarWnd->KillTimer(pItem->m_nTimerID);
4089
4090 pItem->m_nTimerID = 0;
4091 }
4092
4093 pItem->m_bStartedIntentionally |= bIntentional;
4094
4095 UINT uTimeOut = (bIntentional ? g_uTimeOutIntentional : g_uTimeOutNonIntentional);
4096 pItem->m_uTimeOut += uTimeOut;
4097
4098 if (pItem->m_uTimeOut < g_uTimeOutMax)
4099 {
4100 UINT_PTR uDemotingTimerId = FindDemotingTimerId();
4101 pItem->m_nTimerID = uDemotingTimerId;
4102 if (uDemotingTimerId)
4103 {
4104 if (g_pTipbarWnd)
4105 g_pTipbarWnd->SetTimer(uDemotingTimerId, uTimeOut);
4106 }
4107 }
4108 else
4109 {
4110 pItem->m_bDisableDemoting = TRUE;
4111 }
4112}
UINT_PTR FindDemotingTimerId()
Definition: msutb.cpp:4114
UINT_PTR SetTimer(UINT_PTR nIDEvent, UINT uElapse)
Definition: msutb.cpp:4703
UINT g_uTimeOutIntentional
Definition: msutb.cpp:51
BOOL g_bIntelliSense
Definition: msutb.cpp:48
UINT g_uTimeOutNonIntentional
Definition: msutb.cpp:50
UINT g_uTimeOutMax
Definition: msutb.cpp:52
unsigned int UINT
Definition: ndis.h:50

The documentation for this class was generated from the following file: