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 <vcl/dllapi.h>
26 #include <vcl/toolkit/ivctrl.hxx>
27 #include <vcl/layout.hxx>
29 struct VerticalTabPageData
;
31 class VerticalTabControl final
: public VclHBox
33 VclPtr
<SvtIconChoiceCtrl
> m_xChooser
;
34 VclPtr
<VclVBox
> m_xBox
;
36 std::vector
<std::unique_ptr
<VerticalTabPageData
>> maPageList
;
37 OString m_sCurrentPageId
;
39 Link
<VerticalTabControl
*, void> m_aActivateHdl
;
40 Link
<VerticalTabControl
*, bool> m_aDeactivateHdl
;
42 DECL_LINK(ChosePageHdl_Impl
, SvtIconChoiceCtrl
*, void);
45 bool DeactivatePage();
47 VerticalTabPageData
* GetPageData(std::string_view rId
) const;
48 VerticalTabPageData
* GetPageData(const SvxIconChoiceCtrlEntry
* pEntry
) const;
51 VerticalTabControl(vcl::Window
* pParent
);
52 virtual ~VerticalTabControl() override
;
53 virtual void dispose() override
;
55 sal_uInt16
GetPageCount() const { return m_xChooser
->GetEntryCount(); }
57 const OString
& GetCurPageId() const { return m_sCurrentPageId
; }
58 void SetCurPageId(const OString
& rId
);
60 sal_uInt16
GetPagePos(std::string_view rPageId
) const;
61 const OString
& GetPageId(sal_uInt16 nIndex
) const;
62 VclPtr
<vcl::Window
> GetPage(std::string_view rPageId
) const;
64 void RemovePage(std::string_view rPageId
);
65 void InsertPage(const OString
& rPageId
, const OUString
& rLabel
, const Image
& rImage
,
66 const OUString
& rTooltip
, VclPtr
<vcl::Window
> xPage
, int nPos
= -1);
68 void SetActivatePageHdl(const Link
<VerticalTabControl
*, void>& rLink
)
70 m_aActivateHdl
= rLink
;
72 void SetDeactivatePageHdl(const Link
<VerticalTabControl
*, bool>& rLink
)
74 m_aDeactivateHdl
= rLink
;
77 OUString
GetPageText(std::string_view rPageId
) const;
78 void SetPageText(std::string_view rPageId
, const OUString
& rText
);
80 vcl::Window
* GetPageParent() { return m_xBox
.get(); }
82 virtual FactoryFunction
GetUITestFactory() const override
;
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */