/src/libreoffice/include/vcl/weld/MenuButton.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/ToggleButton.hxx> |
14 | | |
15 | | namespace weld |
16 | | { |
17 | | class VCL_DLLPUBLIC MenuButton : virtual public ToggleButton |
18 | | { |
19 | | Link<const OUString&, void> m_aSelectHdl; |
20 | | |
21 | | protected: |
22 | 0 | void signal_selected(const OUString& rIdent) { m_aSelectHdl.Call(rIdent); } |
23 | | |
24 | | public: |
25 | 0 | void connect_selected(const Link<const OUString&, void>& rLink) { m_aSelectHdl = rLink; } |
26 | | |
27 | | virtual void insert_item(int pos, const OUString& rId, const OUString& rStr, |
28 | | const OUString* pIconName, VirtualDevice* pImageSurface, |
29 | | TriState eCheckRadioFalse) |
30 | | = 0; |
31 | | void append_item(const OUString& rId, const OUString& rStr) |
32 | 0 | { |
33 | 0 | insert_item(-1, rId, rStr, nullptr, nullptr, TRISTATE_INDET); |
34 | 0 | } |
35 | | void append_item_check(const OUString& rId, const OUString& rStr) |
36 | 0 | { |
37 | 0 | insert_item(-1, rId, rStr, nullptr, nullptr, TRISTATE_TRUE); |
38 | 0 | } |
39 | | void append_item(const OUString& rId, const OUString& rStr, const OUString& rImage) |
40 | 0 | { |
41 | 0 | insert_item(-1, rId, rStr, &rImage, nullptr, TRISTATE_INDET); |
42 | 0 | } |
43 | | void append_item(const OUString& rId, const OUString& rStr, VirtualDevice& rImage) |
44 | 0 | { |
45 | 0 | insert_item(-1, rId, rStr, nullptr, &rImage, TRISTATE_INDET); |
46 | 0 | } |
47 | | virtual void insert_separator(int pos, const OUString& rId) = 0; |
48 | 0 | void append_separator(const OUString& rId) { insert_separator(-1, rId); } |
49 | | virtual void remove_item(const OUString& rId) = 0; |
50 | | virtual void clear() = 0; |
51 | | virtual void set_item_sensitive(const OUString& rIdent, bool bSensitive) = 0; |
52 | | virtual void set_item_active(const OUString& rIdent, bool bActive) = 0; |
53 | | virtual void set_item_label(const OUString& rIdent, const OUString& rLabel) = 0; |
54 | | virtual OUString get_item_label(const OUString& rIdent) const = 0; |
55 | | virtual void set_item_visible(const OUString& rIdent, bool bVisible) = 0; |
56 | | |
57 | | virtual void set_popover(weld::Widget* pPopover) = 0; |
58 | | }; |
59 | | } |
60 | | |
61 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |