1 /*
2 * widget.cc
3 * Copyright 2015 John Lindgren
4 *
5 * This file is part of Audacious.
6 *
7 * Audacious is free software: you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License as published by the Free Software
9 * Foundation, version 2 or version 3 of the License.
10 *
11 * Audacious is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * Audacious. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * The Audacious team does not consider modular code linking to Audacious or
19 * using our public API to be a derived work.
20 */
21
22 #include "widget.h"
23
add_input(int width,int height,bool track_motion,bool drawable)24 void Widget::add_input (int width, int height, bool track_motion, bool drawable)
25 {
26 resize (width, height);
27 setMouseTracking (track_motion);
28 m_drawable = drawable;
29 }
30
add_drawable(int width,int height)31 void Widget::add_drawable (int width, int height)
32 {
33 resize (width, height);
34 m_drawable = true;
35 }
36
paintEvent(QPaintEvent *)37 void Widget::paintEvent (QPaintEvent *)
38 {
39 if (m_drawable)
40 {
41 QPainter p (this);
42 if (m_scale != 1)
43 p.setTransform (QTransform ().scale (m_scale, m_scale));
44
45 draw (p);
46 }
47 }
48