Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / svx / checklbx.hxx
blobb096573280b0404bf49a5d4220abf90c31acf886
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef INCLUDED_SVX_CHECKLBX_HXX
20 #define INCLUDED_SVX_CHECKLBX_HXX
22 #include <rtl/ustring.hxx>
23 #include <sal/types.h>
24 #include <svtools/treelistbox.hxx>
25 #include <svx/svxdllapi.h>
26 #include <tools/contnr.hxx>
27 #include <tools/solar.h>
28 #include <tools/wintypes.hxx>
29 #include <vcl/event.hxx>
30 #include <vcl/window.hxx>
32 class Image;
33 class SvLBoxButtonData;
34 class SvTreeListEntry;
36 // class SvxCheckListBox -------------------------------------------------
38 class SVX_DLLPUBLIC SvxCheckListBox : public SvTreeListBox
40 using Window::GetText;
42 private:
43 SvLBoxButtonData* pCheckButton;
45 SVX_DLLPRIVATE void Init_Impl();
47 using SvTreeListBox::InsertEntry;
48 // Avoid ambiguity with new InsertEntry:
49 virtual SvTreeListEntry* InsertEntry( const OUString& rText, SvTreeListEntry* pParent,
50 bool bChildrenOnDemand,
51 sal_uIntPtr nPos, void* pUserData,
52 SvLBoxButtonKind eButtonKind ) override;
54 public:
55 SvxCheckListBox( vcl::Window* pParent, WinBits nWinStyle = 0 );
56 void SetNormalStaticImage(const Image& rNormalStaticImage);
57 virtual ~SvxCheckListBox() override;
58 virtual void dispose() override;
60 void InsertEntry ( const OUString& rStr,
61 sal_uLong nPos = TREELIST_APPEND,
62 void* pUserData = nullptr,
63 SvLBoxButtonKind eButtonKind = SvLBoxButtonKind::EnabledCheckbox );
64 void RemoveEntry ( sal_uLong nPos );
66 void SelectEntryPos ( sal_uLong nPos );
67 sal_uLong GetSelectEntryPos () const;
68 void* GetSelectEntryData () const { return GetEntryData(GetSelectEntryPos()); }
70 OUString GetText ( sal_uLong nPos ) const;
71 sal_uLong GetCheckedEntryCount() const;
72 void CheckEntryPos ( sal_uLong nPos, bool bCheck = true );
73 bool IsChecked ( sal_uLong nPos ) const;
74 void ToggleCheckButton ( SvTreeListEntry* pEntry );
76 void* SetEntryData ( sal_uLong nPos, void* pNewData );
77 void* GetEntryData ( sal_uLong nPos ) const;
79 virtual void MouseButtonDown ( const MouseEvent& rMEvt ) override;
80 virtual void KeyInput ( const KeyEvent& rKEvt ) override;
83 #endif
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */