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 : #include "dbtreeview.hxx"
21 : #include <svtools/treelistbox.hxx>
22 : #include "dbtreelistbox.hxx"
23 : #include "dbtreemodel.hxx"
24 : #include "dbaccess_helpid.hrc"
25 : #include <boost/scoped_ptr.hpp>
26 :
27 : namespace dbaui
28 : {
29 :
30 : using namespace ::com::sun::star::uno;
31 : using namespace ::com::sun::star::lang;
32 :
33 : // class DBTreeView
34 1 : DBTreeView::DBTreeView( Window* pParent, WinBits nBits)
35 : : Window( pParent, nBits )
36 1 : , m_pTreeListBox(NULL)
37 : {
38 :
39 1 : m_pTreeListBox = new DBTreeListBox(this, WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT);
40 1 : m_pTreeListBox->EnableCheckButton(NULL);
41 1 : m_pTreeListBox->SetDragDropMode( 0 );
42 1 : m_pTreeListBox->EnableInplaceEditing( true );
43 1 : m_pTreeListBox->SetHelpId(HID_TLB_TREELISTBOX);
44 1 : m_pTreeListBox->Show();
45 1 : }
46 :
47 3 : DBTreeView::~DBTreeView()
48 : {
49 1 : if (m_pTreeListBox)
50 : {
51 1 : if (m_pTreeListBox->GetModel())
52 : {
53 1 : m_pTreeListBox->GetModel()->RemoveView(m_pTreeListBox);
54 1 : m_pTreeListBox->DisconnectFromModel();
55 : }
56 1 : boost::scoped_ptr<Window> aTemp(m_pTreeListBox);
57 1 : m_pTreeListBox = NULL;
58 : }
59 2 : }
60 :
61 1 : void DBTreeView::SetPreExpandHandler(const Link& _rHdl)
62 : {
63 1 : m_pTreeListBox->SetPreExpandHandler(_rHdl);
64 1 : }
65 :
66 1 : void DBTreeView::setCopyHandler(const Link& _rHdl)
67 : {
68 1 : m_pTreeListBox->setCopyHandler(_rHdl);
69 1 : }
70 :
71 7 : void DBTreeView::Resize()
72 : {
73 7 : Window::Resize();
74 7 : m_pTreeListBox->SetPosSizePixel(Point(0,0),GetOutputSizePixel());
75 7 : }
76 :
77 1 : void DBTreeView::setModel(SvTreeList* _pTreeModel)
78 : {
79 1 : if (_pTreeModel)
80 1 : _pTreeModel->InsertView(m_pTreeListBox);
81 1 : m_pTreeListBox->SetModel(_pTreeModel);
82 1 : }
83 :
84 1 : void DBTreeView::setSelChangeHdl( const Link& _rHdl )
85 : {
86 1 : m_pTreeListBox->SetSelChangeHdl( _rHdl );
87 1 : }
88 :
89 0 : void DBTreeView::GetFocus()
90 : {
91 0 : Window::GetFocus();
92 0 : if ( m_pTreeListBox )//&& !m_pTreeListBox->HasChildPathFocus())
93 0 : m_pTreeListBox->GrabFocus();
94 0 : }
95 :
96 : } // namespace dbaui
97 :
98 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|