1/************************************************************************ 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27#ifndef __com_sun_star_awt_tree_TreeControl_idl__ 28#define __com_sun_star_awt_tree_TreeControl_idl__ 29 30#ifndef __com_sun_star_awt_tree_XTreeControl_idl__ 31#include <com/sun/star/awt/tree/XTreeControl.idl> 32#endif 33 34//============================================================================= 35 36module com { module sun { module star { module awt { module tree { 37 38//============================================================================= 39 40/** A control that displays a set of hierarchical data as an outline. 41 42 <p> 43 <h4>The Data Model</h4> 44 <p>A specific node in a tree is identified by a <type>XTreeNode</type>. 45 A leaf node is a node without any children and that returns <FALSE/> when calling <member>XTreeNode::hasChildrenOnDemand()</member>. 46 An expanded node is a non-leaf node that will displays its children when all its ancestors are expanded. 47 A collapsed node is one which hides them. 48 A node is visible when all parent nodes are expanded and the node itself is in the display area. 49 </p> 50 51 <p>The nodes are retrieved from a <type>XTreeDataModel</type>. 52 You can implement it yourself or use the <type>MutableTreeDataModel</type> 53 which uses <type>XMutableTreeNode</type> and <type>XMutableTreeDataModel</type> 54 for a simple and mutable data model. 55 56 <p>The data model must be set at the <member>TreeControlModel::TreeDataModel</member> property.</p> 57 58 <h4>Selection</h4> 59 <p>If you are interested in knowing when the selection changes implement a 60 <type scope="com::sun::star::view">XSelectionChangeListener</type> and add the instance with the method 61 <member scope="::com::sun::star::view">XSelectionSupplier::addSelectionChangeListener()</member>. 62 You than will be notified for any selection change. 63 </p> 64 65 <p> 66 If you are interested in detecting either double-click events or when a user clicks on a node, 67 regardless of whether or not it was selected, you can get the <type scope="com::sun::star::awt">XWindow</type> 68 and add yourself as a <type scope="com::sun::star::awt">XMouseClickHandler</type>. You can use the 69 method <member>XTreeControl::getNodeForLocation()</member> to retrieve the node that was under the 70 mouse at the time the event was fired. 71 </p> 72 73 <h4>Adding child nodes on demand</h4> 74 <p>If you want to add child nodes to your tree on demand you can do the following. 75 <ul> 76 <li>Make sure the parent node returns <TRUE/> for <member>XTreeNode::hasChildrenOnDemand()</member> either 77 by implementing <type>XTreeNode</type> yourself or if you use the <type>MutableTreeDataModel</type>, 78 use <member>XMutableTreeNode::setHasChildrenOnDemand()</member>.</li> 79 <li>Implement a <type>XTreeExpansionListener</type> and add the instance with the method 80 <member>XTreeControl::addTreeExpansionListener()</member>.</li> 81 </ul> 82 Now you get called when the node will become expanded or collapsed. 83 So on <member>XTreeExpansionListener::treeExpanding()</member> you can 84 check the <type>TreeExpansionEvent</type> if the parent node with children on demand is going to 85 be expanded and in that case add the missing child nodes. You can also veto the expansion or 86 collapsing of a parent node by using the <type>ExpandVetoException</type>. 87 </p> 88 */ 89service TreeControl: XTreeControl 90{ 91}; 92 93//============================================================================= 94 95}; }; }; }; }; 96 97#endif 98