From 72a93582b0b68fdecee4a96bb985782e4826382a Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Sun, 24 Oct 2010 20:11:40 +0000 Subject: [PATCH] Add virtual bool Inset::clickable(..) to be used to change the cursor. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35804 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/Inset.h | 2 ++ src/insets/InsetCollapsable.cpp | 7 +++++++ src/insets/InsetCollapsable.h | 2 ++ src/insets/InsetCommand.h | 2 ++ src/insets/InsetExternal.h | 3 ++- src/insets/InsetGraphics.h | 2 ++ src/insets/InsetSpace.h | 2 ++ src/insets/InsetVSpace.h | 2 ++ 8 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/insets/Inset.h b/src/insets/Inset.h index baf58bf773..d4a15940a3 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -335,6 +335,8 @@ public: /// FIXME: merge with editable() // true for InsetTabular & InsetText virtual bool isActive() const { return nargs() > 0; } + /// can we click at the specified position ? + virtual bool clickable(int x, int y) const { return false; } /// does this contain text that can be change track marked in DVI? virtual bool canTrackChanges() const { return false; } diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index 48ae8a8df0..b57b74b341 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -411,6 +411,13 @@ bool InsetCollapsable::hitButton(FuncRequest const & cmd) const } +bool InsetCollapsable::clickable(int x, int y) const +{ + FuncRequest cmd(LFUN_NOACTION, x, y, mouse_button::none); + return hitButton(cmd); +} + + docstring const InsetCollapsable::getNewLabel(docstring const & l) const { docstring label; diff --git a/src/insets/InsetCollapsable.h b/src/insets/InsetCollapsable.h index 5a317bdba7..e712fba0b3 100644 --- a/src/insets/InsetCollapsable.h +++ b/src/insets/InsetCollapsable.h @@ -68,6 +68,8 @@ public: bool editable() const; /// bool hasSettings() const { return true; } + /// + bool clickable(int x, int y) const; /// can we go further down on mouse click? bool descendable(BufferView const & bv) const; /// diff --git a/src/insets/InsetCommand.h b/src/insets/InsetCommand.h index 990ac2abd2..8e6ab7afae 100644 --- a/src/insets/InsetCommand.h +++ b/src/insets/InsetCommand.h @@ -99,6 +99,8 @@ private: /// InsetCode lyxCode() const { return NO_CODE; } /// + bool clickable(int x, int y) const { return hasSettings(); } + /// RenderButton & button() const { return button_; } /// bool setMouseHover(BufferView const * bv, bool mouse_hover) const; diff --git a/src/insets/InsetExternal.h b/src/insets/InsetExternal.h index d5a2bc8feb..26890c217b 100644 --- a/src/insets/InsetExternal.h +++ b/src/insets/InsetExternal.h @@ -115,7 +115,8 @@ public: docstring contextMenu(BufferView const & bv, int x, int y) const; /// bool setMouseHover(BufferView const * bv, bool mouse_hover); - + /// + bool clickable(int x, int y) const { return true; } private: /// InsetExternal(InsetExternal const &); diff --git a/src/insets/InsetGraphics.h b/src/insets/InsetGraphics.h index b65f53c995..ce02d14eb9 100644 --- a/src/insets/InsetGraphics.h +++ b/src/insets/InsetGraphics.h @@ -51,6 +51,8 @@ public: bool setParams(InsetGraphicsParams const & params); InsetGraphicsParams getParams() const { return params_;} + /// + bool clickable(int x, int y) const { return true; } private: /// diff --git a/src/insets/InsetSpace.h b/src/insets/InsetSpace.h index d2d5d421df..4519d90e56 100644 --- a/src/insets/InsetSpace.h +++ b/src/insets/InsetSpace.h @@ -147,6 +147,8 @@ public: bool isSpace() const { return true; } /// docstring contextMenu(BufferView const & bv, int x, int y) const; + /// + bool clickable(int x, int y) const { return true; } protected: /// Inset * clone() const { return new InsetSpace(*this); } diff --git a/src/insets/InsetVSpace.h b/src/insets/InsetVSpace.h index 2cac05ed71..a4d6a9d378 100644 --- a/src/insets/InsetVSpace.h +++ b/src/insets/InsetVSpace.h @@ -37,6 +37,8 @@ public: static void string2params(std::string const &, VSpace &); /// static std::string params2string(VSpace const &); + /// + bool clickable(int x, int y) const { return true; } private: /// void metrics(MetricsInfo & mi, Dimension & dim) const; -- 2.39.2