Bump version to 21.06.18.1
[LibreOffice.git] / include / vcl / InterimItemWindow.hxx
blob08860c50244a3420899a6b98de18463ed5e97e31
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #pragma once
12 #include <vcl/dllapi.h>
13 #include <vcl/ctrl.hxx>
14 #include <vcl/idle.hxx>
15 #include <vcl/weld.hxx>
17 class VCL_DLLPUBLIC InterimItemWindow : public Control
19 public:
20 virtual ~InterimItemWindow() override;
21 virtual void dispose() override;
23 virtual void Resize() override;
24 virtual Size GetOptimalSize() const override;
25 // throw away cached size request of child so GetOptimalSize will
26 // fetch it anew
27 void InvalidateChildSizeCache();
28 virtual void StateChanged(StateChangedType nStateChange) override;
29 virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
30 virtual void GetFocus() override;
32 bool ControlHasFocus() const;
34 virtual void Draw(OutputDevice* pDevice, const Point& rPos, DrawFlags nFlags) override;
36 protected:
37 // bAllowCycleFocusOut of true allows focus to be moved out of the Control
38 // via tab key into a parent window or sibling window, false means focus
39 // remains inside the InterimItemWindow and cycles back to the first child
40 // of this control on reaching pass the last child. This is suitable when
41 // the Control is the toplevel control and has no siblings or parent
42 InterimItemWindow(vcl::Window* pParent, const OUString& rUIXMLDescription, const OString& rID,
43 bool bAllowCycleFocusOut = true, sal_uInt64 nLOKWindowId = 0);
45 void InitControlBase(weld::Widget* pWidget);
47 // pass keystrokes from our child window through this to handle focus changes correctly
48 // returns true if keystroke is consumed
49 bool ChildKeyInput(const KeyEvent& rKEvt);
51 virtual void Layout();
53 std::unique_ptr<weld::Builder> m_xBuilder;
54 VclPtr<vcl::Window> m_xVclContentArea;
55 std::unique_ptr<weld::Container> m_xContainer;
56 weld::Widget* m_pWidget;
58 private:
59 Idle m_aLayoutIdle;
61 void StartIdleLayout();
63 DECL_LINK(DoLayout, Timer*, void);
65 virtual void ImplPaintToDevice(::OutputDevice* pTargetOutDev, const Point& rPos) override;
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */