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