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/.
10 #include "templatesearchview.hxx"
11 #include "templatesearchviewitem.hxx"
13 #include <vcl/builderfactory.hxx>
15 TemplateSearchView::TemplateSearchView (vcl::Window
*pParent
, WinBits nWinStyle
)
16 : ThumbnailView(pParent
,nWinStyle
)
20 VCL_BUILDER_FACTORY(TemplateSearchView
)
22 void TemplateSearchView::setOpenTemplateHdl(const Link
<> &rLink
)
24 maOpenTemplateHdl
= rLink
;
27 void TemplateSearchView::OnItemDblClicked (ThumbnailViewItem
*pItem
)
29 maOpenTemplateHdl
.Call(pItem
);
32 void TemplateSearchView::AppendItem(sal_uInt16 nAssocItemId
, sal_uInt16 nRegionId
, sal_uInt16 nIdx
,
33 const OUString
&rTitle
, const OUString
&rSubtitle
,
34 const OUString
&rPath
,
35 const BitmapEx
&rImage
)
37 TemplateSearchViewItem
*pItem
= new TemplateSearchViewItem(*this, getNextItemId());
38 pItem
->mnAssocId
= nAssocItemId
;
39 pItem
->mnDocId
= nIdx
;
40 pItem
->mnRegionId
= nRegionId
;
41 pItem
->maPreview1
= rImage
;
42 pItem
->maTitle
= rTitle
;
43 pItem
->setSubTitle(rSubtitle
);
44 pItem
->setPath(rPath
);
45 pItem
->setSelectClickHdl(LINK(this,ThumbnailView
,OnItemSelected
));
47 ThumbnailView::AppendItem(pItem
);
49 CalculateItemPositions();
52 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */