summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/popups/popupmenu.cpp15
-rw-r--r--src/gui/popups/popupmenu.h6
-rw-r--r--src/gui/widgets/browserbox.cpp28
-rw-r--r--src/gui/widgets/browserbox.h6
4 files changed, 55 insertions, 0 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index f6a2959bd..eb2144de3 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -3035,3 +3035,18 @@ void PopupMenu::showGMPopup()
showPopup(getX(), getY());
}
+
+void PopupMenu::moveUp()
+{
+ mBrowserBox->moveSelectionUp();
+}
+
+void PopupMenu::moveDown()
+{
+ mBrowserBox->moveSelectionDown();
+}
+
+void PopupMenu::select()
+{
+ mBrowserBox->selectSelection();
+}
diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h
index c98e6a26e..da0f59847 100644
--- a/src/gui/popups/popupmenu.h
+++ b/src/gui/popups/popupmenu.h
@@ -148,6 +148,12 @@ class PopupMenu final : public Popup, public LinkHandler
void clear();
+ void moveUp();
+
+ void moveDown();
+
+ void select();
+
private:
void setMousePos();
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index f6f86a42d..f87bc23e3 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -914,3 +914,31 @@ void BrowserBox::setForegroundColorAll(const Color &color1,
mForegroundColor = color1;
mForegroundColor2 = color2;
}
+
+void BrowserBox::moveSelectionUp()
+{
+ if (mSelectedLink <= 0)
+ mSelectedLink = static_cast<signed>(mLinks.size()) - 1;
+ else
+ mSelectedLink --;
+}
+
+#include "logger.h"
+
+void BrowserBox::moveSelectionDown()
+{
+ mSelectedLink ++;
+ if (mSelectedLink >= static_cast<signed int>(mLinks.size()))
+ mSelectedLink = 0;
+}
+
+void BrowserBox::selectSelection()
+{
+ if (mSelectedLink < 0 || mSelectedLink >= static_cast<signed int>(
+ mLinks.size()))
+ {
+ return;
+ }
+
+ mLinkHandler->handleLink(mLinks[mSelectedLink].link, nullptr);
+}
diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h
index 85bb758f9..4fdb45189 100644
--- a/src/gui/widgets/browserbox.h
+++ b/src/gui/widgets/browserbox.h
@@ -196,6 +196,12 @@ class BrowserBox final : public Widget,
int getDataWidth() const
{ return mDataWidth; }
+ void moveSelectionUp();
+
+ void moveSelectionDown();
+
+ void selectSelection();
+
private:
int calcHeight() A_WARN_UNUSED;