Change-Id: I5eec1b68efc285995db3b5825699c07fa006cb35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207375 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
69 lines
1.8 KiB
C++
69 lines
1.8 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <svx/IColorSet.hxx>
|
|
#include <svx/svxdllapi.h>
|
|
#include <tools/link.hxx>
|
|
#include <vcl/vclptr.hxx>
|
|
|
|
class VirtualDevice;
|
|
|
|
namespace weld
|
|
{
|
|
class IconView;
|
|
class ItemView;
|
|
class TreeIter;
|
|
}
|
|
|
|
class SVXCORE_DLLPUBLIC ColorIconView : public IColorSet
|
|
{
|
|
std::unique_ptr<weld::IconView> m_pIconView;
|
|
|
|
Link<const Color&, void> m_aColorActivatedHdl;
|
|
Link<const ColorIconView&, void> m_aSelectionChangedHdl;
|
|
|
|
DECL_LINK(ItemActivatedHdl, const weld::TreeIter&, bool);
|
|
DECL_LINK(SelectionChangedHdl, weld::ItemView&, void);
|
|
|
|
public:
|
|
ColorIconView(std::unique_ptr<weld::IconView> pIconView);
|
|
virtual ~ColorIconView() = default;
|
|
|
|
virtual void insert(int nIndex, const Color& rColor, const OUString& rColorName) override;
|
|
virtual int getItemCount() const override;
|
|
|
|
Color getColor(int nIndex) const;
|
|
OUString getColorName(int nIndex) const;
|
|
|
|
int get_selected_index() const;
|
|
void select(int nIndex);
|
|
void unselect_all();
|
|
|
|
void remove(int nIndex);
|
|
virtual void clear() override;
|
|
|
|
void grab_focus();
|
|
|
|
void set_sensitive(bool bSensitive);
|
|
|
|
void set_help_id(const OUString& rName);
|
|
|
|
void setColorActivatedHdl(const Link<const Color&, void>& rLink)
|
|
{
|
|
m_aColorActivatedHdl = rLink;
|
|
}
|
|
|
|
private:
|
|
ScopedVclPtr<VirtualDevice> createIcon(const Color& rColor);
|
|
};
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|