summaryrefslogtreecommitdiff
path: root/dbaccess/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-08-26 14:03:44 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-08-26 21:56:47 +0200
commit3def184dc176ff7f8f794e510ce4c6e98352140d (patch)
tree77fc6bac025e891c8fe107fdb47b37ae06c4643a /dbaccess/source
parentf1e6919a5072b3f4bc67dbf5d8fcde524b74ecf8 (diff)
add focus rect to icon control
Change-Id: I080dfb40db20626f99f93beab1baf2102d6695ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101412 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess/source')
-rw-r--r--dbaccess/source/ui/app/AppIconControl.cxx34
-rw-r--r--dbaccess/source/ui/app/AppIconControl.hxx3
2 files changed, 37 insertions, 0 deletions
diff --git a/dbaccess/source/ui/app/AppIconControl.cxx b/dbaccess/source/ui/app/AppIconControl.cxx
index 84edc6a27f15..ba9c4a0e6ef5 100644
--- a/dbaccess/source/ui/app/AppIconControl.cxx
+++ b/dbaccess/source/ui/app/AppIconControl.cxx
@@ -201,6 +201,40 @@ OApplicationIconControl::~OApplicationIconControl()
{
}
+void OApplicationIconControl::GetFocus()
+{
+ SfxThumbnailView::GetFocus();
+ Invalidate(); // redraw focus rect
+}
+
+void OApplicationIconControl::LoseFocus()
+{
+ SfxThumbnailView::LoseFocus();
+ Invalidate(); // redraw focus rect
+}
+
+tools::Rectangle OApplicationIconControl::GetFocusRect()
+{
+ if (HasFocus())
+ {
+ // Get the last selected item in the list
+ for (long i = mFilteredItemList.size() - 1; i >= 0; --i)
+ {
+ ThumbnailViewItem* pItem = mFilteredItemList[i];
+ if (pItem->isSelected())
+ {
+ tools::Rectangle aRet(pItem->getDrawArea());
+ aRet.AdjustLeft(THUMBNAILVIEW_ITEM_CORNER);
+ aRet.AdjustTop(1);
+ aRet.AdjustRight(-THUMBNAILVIEW_ITEM_CORNER);
+ aRet.AdjustBottom(-2);
+ return aRet;
+ }
+ }
+ }
+ return tools::Rectangle();
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppIconControl.hxx b/dbaccess/source/ui/app/AppIconControl.hxx
index 7b29018c377b..e3b20b5ab8a9 100644
--- a/dbaccess/source/ui/app/AppIconControl.hxx
+++ b/dbaccess/source/ui/app/AppIconControl.hxx
@@ -48,6 +48,9 @@ namespace dbaui
explicit OApplicationIconControl(std::unique_ptr<weld::ScrolledWindow> xScroll);
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
virtual void Resize() override;
+ virtual tools::Rectangle GetFocusRect() override;
+ virtual void GetFocus() override;
+ virtual void LoseFocus() override;
bool DoKeyShortCut(const KeyEvent& rKEvt);
virtual bool KeyInput(const KeyEvent& rKEvt) override;
virtual ~OApplicationIconControl() override;