xref: /aoo4110/main/dbaccess/source/ui/inc/marktree.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _DBAUI_MARKTREE_HXX_
25 #define _DBAUI_MARKTREE_HXX_
26 
27 #ifndef DBAUI_DBTREELISTBOX_HXX
28 #include "dbtreelistbox.hxx"
29 #endif
30 
31 
32 
33 //.........................................................................
34 namespace dbaui
35 {
36 //.........................................................................
37 
38 //========================================================================
39 //= OMarkableTreeListBox
40 //========================================================================
41 /** a tree list box where all entries can be marked (with a checkbox) and
42 	unmarked. In addition, inner nodes know a third state which applies
43 	if some, but not all of their descendants are marked.
44 */
45 class OMarkableTreeListBox : public DBTreeListBox
46 {
47 	SvLBoxButtonData*	m_pCheckButton;
48 	Link				m_aCheckButtonHandler;
49 
50 public:
51 	OMarkableTreeListBox( Window* pParent
52 							,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
53 							, WinBits nWinStyle=0 );
54 	OMarkableTreeListBox( Window* pParent
55 							,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
56 							, const ResId& rResId );
57 	~OMarkableTreeListBox();
58 
59 	virtual void    KeyInput( const KeyEvent& rKEvt );
60 	virtual void	CheckButtonHdl();
61 	void			CheckButtons();		// make the button states consistent (bottom-up)
62 
63 	/// the handler given is called whenever the check state of one or more items changed
SetCheckHandler(const Link & _rHdl)64 	void SetCheckHandler(const Link& _rHdl) { m_aCheckButtonHandler = _rHdl; }
65 
66 protected:
67 	virtual void Paint(const Rectangle& _rRect);
68 	virtual void checkedButton_noBroadcast(SvLBoxEntry* _pEntry);
69 
70 	SvButtonState	implDetermineState(SvLBoxEntry* _pEntry);
71 		// determines the check state of the given entry, by analyzing the states of all descendants
72 
73 private:
74 	void InitButtonData();
75 };
76 
77 //.........................................................................
78 }	// namespace dbaui
79 //.........................................................................
80 
81 #endif // _DBAUI_MARKTREE_HXX_
82 
83