]>
Commit | Line | Data |
---|---|---|
3eb29afd JH |
1 | /* |
2 | * This file is part of the PulseView project. | |
3 | * | |
4 | * Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; either version 2 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
19 | */ | |
20 | ||
7a01bd36 JH |
21 | #ifndef PULSEVIEW_PV_VIEW_ROWITEMPAINTPARAMS_HPP |
22 | #define PULSEVIEW_PV_VIEW_ROWITEMPAINTPARAMS_HPP | |
3eb29afd | 23 | |
60d9b99a JS |
24 | #include "pv/util.hpp" |
25 | ||
9ab27c43 JH |
26 | #include <QFont> |
27 | ||
3eb29afd JH |
28 | namespace pv { |
29 | namespace view { | |
30 | ||
5b5fa4da | 31 | class ViewItemPaintParams |
3eb29afd JH |
32 | { |
33 | public: | |
60d9b99a JS |
34 | ViewItemPaintParams( |
35 | const QRect &rect, double scale, const pv::util::Timestamp& offset); | |
3eb29afd | 36 | |
36e7001d JH |
37 | QRect rect() const { |
38 | return rect_; | |
3eb29afd JH |
39 | } |
40 | ||
4c8a6a6d JH |
41 | double scale() const { |
42 | return scale_; | |
43 | } | |
44 | ||
60d9b99a | 45 | const pv::util::Timestamp& offset() const { |
4c8a6a6d JH |
46 | return offset_; |
47 | } | |
48 | ||
36e7001d JH |
49 | int left() const { |
50 | return rect_.left(); | |
51 | } | |
52 | ||
53 | int right() const { | |
54 | return rect_.right(); | |
55 | } | |
56 | ||
57 | int top() const { | |
58 | return rect_.top(); | |
59 | } | |
60 | ||
61 | int bottom() const { | |
62 | return rect_.bottom(); | |
63 | } | |
64 | ||
3eb29afd | 65 | int width() const { |
36e7001d JH |
66 | return rect_.width(); |
67 | } | |
68 | ||
69 | int height() const { | |
0f954499 | 70 | return rect_.height(); |
3eb29afd JH |
71 | } |
72 | ||
4c8a6a6d | 73 | double pixels_offset() const { |
60d9b99a | 74 | return (offset_ / scale_).convert_to<double>(); |
4c8a6a6d JH |
75 | } |
76 | ||
9ab27c43 JH |
77 | public: |
78 | static QFont font(); | |
79 | ||
80 | static int text_height(); | |
81 | ||
3eb29afd | 82 | private: |
36e7001d | 83 | QRect rect_; |
4c8a6a6d | 84 | double scale_; |
60d9b99a | 85 | pv::util::Timestamp offset_; |
3eb29afd JH |
86 | }; |
87 | ||
88 | } // namespace view | |
89 | } // namespace pv | |
90 | ||
7a01bd36 | 91 | #endif // PULSEVIEW_PV_VIEW_ROWITEMPAINTPARAMS_HPP |