/src/libreoffice/vcl/inc/verticaltabctrl.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
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 | | * This file incorporates work covered by the following license notice: |
10 | | * |
11 | | * Licensed to the Apache Software Foundation (ASF) under one or more |
12 | | * contributor license agreements. See the NOTICE file distributed |
13 | | * with this work for additional information regarding copyright |
14 | | * ownership. The ASF licenses this file to you under the Apache |
15 | | * License, Version 2.0 (the "License"); you may not use this file |
16 | | * except in compliance with the License. You may obtain a copy of |
17 | | * the License at http://www.apache.org/licenses/LICENSE-2.0 . |
18 | | */ |
19 | | |
20 | | #pragma once |
21 | | |
22 | | #include "ivctrl.hxx" |
23 | | |
24 | | #include <tools/json_writer.hxx> |
25 | | #include <vcl/layout.hxx> |
26 | | |
27 | | #include <memory> |
28 | | #include <string_view> |
29 | | |
30 | | struct VerticalTabPageData; |
31 | | |
32 | | class VerticalTabControl final : public VclHBox |
33 | | { |
34 | | VclPtr<SvtIconChoiceCtrl> m_xChooser; |
35 | | VclPtr<VclVBox> m_xBox; |
36 | | |
37 | | std::vector<std::unique_ptr<VerticalTabPageData>> maPageList; |
38 | | OUString m_sCurrentPageId; |
39 | | |
40 | | Link<VerticalTabControl*, void> m_aActivateHdl; |
41 | | Link<VerticalTabControl*, bool> m_aDeactivateHdl; |
42 | | |
43 | | DECL_LINK(ChosePageHdl_Impl, SvtIconChoiceCtrl*, void); |
44 | | |
45 | | void ActivatePage(); |
46 | | bool DeactivatePage(); |
47 | | |
48 | | VerticalTabPageData* GetPageData(std::u16string_view rId) const; |
49 | | VerticalTabPageData* GetPageData(const SvxIconChoiceCtrlEntry* pEntry) const; |
50 | | |
51 | | public: |
52 | | VerticalTabControl(vcl::Window* pParent, bool bWithIcons); |
53 | | virtual ~VerticalTabControl() override; |
54 | | virtual void dispose() override; |
55 | | |
56 | | virtual bool EventNotify(NotifyEvent& rNEvt) override; |
57 | | |
58 | 0 | sal_uInt16 GetPageCount() const { return m_xChooser->GetEntryCount(); } |
59 | | |
60 | 0 | const OUString& GetCurPageId() const { return m_sCurrentPageId; } |
61 | | void SetCurPageId(const OUString& rId); |
62 | | |
63 | | sal_uInt16 GetPagePos(std::u16string_view rPageId) const; |
64 | | const OUString& GetPageId(sal_uInt16 nIndex) const; |
65 | | VclPtr<vcl::Window> GetPage(std::u16string_view rPageId) const; |
66 | | |
67 | | void RemovePage(std::u16string_view rPageId); |
68 | | void InsertPage(const OUString& rPageId, const OUString& rLabel, const Image& rImage, |
69 | | const OUString& rTooltip, VclPtr<vcl::Window> xPage, int nPos = -1); |
70 | | |
71 | | void SetActivatePageHdl(const Link<VerticalTabControl*, void>& rLink) |
72 | 0 | { |
73 | 0 | m_aActivateHdl = rLink; |
74 | 0 | } |
75 | | void SetDeactivatePageHdl(const Link<VerticalTabControl*, bool>& rLink) |
76 | 0 | { |
77 | 0 | m_aDeactivateHdl = rLink; |
78 | 0 | } |
79 | | |
80 | | OUString GetPageText(std::u16string_view rPageId) const; |
81 | | void SetPageText(std::u16string_view rPageId, const OUString& rText); |
82 | | |
83 | 0 | vcl::Window* GetPageParent() { return m_xBox.get(); } |
84 | | |
85 | | virtual Size GetOptimalSize() const override; |
86 | | |
87 | | virtual FactoryFunction GetUITestFactory() const override; |
88 | | }; |
89 | | |
90 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |