/src/libreoffice/vcl/source/weld/IconView.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ |
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 | | |
10 | | #include <vcl/weld/IconView.hxx> |
11 | | |
12 | | namespace weld |
13 | | { |
14 | | tools::Rectangle IconView::get_rect(int pos) const |
15 | 0 | { |
16 | 0 | if (std::unique_ptr<weld::TreeIter> pIter = get_iterator(pos)) |
17 | 0 | return get_rect(*pIter); |
18 | | |
19 | 0 | return {}; |
20 | 0 | } |
21 | | |
22 | | std::unique_ptr<weld::TreeIter> IconView::get_item_at_pos(const Point& rPos) |
23 | 0 | { |
24 | 0 | std::unique_ptr<weld::TreeIter> pIter = make_iterator(); |
25 | 0 | bool bIterValid = get_iter_first(*pIter); |
26 | 0 | while (bIterValid) |
27 | 0 | { |
28 | 0 | if (get_rect(*pIter).Contains(rPos)) |
29 | 0 | return pIter; |
30 | | |
31 | 0 | bIterValid = iter_next_sibling(*pIter); |
32 | 0 | } |
33 | | |
34 | 0 | return {}; |
35 | 0 | } |
36 | | } |
37 | | |
38 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |