]> sigrok.org Git - pulseview.git/blame_incremental - pv/views/trace/viewitem.cpp
Implement expansion marker animation and its infrastructure
[pulseview.git] / pv / views / trace / viewitem.cpp
... / ...
CommitLineData
1/*
2 * This file is part of the PulseView project.
3 *
4 * Copyright (C) 2013 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, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "viewitem.hpp"
21
22#include <climits>
23
24#include <QApplication>
25#include <QMenu>
26#include <QPalette>
27
28namespace pv {
29namespace views {
30namespace trace {
31
32const QSizeF ViewItem::LabelPadding(4, 0);
33const int ViewItem::HighlightRadius = 3;
34
35ViewItem::ViewItem() :
36 context_parent_(nullptr),
37 drag_point_(INT_MIN, INT_MIN),
38 selected_(false)
39{
40}
41
42bool ViewItem::is_selectable(QPoint pos) const
43{
44 (void)pos;
45 return true;
46}
47
48bool ViewItem::selected() const
49{
50 return selected_;
51}
52
53void ViewItem::select(bool select)
54{
55 selected_ = select;
56}
57
58bool ViewItem::is_draggable(QPoint pos) const
59{
60 (void)pos;
61 return true;
62}
63
64bool ViewItem::dragging() const
65{
66 return drag_point_.x() != INT_MIN && drag_point_.y() != INT_MIN;
67}
68
69void ViewItem::drag()
70{
71 drag_point_ = drag_point(QRect());
72}
73
74void ViewItem::drag_release()
75{
76 drag_point_ = QPoint(INT_MIN, INT_MIN);
77}
78
79QRectF ViewItem::label_rect(const QRectF &rect) const
80{
81 (void)rect;
82 return QRectF();
83}
84
85QRectF ViewItem::hit_box_rect(const ViewItemPaintParams &pp) const
86{
87 (void)pp;
88 return QRectF();
89}
90
91QMenu* ViewItem::create_header_context_menu(QWidget *parent)
92{
93 context_parent_ = parent;
94 return new QMenu(parent);
95}
96
97QMenu* ViewItem::create_view_context_menu(QWidget *parent, QPoint &click_pos)
98{
99 (void)parent;
100 (void)click_pos;
101 return nullptr;
102}
103
104widgets::Popup* ViewItem::create_popup(QWidget *parent)
105{
106 (void)parent;
107 return nullptr;
108}
109
110void ViewItem::delete_pressed()
111{
112}
113
114QPen ViewItem::highlight_pen()
115{
116 return QPen(QApplication::palette().brush(
117 QPalette::Highlight), HighlightRadius * 2,
118 Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
119}
120
121void ViewItem::paint_label(QPainter &p, const QRect &rect, bool hover)
122{
123 (void)p;
124 (void)rect;
125 (void)hover;
126}
127
128void ViewItem::paint_back(QPainter &p, ViewItemPaintParams &pp)
129{
130 (void)p;
131 (void)pp;
132}
133
134void ViewItem::paint_mid(QPainter &p, ViewItemPaintParams &pp)
135{
136 (void)p;
137 (void)pp;
138}
139
140void ViewItem::paint_fore(QPainter &p, ViewItemPaintParams &pp)
141{
142 (void)p;
143 (void)pp;
144}
145
146QColor ViewItem::select_text_color(QColor background)
147{
148 return (background.lightness() > 110) ? Qt::black : Qt::white;
149}
150
151void ViewItem::hover_point_changed(const QPoint &hp)
152{
153 (void)hp;
154}
155
156void ViewItem::mouse_left_press_event(const QMouseEvent* event)
157{
158 (void)event;
159}
160
161} // namespace trace
162} // namespace views
163} // namespace pv