1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
23 #include <string_view>
25 #include <tools/json_writer.hxx>
27 #include <vcl/dllapi.h>
28 #include <vcl/toolkit/ivctrl.hxx>
29 #include <vcl/layout.hxx>
31 struct VerticalTabPageData
;
33 class VerticalTabControl final
: public VclHBox
35 VclPtr
<SvtIconChoiceCtrl
> m_xChooser
;
36 VclPtr
<VclVBox
> m_xBox
;
38 std::vector
<std::unique_ptr
<VerticalTabPageData
>> maPageList
;
39 OString m_sCurrentPageId
;
41 Link
<VerticalTabControl
*, void> m_aActivateHdl
;
42 Link
<VerticalTabControl
*, bool> m_aDeactivateHdl
;
44 DECL_LINK(ChosePageHdl_Impl
, SvtIconChoiceCtrl
*, void);
47 bool DeactivatePage();
49 VerticalTabPageData
* GetPageData(std::string_view rId
) const;
50 VerticalTabPageData
* GetPageData(const SvxIconChoiceCtrlEntry
* pEntry
) const;
53 VerticalTabControl(vcl::Window
* pParent
);
54 virtual ~VerticalTabControl() override
;
55 virtual void dispose() override
;
57 sal_uInt16
GetPageCount() const { return m_xChooser
->GetEntryCount(); }
59 const OString
& GetCurPageId() const { return m_sCurrentPageId
; }
60 void SetCurPageId(const OString
& rId
);
62 sal_uInt16
GetPagePos(std::string_view rPageId
) const;
63 const OString
& GetPageId(sal_uInt16 nIndex
) const;
64 VclPtr
<vcl::Window
> GetPage(std::string_view rPageId
) const;
66 void RemovePage(std::string_view rPageId
);
67 void InsertPage(const OString
& rPageId
, const OUString
& rLabel
, const Image
& rImage
,
68 const OUString
& rTooltip
, VclPtr
<vcl::Window
> xPage
, int nPos
= -1);
70 void SetActivatePageHdl(const Link
<VerticalTabControl
*, void>& rLink
)
72 m_aActivateHdl
= rLink
;
74 void SetDeactivatePageHdl(const Link
<VerticalTabControl
*, bool>& rLink
)
76 m_aDeactivateHdl
= rLink
;
79 OUString
GetPageText(std::string_view rPageId
) const;
80 void SetPageText(std::string_view rPageId
, const OUString
& rText
);
82 vcl::Window
* GetPageParent() { return m_xBox
.get(); }
84 virtual void DumpAsPropertyTree(tools::JsonWriter
& rJsonWriter
) override
;
86 virtual FactoryFunction
GetUITestFactory() const override
;
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */