summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2023-03-14 13:11:46 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2023-03-22 08:44:34 +0000
commit464a3549ae228bcd70bae8ea519fc781c2cc9e45 (patch)
tree44aa9726df58627a877ff28dbc55914616a41187
parenta1b935ca1bb6d48241e73e7206a367fe2b51f948 (diff)
jsdialog: double click for drawing area
Change-Id: I280158b101f39d107090a2eebb2c06e64591cb94 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148852 Tested-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149231 Tested-by: Jenkins
-rw-r--r--include/vcl/jsdialog/executor.hxx5
-rw-r--r--include/vcl/weld.hxx4
-rw-r--r--vcl/inc/salvtables.hxx2
-rw-r--r--vcl/jsdialog/executor.cxx7
-rw-r--r--vcl/source/app/salvtables.cxx7
5 files changed, 22 insertions, 3 deletions
diff --git a/include/vcl/jsdialog/executor.hxx b/include/vcl/jsdialog/executor.hxx
index 50f71272bb61..0c47066da9fa 100644
--- a/include/vcl/jsdialog/executor.hxx
+++ b/include/vcl/jsdialog/executor.hxx
@@ -61,6 +61,11 @@ public:
rDrawingArea.click(rPos);
}
+ static void trigger_dblclick(weld::DrawingArea& rDrawingArea, const Point& rPos)
+ {
+ rDrawingArea.dblclick(rPos);
+ }
+
static void trigger_value_changed(weld::SpinButton& rSpinButton)
{
rSpinButton.signal_value_changed();
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index d22fa5eb616e..21d6fec1acc2 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2356,7 +2356,9 @@ public:
private:
friend class ::LOKTrigger;
- virtual void click(const Point& rPos) = 0;
+ virtual void click(const Point&) = 0;
+
+ virtual void dblclick(const Point&){};
};
enum class Placement
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 3c421fc89c90..c5665b28dd0c 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -1339,6 +1339,8 @@ public:
virtual OutputDevice& get_ref_device() override;
virtual void click(const Point& rPos) override;
+
+ virtual void dblclick(const Point& rPos) override;
};
class SalInstanceToolbar : public SalInstanceWidget, public virtual weld::Toolbar
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index f52bef4b9aa7..4668193cb579 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -187,7 +187,7 @@ bool ExecuteAction(const std::string& nWindowId, const OString& rWidget, StringM
auto pArea = dynamic_cast<weld::DrawingArea*>(pWidget);
if (pArea)
{
- if (sAction == "click")
+ if (sAction == "click" || sAction == "dblclick")
{
OUString sClickData = rData["data"];
int nSeparatorPos = sClickData.indexOf(';');
@@ -209,7 +209,10 @@ bool ExecuteAction(const std::string& nWindowId, const OString& rWidget, StringM
Size size = rRefDevice.GetOutputSize();
posX = posX * size.Width();
posY = posY * size.Height();
- LOKTrigger::trigger_click(*pArea, Point(posX, posY));
+ if (sAction == "click")
+ LOKTrigger::trigger_click(*pArea, Point(posX, posY));
+ else
+ LOKTrigger::trigger_dblclick(*pArea, Point(posX, posY));
return true;
}
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 4a31b3d2cd3d..e4e76768ec55 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -6350,6 +6350,13 @@ void SalInstanceDrawingArea::click(const Point& rPos)
m_xDrawingArea->MouseButtonUp(aEvent);
}
+void SalInstanceDrawingArea::dblclick(const Point& rPos)
+{
+ MouseEvent aEvent(rPos, 2, MouseEventModifiers::NONE, MOUSE_LEFT, 0);
+ m_xDrawingArea->MouseButtonDown(aEvent);
+ m_xDrawingArea->MouseButtonUp(aEvent);
+}
+
IMPL_LINK(SalInstanceDrawingArea, PaintHdl, target_and_area, aPayload, void)
{
m_aDrawHdl.Call(aPayload);