LibreOffice Module sfx2 (master) 1
TitleBar.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <sidebar/TitleBar.hxx>
21
22namespace sfx2::sidebar {
23
25 : mrBuilder(rBuilder)
26 , mxTitlebar(rBuilder.weld_box("titlebar"))
27 , mxAddonImage(rBuilder.weld_image("addonimage"))
28 , mxToolBox(rBuilder.weld_toolbar("toolbar"))
29 , meThemeItem(eThemeItem)
30{
32
33 mxToolBox->connect_clicked(LINK(this, TitleBar, SelectionHandler));
34}
35
37{
39 mxTitlebar->set_background(aColor);
40 mxToolBox->set_background(aColor);
41}
42
44{
46}
47
49{
50}
51
53{
54 return mxTitlebar->get_preferred_size();
55}
56
57void TitleBar::Show(bool bShow)
58{
59 mxTitlebar->set_visible(bShow);
60}
61
63{
64 return mxTitlebar->get_visible();
65}
66
67void TitleBar::SetIcon(const css::uno::Reference<css::graphic::XGraphic>& rIcon)
68{
69 mxAddonImage->set_image(rIcon);
70 mxAddonImage->set_visible(rIcon.is());
71}
72
73IMPL_LINK_NOARG(TitleBar, SelectionHandler, const OUString&, void)
74{
75 HandleToolBoxItemClick();
76}
77
78} // end of namespace sfx2::sidebar
79
80/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static Color GetColor(const ThemeItem eItem)
Definition: Theme.cxx:49
bool GetVisible() const
Definition: TitleBar.cxx:62
Theme::ThemeItem meThemeItem
Definition: TitleBar.hxx:58
void SetIcon(const css::uno::Reference< css::graphic::XGraphic > &rIcon)
Definition: TitleBar.cxx:67
virtual void DataChanged()
Definition: TitleBar.cxx:43
TitleBar(weld::Builder &rBuilder, Theme::ThemeItem eThemeItem)
Definition: TitleBar.cxx:24
void Show(bool bShow)
Definition: TitleBar.cxx:57
std::unique_ptr< weld::Box > mxTitlebar
Definition: TitleBar.hxx:55
std::unique_ptr< weld::Image > mxAddonImage
Definition: TitleBar.hxx:56
std::unique_ptr< weld::Toolbar > mxToolBox
Definition: TitleBar.hxx:57
Size get_preferred_size() const
Definition: TitleBar.cxx:52
IMPL_LINK_NOARG(AsynchronousCall, HandleUserCall, void *, void)