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/.
10 #ifndef INCLUDED_VCL_ICONTHEMESELECTOR_HXX
11 #define INCLUDED_VCL_ICONTHEMESELECTOR_HXX
13 #include <rtl/ustring.hxx>
15 #include <vcl/dllapi.h>
19 // forward declaration of unit test class. Required for friend relationship.
20 class IconThemeSelectorTest
;
25 /** This class helps to choose an icon theme from a list of installed themes.
27 * The following factors influence the selection:
28 * -# When high contrast mode is enabled, the high contrast icon theme is selected (if it is installed).
29 * -# When a preferred theme has been set (e.g., in the gnome desktop settings), that theme is selected.
31 class VCL_DLLPUBLIC IconThemeSelector
{
35 /** Select an icon theme from the list of installed themes.
37 * If high contrast mode has been enabled, the highcontrast theme will be selected (if it is available).
40 * @p installedThemes must not be empty
44 const std::vector
<IconThemeInfo
>& installedThemes
,
48 /** Select the standard icon theme for a desktop environment from a list of installed themes.
50 * If a preferred theme has been set, this one will take precedence.
52 * The same logic as in SelectIconTheme() will apply.
55 * @p installedThemes must not be empty
58 SelectIconThemeForDesktopEnvironment(
59 const std::vector
<IconThemeInfo
>& installedThemes
,
60 const OUString
& desktopEnvironment
) const;
63 SetUseHighContrastTheme(bool);
66 SetPreferredIconTheme(const OUString
&, bool bDarkIconTheme
);
69 operator==(const vcl::IconThemeSelector
&) const;
72 operator!=(const vcl::IconThemeSelector
&) const;
75 /** Return the first element of the themes, or the fallback if the vector is empty */
77 ReturnFallback(const std::vector
<IconThemeInfo
>& installedThemes
);
79 /** The name of the icon theme which is used as fallback */
80 static const OUStringLiteral FALLBACK_ICON_THEME_ID
;
84 GetIconThemeForDesktopEnvironment(const OUString
& desktopEnvironment
);
86 OUString mPreferredIconTheme
;
87 bool mUseHighContrastTheme
;
88 bool mPreferDarkIconTheme
;
90 friend class ::IconThemeSelectorTest
;
95 #endif // INCLUDED_VCL_ICONTHEMESELECTOR_HXX
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */