ReactOS 0.4.16-dev-456-ga97fcf1
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 3926 of file msutb.cpp.

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

◆ Clear()

void CLangBarItemList::Clear ( )

Definition at line 3942 of file msutb.cpp.

3943{
3944 clear();
3945
3946 CicRegKey regKey;
3947 LSTATUS error;
3948 error = regKey.Open(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\CTF\\LangBar", KEY_ALL_ACCESS);
3949 if (error == ERROR_SUCCESS)
3950 regKey.RecurseDeleteKey(L"ItemState");
3951}
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 error(str)
Definition: mkdosfs.c:1605
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define L(x)
Definition: ntvdm.h:50
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by CTipbarWnd::ClearLBItemList().

◆ FindDemotingTimerId()

UINT_PTR CLangBarItemList::FindDemotingTimerId ( )

Definition at line 4113 of file msutb.cpp.

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

Referenced by StartDemotingTimer().

◆ FindItem()

LANGBARITEMSTATE * CLangBarItemList::FindItem ( REFCLSID  rclsid)

Definition at line 3976 of file msutb.cpp.

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

Referenced by AddItem(), and IsStartedIntentionally().

◆ GetItemStateFromTimerId()

LANGBARITEMSTATE * CLangBarItemList::GetItemStateFromTimerId ( UINT_PTR  nTimerID)

Definition at line 3987 of file msutb.cpp.

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

◆ IsStartedIntentionally()

BOOL CLangBarItemList::IsStartedIntentionally ( REFCLSID  rclsid)

Definition at line 3918 of file msutb.cpp.

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

◆ Load()

void CLangBarItemList::Load ( )

Definition at line 3998 of file msutb.cpp.

3999{
4000 CicRegKey regKey;
4001 LSTATUS error;
4002 error = regKey.Open(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\CTF\\LangBar\\ItemState");
4003 if (error != ERROR_SUCCESS)
4004 return;
4005
4006 WCHAR szKeyName[MAX_PATH];
4007 for (DWORD dwIndex = 0; ; ++dwIndex)
4008 {
4009 error = ::RegEnumKeyW(regKey, dwIndex, szKeyName, _countof(szKeyName));
4010 if (error != ERROR_SUCCESS)
4011 break;
4012
4013 CLSID clsid;
4014 if (::CLSIDFromString(szKeyName, &clsid) != S_OK)
4015 continue;
4016
4017 CicRegKey regKey2;
4018 error = regKey2.Open(regKey, szKeyName);
4019 if (error != ERROR_SUCCESS)
4020 continue;
4021
4022 auto *pItem = AddItem(clsid);
4023 if (!pItem)
4024 continue;
4025
4026 DWORD Data = 0;
4027 regKey2.QueryDword(L"DemoteLevel", &Data);
4028 pItem->m_dwDemoteLevel = Data;
4029 regKey2.QueryDword(L"DisableDemoting", &Data);
4030 pItem->m_bDisableDemoting = !!Data;
4031 }
4032}
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
#define MAX_PATH
Definition: compat.h:34
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:52
REFCLSID clsid
Definition: msctf.c:82
#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 4034 of file msutb.cpp.

4035{
4036 LSTATUS error;
4037 CicRegKey regKey;
4038
4039 if (!pRegKey)
4040 {
4041 error = regKey.Create(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\CTF\\LangBar\\ItemState");
4042 if (error != ERROR_SUCCESS)
4043 return;
4044
4045 pRegKey = &regKey;
4046 }
4047
4048 WCHAR szSubKey[MAX_PATH];
4049 ::StringFromGUID2(pState->m_clsid, szSubKey, _countof(szSubKey));
4050
4051 if (pState->m_dwDemoteLevel || pState->m_bDisableDemoting)
4052 {
4053 CicRegKey regKey2;
4054 error = regKey2.Create(*pRegKey, szSubKey);
4055 if (error == ERROR_SUCCESS)
4056 {
4057 DWORD dwDemoteLevel = pState->m_dwDemoteLevel;
4058 if (dwDemoteLevel)
4059 regKey2.SetDword(L"DemoteLevel", dwDemoteLevel);
4060 else
4061 regKey2.DeleteValue(L"DemoteLevel");
4062
4063 regKey2.SetDword(L"DisableDemoting", pState->m_bDisableDemoting);
4064 }
4065 }
4066 else
4067 {
4068 pRegKey->RecurseDeleteKey(szSubKey);
4069 }
4070}
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 id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
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 3953 of file msutb.cpp.

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

◆ StartDemotingTimer()

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

Definition at line 4072 of file msutb.cpp.

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