1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
30 using namespace ::com::sun::star::uno
;
31 using namespace ::com::sun::star::lang
;
34 DBTreeView::DBTreeView( vcl::Window
* pParent
, WinBits nBits
)
35 : Window( pParent
, nBits
)
36 , m_pTreeListBox(NULL
)
39 m_pTreeListBox
= VclPtr
<DBTreeListBox
>::Create(this, WB_BORDER
| WB_HASLINES
| WB_HASLINESATROOT
| WB_HASBUTTONS
| WB_HSCROLL
|WB_HASBUTTONSATROOT
);
40 m_pTreeListBox
->EnableCheckButton(NULL
);
41 m_pTreeListBox
->SetDragDropMode( DragDropMode::NONE
);
42 m_pTreeListBox
->EnableInplaceEditing( true );
43 m_pTreeListBox
->SetHelpId(HID_TLB_TREELISTBOX
);
44 m_pTreeListBox
->Show();
47 DBTreeView::~DBTreeView()
52 void DBTreeView::dispose()
56 if (m_pTreeListBox
->GetModel())
58 m_pTreeListBox
->GetModel()->RemoveView(m_pTreeListBox
);
59 m_pTreeListBox
->DisconnectFromModel();
62 m_pTreeListBox
.disposeAndClear();
63 vcl::Window::dispose();
66 void DBTreeView::SetPreExpandHandler(const Link
<>& _rHdl
)
68 m_pTreeListBox
->SetPreExpandHandler(_rHdl
);
71 void DBTreeView::setCopyHandler(const Link
<>& _rHdl
)
73 m_pTreeListBox
->setCopyHandler(_rHdl
);
76 void DBTreeView::Resize()
79 m_pTreeListBox
->SetPosSizePixel(Point(0,0),GetOutputSizePixel());
82 void DBTreeView::setModel(SvTreeList
* _pTreeModel
)
85 _pTreeModel
->InsertView(m_pTreeListBox
);
86 m_pTreeListBox
->SetModel(_pTreeModel
);
89 void DBTreeView::setSelChangeHdl( const Link
<>& _rHdl
)
91 m_pTreeListBox
->SetSelChangeHdl( _rHdl
);
94 void DBTreeView::GetFocus()
97 if ( m_pTreeListBox
)//&& !m_pTreeListBox->HasChildPathFocus())
98 m_pTreeListBox
->GrabFocus();
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */