Additional changes to custom mouse cursors

This commit is contained in:
Brian 2012-07-17 00:52:22 -04:00 committed by jsmorley
parent 215211741e
commit ff7814b11f
3 changed files with 11 additions and 12 deletions

View File

@ -3158,7 +3158,7 @@ void CMeterWindow::HandleButtons(POINT pos, BUTTONPROC proc, bool execute)
if (!cursor && if (!cursor &&
((*j)->HasMouseAction() || button) && ((*j)->HasMouseAction() || button) &&
(*j)->GetMouse().GetCursorType() != MOUSECURSOR_ARROW && (*j)->GetMouse().GetCursorState() &&
(*j)->HitTest(pos.x, pos.y)) (*j)->HitTest(pos.x, pos.y))
{ {
cursor = (*j)->GetMouse().GetCursor(); cursor = (*j)->GetMouse().GetCursor();

View File

@ -24,7 +24,8 @@
CMouse::CMouse() : CMouse::CMouse() :
m_CursorType(MOUSECURSOR_HAND), m_CursorType(MOUSECURSOR_HAND),
m_CustomCursor() m_CustomCursor(),
m_CursorState(true)
{ {
} }
@ -49,18 +50,14 @@ void CMouse::ReadOptions(CConfigParser& parser, const WCHAR* section, CMeterWind
m_OverAction = parser.ReadString(section, L"MouseOverAction", L"", false); m_OverAction = parser.ReadString(section, L"MouseOverAction", L"", false);
m_LeaveAction = parser.ReadString(section, L"MouseLeaveAction", L"", false); m_LeaveAction = parser.ReadString(section, L"MouseLeaveAction", L"", false);
const WCHAR* mouseCursor = parser.ReadString(section, L"MouseActionCursor", L"").c_str(); m_CursorState = 0!=parser.ReadInt(section, L"MouseActionCursor", meterWindow->GetMouse().GetCursorState());
// For backwards compatibility const WCHAR* mouseCursor = parser.ReadString(section, L"MouseActionCursorName", L"").c_str();
int mouseCursorInt = (*mouseCursor == L'(') ? CConfigParser::ParseInt(mouseCursor, 0) : -1; if (_wcsicmp(mouseCursor, L"HAND") == 0)
if (mouseCursorInt == 1 ||
_wcsicmp(mouseCursor, L"HAND") == 0)
{ {
m_CursorType = MOUSECURSOR_HAND; m_CursorType = MOUSECURSOR_HAND;
} }
else if (mouseCursorInt == 0 || else if (_wcsicmp(mouseCursor, L"ARROW") == 0)
_wcsicmp(mouseCursor, L"ARROW") == 0)
{ {
m_CursorType = MOUSECURSOR_ARROW; m_CursorType = MOUSECURSOR_ARROW;
} }
@ -91,10 +88,10 @@ void CMouse::ReadOptions(CConfigParser& parser, const WCHAR* section, CMeterWind
else else
{ {
// Inherit from [Rainmeter]. // Inherit from [Rainmeter].
m_CursorType = meterWindow->GetMouse().m_CursorType; m_CursorType = meterWindow->GetMouse().GetCursorType();
if (m_CursorType == MOUSECURSOR_CUSTOM) if (m_CursorType == MOUSECURSOR_CUSTOM)
{ {
mouseCursor = meterWindow->GetParser().ReadString(L"Rainmeter", L"MouseActionCursor", L"").c_str();; mouseCursor = meterWindow->GetParser().ReadString(L"Rainmeter", L"MouseActionCursorName", L"").c_str();
} }
} }

View File

@ -56,6 +56,7 @@ public:
MOUSECURSOR GetCursorType() const { return m_CursorType; } MOUSECURSOR GetCursorType() const { return m_CursorType; }
HCURSOR GetCursor() const; HCURSOR GetCursor() const;
bool GetCursorState() const {return m_CursorState; }
void DestroyCustomCursor(); void DestroyCustomCursor();
@ -88,6 +89,7 @@ private:
MOUSECURSOR m_CursorType; MOUSECURSOR m_CursorType;
HCURSOR m_CustomCursor; HCURSOR m_CustomCursor;
bool m_CursorState;
}; };
#endif #endif