Coverage Report

Created: 2026-10-14 09:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/vcl/weld/IconView.hxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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
10
#pragma once
11
12
#include <vcl/dllapi.h>
13
#include <vcl/weld/ItemView.hxx>
14
15
class Bitmap;
16
17
namespace weld
18
{
19
typedef std::tuple<OUString&, const TreeIter&> encoded_image_query;
20
21
class VCL_DLLPUBLIC IconView : virtual public ItemView
22
{
23
protected:
24
    Link<const TreeIter&, OUString> m_aQueryTooltipHdl;
25
26
    OUString signal_query_tooltip(const TreeIter& rIter) const
27
0
    {
28
0
        if (notify_events_disabled())
29
0
            return {};
30
0
        return m_aQueryTooltipHdl.Call(rIter);
31
0
    }
32
33
    virtual void do_insert(int pos, const OUString* pStr, const OUString* pId,
34
                           const OUString* pIconName, TreeIter* pRet)
35
        = 0;
36
    virtual void do_insert(int pos, const OUString* pStr, const OUString* pId, const Bitmap* pIcon,
37
                           TreeIter* pRet)
38
        = 0;
39
    virtual void do_scroll_to_item(const TreeIter& rIter) = 0;
40
41
public:
42
    virtual int get_item_width() const = 0;
43
    virtual void set_item_width(int width) = 0;
44
45
    void insert(int pos, const OUString* pStr, const OUString* pId, const OUString* pIconName,
46
                TreeIter* pRet)
47
0
    {
48
0
        disable_notify_events();
49
0
        do_insert(pos, pStr, pId, pIconName, pRet);
50
0
        enable_notify_events();
51
0
    }
52
53
    void insert(int pos, const OUString* pStr, const OUString* pId, const Bitmap* pIcon,
54
                TreeIter* pRet)
55
0
    {
56
0
        disable_notify_events();
57
0
        do_insert(pos, pStr, pId, pIcon, pRet);
58
0
        enable_notify_events();
59
0
    }
60
61
    virtual void insert_separator(int pos, const OUString* pId) = 0;
62
63
    void append(const OUString& rId, const OUString& rStr, const OUString& rImage)
64
0
    {
65
0
        insert(-1, &rStr, &rId, &rImage, nullptr);
66
0
    }
67
68
0
    void append_separator(const OUString& rId) { insert_separator(-1, &rId); }
69
70
    virtual void connect_query_tooltip(const Link<const TreeIter&, OUString>& rLink)
71
0
    {
72
0
        m_aQueryTooltipHdl = rLink;
73
0
    }
74
75
    virtual int count_selected_items() const = 0;
76
77
    virtual void set_image(int pos, VirtualDevice& rDevice) = 0;
78
    virtual void set_text(int pos, const OUString& rText) = 0;
79
    virtual void set_item_accessible_name(int pos, const OUString& rName) = 0;
80
81
    virtual void set_item_tooltip_text(int pos, const OUString& rToolTip) = 0;
82
    OUString get_item_tooltip_text(int pos) const;
83
    virtual OUString get_item_tooltip_text(const TreeIter& rIter) const = 0;
84
85
    virtual tools::Rectangle get_rect(const TreeIter& rIter) const = 0;
86
87
    std::unique_ptr<weld::TreeIter> get_item_at_pos(const Point& rPos);
88
89
    void scroll_to_item(const TreeIter& rIter)
90
0
    {
91
0
        disable_notify_events();
92
0
        do_scroll_to_item(rIter);
93
0
        enable_notify_events();
94
0
    }
95
};
96
}
97
98
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */