LibreOffice Module vcl (master)  1
verticaltabctrl.hxx
Go to the documentation of this file.
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 <memory>
23 #include <string_view>
24 
25 #include <vcl/dllapi.h>
26 #include <vcl/toolkit/ivctrl.hxx>
27 #include <vcl/layout.hxx>
28 
29 struct VerticalTabPageData;
30 
31 class VerticalTabControl final : public VclHBox
32 {
35 
36  std::vector<std::unique_ptr<VerticalTabPageData>> maPageList;
38 
41 
42  DECL_LINK(ChosePageHdl_Impl, SvtIconChoiceCtrl*, void);
43 
44  void ActivatePage();
45  bool DeactivatePage();
46 
47  VerticalTabPageData* GetPageData(std::string_view rId) const;
49 
50 public:
52  virtual ~VerticalTabControl() override;
53  virtual void dispose() override;
54 
55  sal_uInt16 GetPageCount() const { return m_xChooser->GetEntryCount(); }
56 
57  const OString& GetCurPageId() const { return m_sCurrentPageId; }
58  void SetCurPageId(const OString& rId);
59 
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);
63 
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);
67 
69  {
70  m_aActivateHdl = rLink;
71  }
73  {
74  m_aDeactivateHdl = rLink;
75  }
76 
77  OUString GetPageText(std::string_view rPageId) const;
78  void SetPageText(std::string_view rPageId, const OUString& rText);
79 
80  vcl::Window* GetPageParent() { return m_xBox.get(); }
81 
82  virtual FactoryFunction GetUITestFactory() const override;
83 };
84 
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const OString & GetCurPageId() const
VerticalTabControl(vcl::Window *pParent)
Definition: ivctrl.cxx:438
void RemovePage(std::string_view rPageId)
Definition: ivctrl.cxx:582
DECL_LINK(ChosePageHdl_Impl, SvtIconChoiceCtrl *, void)
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
Link< VerticalTabControl *, void > m_aActivateHdl
virtual ~VerticalTabControl() override
Definition: ivctrl.cxx:460
VerticalTabPageData * GetPageData(std::string_view rId) const
Definition: ivctrl.cxx:508
sal_uInt16 GetPagePos(std::string_view rPageId) const
Definition: ivctrl.cxx:598
void SetPageText(std::string_view rPageId, const OUString &rText)
Definition: ivctrl.cxx:622
VclPtr< vcl::Window > GetPage(std::string_view rPageId)
Definition: ivctrl.cxx:606
void SetCurPageId(const OString &rId)
Definition: ivctrl.cxx:522
VclPtr< VclVBox > m_xBox
sal_Int32 GetEntryCount() const
Definition: ivctrl.cxx:264
Link< VerticalTabControl *, bool > m_aDeactivateHdl
VclPtr< SvtIconChoiceCtrl > m_xChooser
void ActivatePage()
Definition: ivctrl.cxx:484
void InsertPage(const OString &rPageId, const OUString &rLabel, const Image &rImage, const OUString &rTooltip, VclPtr< vcl::Window > xPage, int nPos=-1)
Definition: ivctrl.cxx:555
const OString & GetPageId(sal_uInt16 nIndex) const
Definition: ivctrl.cxx:550
void SetActivatePageHdl(const Link< VerticalTabControl *, void > &rLink)
Definition: image.hxx:39
void SetDeactivatePageHdl(const Link< VerticalTabControl *, bool > &rLink)
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
virtual FactoryFunction GetUITestFactory() const override
Definition: ivctrl.cxx:630
OUString GetPageText(std::string_view rPageId) const
Definition: ivctrl.cxx:614
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: ivctrl.cxx:465
sal_uInt16 GetPageCount() const
vcl::Window * GetPageParent()
std::vector< std::unique_ptr< VerticalTabPageData > > maPageList
bool DeactivatePage()
Definition: ivctrl.cxx:489