summaryrefslogtreecommitdiff
path: root/src/gui/widgets/browserbox.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-11 21:10:53 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-11 21:10:53 +0100
commit66599a9896e0cf69b58c0a73152aba4750d87af2 (patch)
tree034b6b4a05ea1b4fc87887f48734f630e757e6f7 /src/gui/widgets/browserbox.cpp
parent0694d89c4147882561ff44c6d0d80e7414dcb24a (diff)
downloadmana-66599a9896e0cf69b58c0a73152aba4750d87af2.tar.gz
mana-66599a9896e0cf69b58c0a73152aba4750d87af2.tar.bz2
mana-66599a9896e0cf69b58c0a73152aba4750d87af2.tar.xz
mana-66599a9896e0cf69b58c0a73152aba4750d87af2.zip
Implemented ability to open external links in news and chat
* Use ConfirmDialog to confirm the opening of the external link. * ConfirmDialog now centers on its parent window when provided. * Reset hovered link when mouse exits the BrowserBox.
Diffstat (limited to 'src/gui/widgets/browserbox.cpp')
-rw-r--r--src/gui/widgets/browserbox.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index d12562f1..8814a995 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -70,9 +70,7 @@ BrowserBox::BrowserBox(unsigned int mode):
addMouseListener(this);
}
-BrowserBox::~BrowserBox()
-{
-}
+BrowserBox::~BrowserBox() = default;
void BrowserBox::addRow(const std::string &row)
{
@@ -177,6 +175,11 @@ void BrowserBox::mouseMoved(gcn::MouseEvent &event)
updateHoveredLink(event.getX(), event.getY());
}
+void BrowserBox::mouseExited(gcn::MouseEvent &event)
+{
+ mHoveredLink.reset();
+}
+
void BrowserBox::draw(gcn::Graphics *graphics)
{
const gcn::ClipRectangle &cr = graphics->getCurrentClipArea();
@@ -285,7 +288,7 @@ void BrowserBox::layoutTextRow(TextRow &row, LayoutContext &context)
int x = 0;
// Check for separator lines
- if (row.text.find("---", 0) == 0)
+ if (startsWith(row.text, "---"))
{
for (x = 0; x < getWidth(); x += context.minusWidth - 1)
{