[UI] Let clickable link name boxes and name editors have hand cursors instead of I-beams.

This commit is contained in:
Router Gray
2019-10-24 20:38:33 -05:00
committed by Liru Færs
parent 2e52fe64b8
commit 7e8ebdb852
4 changed files with 26 additions and 0 deletions

View File

@@ -33,6 +33,7 @@
#include "llviewerprecompiledheaders.h"
#include "llnamebox.h"
#include "llwindow.h"
static LLRegisterWidget<LLNameBox> r("name_box");
@@ -66,6 +67,17 @@ BOOL LLNameBox::handleRightMouseDown(S32 x, S32 y, MASK mask)
return handled;
}
// virtual
BOOL LLNameBox::handleHover(S32 x, S32 y, MASK mask)
{
if (mAllowInteract)
{
getWindow()->setCursor(UI_CURSOR_HAND);
return true;
}
return LLTextBox::handleHover(x, y, mask);
}
// virtual
void LLNameBox::initFromXML(LLXMLNodePtr node, LLView* parent)
{

View File

@@ -50,6 +50,7 @@ public:
LLSD getValue() const override final { return LLNameUI::getValue(); }
BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override final;
BOOL handleHover(S32 x, S32 y, MASK mask) override final;
protected:
LLNameBox(const std::string& name);

View File

@@ -36,6 +36,7 @@
#include "llmenugl.h"
#include "lluictrlfactory.h"
#include "llwindow.h"
static LLRegisterWidget<LLNameEditor> r("name_editor");
@@ -90,6 +91,17 @@ BOOL LLNameEditor::handleRightMouseDown(S32 x, S32 y, MASK mask)
return LLLineEditor::handleRightMouseDown(x, y, mask);
}
// virtual
BOOL LLNameEditor::handleHover(S32 x, S32 y, MASK mask)
{
if (mAllowInteract)
{
getWindow()->setCursor(UI_CURSOR_HAND);
return true;
}
return LLLineEditor::handleHover(x, y, mask);
}
void LLNameEditor::displayAsLink(bool link)
{
static const LLUICachedControl<LLColor4> color("HTMLAgentColor");

View File

@@ -53,6 +53,7 @@ public:
BOOL handleMouseDown(S32 x, S32 y, MASK mask) override final;
BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override final;
BOOL handleHover(S32 x, S32 y, MASK mask) override final;
LLXMLNodePtr getXML(bool save_children = true) const override final;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);