summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-07-22 15:19:26 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-07-22 20:47:54 +0200
commitdf8f780cc24410d2fec5c4d4e1ed58d492559241 (patch)
treef26af4690497235379a0d91635226bee6013f171 /vcl/source
parent40251f0e73d2cb700313395dcf49c43a9c1e8570 (diff)
move useful parts of ControlBase down hierarchy
Change-Id: I4116a3532b21f6066468bd3905efef1020ace101 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99233 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/control/InterimItemWindow.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/vcl/source/control/InterimItemWindow.cxx b/vcl/source/control/InterimItemWindow.cxx
index 67554e226b5b..e42a331438f2 100644
--- a/vcl/source/control/InterimItemWindow.cxx
+++ b/vcl/source/control/InterimItemWindow.cxx
@@ -13,6 +13,7 @@
InterimItemWindow::InterimItemWindow(vcl::Window* pParent, const OUString& rUIXMLDescription,
const OString& rID, sal_uInt64 nLOKWindowId)
: Control(pParent, WB_TABSTOP | WB_DIALOGCONTROL)
+ , m_pWidget(nullptr) // inheritors are expected to call InitControlBase
{
m_xVclContentArea = VclPtr<VclVBox>::Create(this);
m_xVclContentArea->Show();
@@ -28,6 +29,8 @@ InterimItemWindow::~InterimItemWindow() { disposeOnce(); }
void InterimItemWindow::dispose()
{
+ m_pWidget = nullptr;
+
m_xContainer.reset();
m_xBuilder.reset();
m_xVclContentArea.disposeAndClear();
@@ -48,8 +51,20 @@ Size InterimItemWindow::GetOptimalSize() const
return VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild));
}
+bool InterimItemWindow::ControlHasFocus() const
+{
+ if (!m_pWidget)
+ return false;
+ return m_pWidget->has_focus();
+}
+
+void InterimItemWindow::InitControlBase(weld::Widget* pWidget) { m_pWidget = pWidget; }
+
void InterimItemWindow::GetFocus()
{
+ if (m_pWidget)
+ m_pWidget->grab_focus();
+
/* let toolbox know this item window has focus so it updates its mnHighItemId to point
to this toolitem in case tab means to move to another toolitem within
the toolbox
@@ -97,4 +112,16 @@ bool InterimItemWindow::ChildKeyInput(const KeyEvent& rKEvt)
return true;
}
+void InterimItemWindow::Draw(OutputDevice* pDevice, const Point& rPos, DrawFlags /*nFlags*/)
+{
+ if (!m_pWidget)
+ return;
+ m_pWidget->draw(*pDevice, tools::Rectangle(rPos, GetSizePixel()));
+}
+
+void InterimItemWindow::ImplPaintToDevice(::OutputDevice* pTargetOutDev, const Point& rPos)
+{
+ Draw(pTargetOutDev, rPos, DrawFlags::NONE);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */