1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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(weld::Builder
& rBuilder
, Theme::ThemeItem eThemeItem
)
26 , mxTitlebar(rBuilder
.weld_box("titlebar"))
27 , mxAddonImage(rBuilder
.weld_image("addonimage"))
28 , mxToolBox(rBuilder
.weld_toolbar("toolbar"))
29 , meThemeItem(eThemeItem
)
33 mxToolBox
->connect_clicked(LINK(this, TitleBar
, SelectionHandler
));
36 void TitleBar::SetBackground()
38 Color
aColor(Theme::GetColor(meThemeItem
));
39 mxTitlebar
->set_background(aColor
);
40 mxToolBox
->set_background(aColor
);
43 void TitleBar::DataChanged()
52 Size
TitleBar::get_preferred_size() const
54 return mxTitlebar
->get_preferred_size();
57 void TitleBar::Show(bool bShow
)
59 mxTitlebar
->set_visible(bShow
);
62 bool TitleBar::GetVisible() const
64 return mxTitlebar
->get_visible();
67 void TitleBar::SetIcon(const css::uno::Reference
<css::graphic::XGraphic
>& rIcon
)
69 mxAddonImage
->set_image(rIcon
);
70 mxAddonImage
->set_visible(rIcon
.is());
73 IMPL_LINK_NOARG(TitleBar
, SelectionHandler
, const OString
&, void)
75 HandleToolBoxItemClick();
78 } // end of namespace sfx2::sidebar
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */