diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-07-25 12:52:30 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-07-27 20:13:41 +0200 |
commit | 32f0a170c941522d0b7c0594aa4627a84a0d1b38 (patch) | |
tree | 94f85b7cba784546bfc1feaabb81a53c195f76c0 /include | |
parent | fe019b702cfe2af24c35f40db340a82892feb69c (diff) |
weld NavigationBar
Change-Id: I5d31d603a9e5f91723a310900aeee875df1599c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99445
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/svtools/brwbox.hxx | 4 | ||||
-rw-r--r-- | include/svtools/recorditemwindow.hxx | 23 | ||||
-rw-r--r-- | include/svx/gridctrl.hxx | 108 |
3 files changed, 77 insertions, 58 deletions
diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx index 00b68803515b..63796c752ef8 100644 --- a/include/svtools/brwbox.hxx +++ b/include/svtools/brwbox.hxx @@ -39,7 +39,7 @@ class BrowserColumn; class BrowserHeader; class ScrollBar; -class RecordItemWindow; +class MeasureStatusBar; namespace svt { class BrowseBoxImpl; @@ -275,7 +275,7 @@ private: VclPtr<BrowserDataWin> pDataWin; // window to display data rows VclPtr<ScrollBar> pVScroll; // vertical scrollbar VclPtr<ScrollBar> aHScroll; // horizontal scrollbar - VclPtr<RecordItemWindow> aStatusBarHeight; // statusbar, just to measure its height + VclPtr<MeasureStatusBar> aStatusBarHeight; // statusbar, just to measure its height long nDataRowHeight; // height of a single data-row sal_uInt16 nTitleLines; // number of lines in title row diff --git a/include/svtools/recorditemwindow.hxx b/include/svtools/recorditemwindow.hxx index 576be8766430..06571a7b69ac 100644 --- a/include/svtools/recorditemwindow.hxx +++ b/include/svtools/recorditemwindow.hxx @@ -12,24 +12,24 @@ #include <vcl/InterimItemWindow.hxx> #include <svtools/svtdllapi.h> -class SVT_DLLPUBLIC RecordItemWindow : public InterimItemWindow +class SVT_DLLPUBLIC RecordItemWindowBase { public: - RecordItemWindow(vcl::Window* pParent, bool bHasFrame); - virtual void dispose() override; - virtual ~RecordItemWindow() override; + RecordItemWindowBase(std::unique_ptr<weld::Entry> xEntry); + virtual ~RecordItemWindowBase(); void set_text(const OUString& rText) { m_xWidget->set_text(rText); } void set_font(const vcl::Font& rFont) { m_xWidget->set_font(rFont); } + void set_help_id(const OString& rHelpId) { m_xWidget->set_help_id(rHelpId); } protected: + std::unique_ptr<weld::Entry> m_xWidget; + virtual bool DoKeyInput(const KeyEvent& rEvt); private: virtual void PositionFired(sal_Int64 nRecord); - std::unique_ptr<weld::Entry> m_xWidget; - DECL_LINK(KeyInputHdl, const KeyEvent&, bool); DECL_LINK(ActivatedHdl, weld::Entry&, bool); @@ -39,4 +39,15 @@ private: void FirePosition(bool bForce); }; +class SVT_DLLPUBLIC RecordItemWindow : public InterimItemWindow, public RecordItemWindowBase +{ +public: + RecordItemWindow(vcl::Window* pParent, bool bHasFrame); + virtual void dispose() override; + virtual ~RecordItemWindow() override; + +protected: + virtual bool DoKeyInput(const KeyEvent& rEvt) override; +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/svx/gridctrl.hxx b/include/svx/gridctrl.hxx index c07f9ed464f1..dfcf5cb151af 100644 --- a/include/svx/gridctrl.hxx +++ b/include/svx/gridctrl.hxx @@ -39,10 +39,6 @@ namespace com::sun::star::sdb { class XRowsChangeListener; } namespace com::sun::star::uno { class XComponentContext; } namespace com::sun::star::util { class XNumberFormatter; } -class Button; -class ImageButton; -class FixedText; - class CursorWrapper; bool CompareBookmark(const css::uno::Any& aLeft, const css::uno::Any& aRight); @@ -163,67 +159,79 @@ enum class DbGridControlNavigationBarState class FmXGridSourcePropListener; class DisposeListenerGridBridge; -class SVXCORE_DLLPUBLIC DbGridControl : public svt::EditBrowseBox + +// NavigationBar +class NavigationBar final : public InterimItemWindow { - friend class FmXGridSourcePropListener; - friend class GridFieldValueListener; - friend class DisposeListenerGridBridge; + class AbsolutePos final : public RecordItemWindowBase + { + public: + AbsolutePos(std::unique_ptr<weld::Entry> xEntry, NavigationBar* pBar); -public: + virtual bool DoKeyInput(const KeyEvent& rEvt) override; + virtual void PositionFired(sal_Int64 nRecord) override; - // NavigationBar + weld::Entry* GetWidget() { return m_xWidget.get(); } + private: + VclPtr<NavigationBar> m_xParent; + }; - class SAL_DLLPRIVATE NavigationBar final : public Control - { - class AbsolutePos final : public RecordItemWindow - { - public: - AbsolutePos(vcl::Window* pParent); + friend class NavigationBar::AbsolutePos; - virtual bool DoKeyInput(const KeyEvent& rEvt) override; - virtual void PositionFired(sal_Int64 nRecord) override; - }; + // additional controls + std::unique_ptr<weld::Label> m_xRecordText; + std::unique_ptr<AbsolutePos> m_xAbsolute; // absolute positioning + std::unique_ptr<weld::Label> m_xRecordOf; + std::unique_ptr<weld::Label> m_xRecordCount; - friend class NavigationBar::AbsolutePos; + std::unique_ptr<weld::Button> m_xFirstBtn; // Button for 'go to the first record' + std::unique_ptr<weld::Button> m_xPrevBtn; // Button for 'go to the previous record' + std::unique_ptr<weld::Button> m_xNextBtn; // Button for 'go to the next record' + std::unique_ptr<weld::Button> m_xLastBtn; // Button for 'go to the last record' + std::unique_ptr<weld::Button> m_xNewBtn; // Button for 'go to a new record' - // additional controls - VclPtr<FixedText> m_aRecordText; - VclPtr<AbsolutePos> m_aAbsolute; // absolute positioning - VclPtr<FixedText> m_aRecordOf; - VclPtr<FixedText> m_aRecordCount; + AutoTimer m_aNextRepeat; + AutoTimer m_aPrevRepeat; - VclPtr<ImageButton> m_aFirstBtn; // ImageButton for 'go to the first record' - VclPtr<ImageButton> m_aPrevBtn; // ImageButton for 'go to the previous record' - VclPtr<ImageButton> m_aNextBtn; // ImageButton for 'go to the next record' - VclPtr<ImageButton> m_aLastBtn; // ImageButton for 'go to the last record' - VclPtr<ImageButton> m_aNewBtn; // ImageButton for 'go to a new record' - sal_Int32 m_nCurrentPos; + sal_Int32 m_nCurrentPos; - bool m_bPositioning; // protect PositionDataSource against recursion + bool m_bPositioning; // protect PositionDataSource against recursion - public: - NavigationBar(vcl::Window* pParent); - virtual ~NavigationBar() override; - virtual void dispose() override; +public: + NavigationBar(vcl::Window* pParent); + virtual ~NavigationBar() override; + virtual void dispose() override; - // Status methods for Controls - void InvalidateAll(sal_Int32 nCurrentPos, bool bAll = false); - void InvalidateState(DbGridControlNavigationBarState nWhich) {SetState(nWhich);} - void SetState(DbGridControlNavigationBarState nWhich); - bool GetState(DbGridControlNavigationBarState nWhich) const; - sal_uInt16 ArrangeControls(); + // Status methods for Controls + void InvalidateAll(sal_Int32 nCurrentPos, bool bAll = false); + void InvalidateState(DbGridControlNavigationBarState nWhich) {SetState(nWhich);} + void SetState(DbGridControlNavigationBarState nWhich); + bool GetState(DbGridControlNavigationBarState nWhich) const; + sal_uInt16 ArrangeControls(); - private: - virtual void Resize() override; - virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; - virtual void StateChanged( StateChangedType nType ) override; +private: - DECL_LINK(OnClick, Button*, void); + DECL_LINK(OnClick, weld::Button&, void); - void PositionDataSource(sal_Int32 nRecord); - }; + DECL_LINK(PrevMousePressHdl, const MouseEvent&, bool); + DECL_LINK(PrevMouseReleaseHdl, const MouseEvent&, bool); + DECL_LINK(NextMousePressHdl, const MouseEvent&, bool); + DECL_LINK(NextMouseReleaseHdl, const MouseEvent&, bool); + DECL_LINK(PrevRepeatTimerHdl, Timer*, void); + DECL_LINK(NextRepeatTimerHdl, Timer*, void); + + void PositionDataSource(sal_Int32 nRecord); +}; + +class SVXCORE_DLLPUBLIC DbGridControl : public svt::EditBrowseBox +{ + friend class FmXGridSourcePropListener; + friend class GridFieldValueListener; + friend class DisposeListenerGridBridge; + +public: - friend class DbGridControl::NavigationBar; + friend class NavigationBar; private: Link<DbGridControlNavigationBarState,int> m_aMasterStateProvider; |