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 :
20 : #ifndef _DBAUI_MARKTREE_HXX_
21 : #define _DBAUI_MARKTREE_HXX_
22 :
23 : #include "dbtreelistbox.hxx"
24 :
25 : #include "svtools/svlbitm.hxx"
26 :
27 :
28 : //.........................................................................
29 : namespace dbaui
30 : {
31 : //.........................................................................
32 :
33 : //========================================================================
34 : //= OMarkableTreeListBox
35 : //========================================================================
36 : /** a tree list box where all entries can be marked (with a checkbox) and
37 : unmarked. In addition, inner nodes know a third state which applies
38 : if some, but not all of their descendants are marked.
39 : */
40 : class OMarkableTreeListBox : public DBTreeListBox
41 : {
42 : SvLBoxButtonData* m_pCheckButton;
43 : Link m_aCheckButtonHandler;
44 :
45 : public:
46 : OMarkableTreeListBox( Window* pParent
47 : ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
48 : , WinBits nWinStyle=0 );
49 : OMarkableTreeListBox( Window* pParent
50 : ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
51 : , const ResId& rResId );
52 : ~OMarkableTreeListBox();
53 :
54 : virtual void KeyInput( const KeyEvent& rKEvt );
55 : virtual void CheckButtonHdl();
56 : void CheckButtons(); // make the button states consistent (bottom-up)
57 :
58 : /// the handler given is called whenever the check state of one or more items changed
59 0 : void SetCheckHandler(const Link& _rHdl) { m_aCheckButtonHandler = _rHdl; }
60 :
61 : protected:
62 : virtual void Paint(const Rectangle& _rRect);
63 : virtual void checkedButton_noBroadcast(SvTreeListEntry* _pEntry);
64 :
65 : SvButtonState implDetermineState(SvTreeListEntry* _pEntry);
66 : // determines the check state of the given entry, by analyzing the states of all descendants
67 :
68 : private:
69 : void InitButtonData();
70 : };
71 :
72 : //.........................................................................
73 : } // namespace dbaui
74 : //.........................................................................
75 :
76 : #endif // _DBAUI_MARKTREE_HXX_
77 :
78 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|