summaryrefslogtreecommitdiff
path: root/include/vcl/weldutils.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'include/vcl/weldutils.hxx')
-rw-r--r--include/vcl/weldutils.hxx44
1 files changed, 44 insertions, 0 deletions
diff --git a/include/vcl/weldutils.hxx b/include/vcl/weldutils.hxx
index cc2a49d4d881..75da11f586bd 100644
--- a/include/vcl/weldutils.hxx
+++ b/include/vcl/weldutils.hxx
@@ -312,6 +312,50 @@ private:
mutable std::unique_ptr<CalendarWrapper> m_xCalendarWrapper;
};
+class VCL_DLLPUBLIC PatternFormatter final
+{
+public:
+ PatternFormatter(weld::Entry& rEntry);
+ ~PatternFormatter();
+
+ weld::Entry& get_widget() { return m_rEntry; }
+
+ void SetMask(const OString& rEditMask, const OUString& rLiteralMask);
+ void SetStrictFormat(bool bStrict);
+ void ReformatAll();
+
+ /* PatternFormatter will set listeners to "changed", "focus-out", "focus-in"
+ and "key-press" of the Entry so users that want to add their own listeners
+ to those must set them through this formatter and not directly on that entry.
+ */
+ void connect_changed(const Link<weld::Entry&, void>& rLink) { m_aModifyHdl = rLink; }
+ void connect_focus_out(const Link<weld::Widget&, void>& rLink) { m_aFocusOutHdl = rLink; }
+ void connect_focus_in(const Link<weld::Widget&, void>& rLink) { m_aFocusInHdl = rLink; }
+ void connect_key_press(const Link<const KeyEvent&, bool>& rLink) { m_aKeyPressHdl = rLink; }
+
+ void Modify();
+
+private:
+ weld::Entry& m_rEntry;
+ Link<weld::Entry&, void> m_aModifyHdl;
+ Link<weld::Widget&, void> m_aFocusInHdl;
+ Link<weld::Widget&, void> m_aFocusOutHdl;
+ Link<const KeyEvent&, bool> m_aKeyPressHdl;
+ bool m_bStrictFormat;
+ bool m_bSameMask;
+ bool m_bReformat;
+ bool m_bInPattKeyInput;
+ OString m_aEditMask;
+ OUString m_aLiteralMask;
+
+ void EntryGainFocus();
+ void EntryLostFocus();
+ DECL_DLLPRIVATE_LINK(ModifyHdl, weld::Entry&, void);
+ DECL_DLLPRIVATE_LINK(FocusInHdl, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(FocusOutHdl, weld::Widget&, void);
+ DECL_DLLPRIVATE_LINK(KeyInputHdl, const KeyEvent&, bool);
+};
+
// get the row the iterator is on
VCL_DLLPUBLIC size_t GetAbsPos(const weld::TreeView& rTreeView, const weld::TreeIter& rIter);