Line data Source code
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 : #ifndef INCLUDED_SVX_CHECKLBX_HXX
20 : #define INCLUDED_SVX_CHECKLBX_HXX
21 :
22 : #include <svtools/treelistbox.hxx>
23 : #include <svtools/svlbitm.hxx>
24 :
25 : #include <svx/svxdllapi.h>
26 :
27 : // class SvxCheckListBox -------------------------------------------------
28 :
29 : class SVX_DLLPUBLIC SvxCheckListBox : public SvTreeListBox
30 : {
31 : using Window::GetText;
32 :
33 : private:
34 : SvLBoxButtonData* pCheckButton;
35 :
36 : SVX_DLLPRIVATE void Init_Impl();
37 :
38 : using SvTreeListBox::InsertEntry;
39 : // Avoid ambiguity with new InsertEntry:
40 : virtual SvTreeListEntry* InsertEntry( const OUString& rText, SvTreeListEntry* pParent,
41 : bool bChildrenOnDemand,
42 : sal_uIntPtr nPos, void* pUserData,
43 : SvLBoxButtonKind eButtonKind ) SAL_OVERRIDE;
44 :
45 : public:
46 : SvxCheckListBox( vcl::Window* pParent, WinBits nWinStyle = 0 );
47 : void SetNormalStaticImage(const Image& rNormalStaticImage);
48 : virtual ~SvxCheckListBox();
49 : virtual void dispose() SAL_OVERRIDE;
50 :
51 : void InsertEntry ( const OUString& rStr,
52 : sal_uLong nPos = TREELIST_APPEND,
53 : void* pUserData = NULL,
54 : SvLBoxButtonKind eButtonKind =
55 : SvLBoxButtonKind_enabledCheckbox );
56 : void RemoveEntry ( sal_uLong nPos );
57 :
58 : void SelectEntryPos ( sal_uLong nPos, bool bSelect = true );
59 : sal_uLong GetSelectEntryPos () const;
60 0 : void* GetSelectEntryData () const { return GetEntryData(GetSelectEntryPos()); }
61 :
62 : OUString GetText ( sal_uLong nPos ) const;
63 : sal_uLong GetCheckedEntryCount() const;
64 : void CheckEntryPos ( sal_uLong nPos, bool bCheck = true );
65 : bool IsChecked ( sal_uLong nPos ) const;
66 : void ToggleCheckButton ( SvTreeListEntry* pEntry );
67 :
68 : void* SetEntryData ( sal_uLong nPos, void* pNewData );
69 : void* GetEntryData ( sal_uLong nPos ) const;
70 :
71 : virtual void MouseButtonDown ( const MouseEvent& rMEvt ) SAL_OVERRIDE;
72 : virtual void KeyInput ( const KeyEvent& rKEvt ) SAL_OVERRIDE;
73 : };
74 :
75 : #endif
76 :
77 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|