/src/libreoffice/include/vcl/weld/Menu.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/Placement.hxx> |
14 | | #include <vcl/weld/Widget.hxx> |
15 | | |
16 | | namespace com::sun::star::graphic |
17 | | { |
18 | | class XGraphic; |
19 | | } |
20 | | |
21 | | namespace weld |
22 | | { |
23 | | class VCL_DLLPUBLIC Menu |
24 | | { |
25 | | Link<const OUString&, void> m_aActivateHdl; |
26 | | |
27 | | protected: |
28 | 0 | void signal_activate(const OUString& rIdent) { m_aActivateHdl.Call(rIdent); } |
29 | | |
30 | | public: |
31 | | virtual OUString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect, |
32 | | Placement ePlace = Placement::Under) |
33 | | = 0; |
34 | | |
35 | 0 | void connect_activate(const Link<const OUString&, void>& rLink) { m_aActivateHdl = rLink; } |
36 | | |
37 | | virtual void set_sensitive(const OUString& rIdent, bool bSensitive) = 0; |
38 | | virtual bool get_sensitive(const OUString& rIdent) const = 0; |
39 | | virtual void set_label(const OUString& rIdent, const OUString& rLabel) = 0; |
40 | | virtual OUString get_label(const OUString& rIdent) const = 0; |
41 | | virtual void set_tooltip_text(const OUString& rIdent, const OUString& rTip) = 0; |
42 | | virtual void set_active(const OUString& rIdent, bool bActive) = 0; |
43 | | virtual bool get_active(const OUString& rIdent) const = 0; |
44 | | virtual void set_visible(const OUString& rIdent, bool bVisible) = 0; |
45 | | |
46 | | virtual void insert(int pos, const OUString& rId, const OUString& rStr, |
47 | | const OUString* pIconName, VirtualDevice* pImageSurface, |
48 | | const css::uno::Reference<css::graphic::XGraphic>& rImage, |
49 | | TriState eCheckRadioFalse) |
50 | | = 0; |
51 | | |
52 | | virtual void set_item_help_id(const OUString& rIdent, const OUString& rHelpId) = 0; |
53 | | virtual void remove(const OUString& rId) = 0; |
54 | | |
55 | | virtual void clear() = 0; |
56 | | |
57 | | virtual void insert_separator(int pos, const OUString& rId) = 0; |
58 | 0 | void append_separator(const OUString& rId) { insert_separator(-1, rId); } |
59 | | |
60 | | void append(const OUString& rId, const OUString& rStr) |
61 | 0 | { |
62 | 0 | insert(-1, rId, rStr, nullptr, nullptr, nullptr, TRISTATE_INDET); |
63 | 0 | } |
64 | | void append_check(const OUString& rId, const OUString& rStr) |
65 | 0 | { |
66 | 0 | insert(-1, rId, rStr, nullptr, nullptr, nullptr, TRISTATE_TRUE); |
67 | 0 | } |
68 | | void append_radio(const OUString& rId, const OUString& rStr) |
69 | 0 | { |
70 | 0 | insert(-1, rId, rStr, nullptr, nullptr, nullptr, TRISTATE_FALSE); |
71 | 0 | } |
72 | | void append(const OUString& rId, const OUString& rStr, const OUString& rImage) |
73 | 0 | { |
74 | 0 | insert(-1, rId, rStr, &rImage, nullptr, nullptr, TRISTATE_INDET); |
75 | 0 | } |
76 | | void append(const OUString& rId, const OUString& rStr, VirtualDevice& rImage) |
77 | 0 | { |
78 | 0 | insert(-1, rId, rStr, nullptr, &rImage, nullptr, TRISTATE_INDET); |
79 | 0 | } |
80 | | |
81 | | // return the number of toplevel nodes |
82 | | virtual int n_children() const = 0; |
83 | | |
84 | | virtual OUString get_id(int pos) const = 0; |
85 | | |
86 | 0 | virtual ~Menu() {} |
87 | | }; |
88 | | } |
89 | | |
90 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |