Version 7.1.7.1, tag libreoffice-7.1.7.1
[LibreOffice.git] / sfx2 / source / sidebar / TitleBar.cxx
blob615cb6de3b7b7acd0596330c50409f59283e6547
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sidebar/TitleBar.hxx>
22 namespace sfx2::sidebar {
24 TitleBar::TitleBar(vcl::Window* pParentWindow,
25 const OUString& rUIXMLDescription, const OString& rID,
26 Theme::ThemeItem eThemeItem)
27 : InterimItemWindow(pParentWindow, rUIXMLDescription, rID)
28 , mxAddonImage(m_xBuilder->weld_image("addonimage"))
29 , mxToolBox(m_xBuilder->weld_toolbar("toolbar"))
30 , meThemeItem(eThemeItem)
32 Color aBgColor = Theme::GetColor(meThemeItem);
33 m_xContainer->set_background(aBgColor);
34 mxToolBox->set_background(aBgColor);
36 mxToolBox->connect_clicked(LINK(this, TitleBar, SelectionHandler));
39 TitleBar::~TitleBar()
41 disposeOnce();
44 void TitleBar::dispose()
46 mxToolBox.reset();
47 mxAddonImage.reset();
48 InterimItemWindow::dispose();
51 void TitleBar::SetIcon(const css::uno::Reference<css::graphic::XGraphic>& rIcon)
53 mxAddonImage->set_image(rIcon);
54 mxAddonImage->set_visible(rIcon.is());
57 void TitleBar::DataChanged (const DataChangedEvent& /*rEvent*/)
59 m_xContainer->set_background(Theme::GetColor(meThemeItem));
62 IMPL_LINK_NOARG(TitleBar, SelectionHandler, const OString&, void)
64 HandleToolBoxItemClick();
67 } // end of namespace sfx2::sidebar
69 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */