/* -*- c++ -*- */
/*
 * Copyright 2011,2012 Free Software Foundation, Inc.
 *
 * This file is part of GNU Radio
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 */

#ifndef INCLUDED_QTGUI_UTILS_H
#define INCLUDED_QTGUI_UTILS_H

#include <gnuradio/qtgui/api.h>
#include <qevent.h>
#include <qwt_picker_machine.h>
#include <qwt_plot_picker.h>
#include <QCoreApplication>
#include <QString>

/*!
 * From QSS file name, extracts the file contents and returns a
 * QString that contains the QSS information. Designed to be passed to
 * the qApplication. The QSS file is typically retrieved using the
 * [qtgui] qss=\<filename\> section of the preferences files.
 */
QTGUI_API QString get_qt_style_sheet(QString filename);

class QTGUI_API QwtDblClickPlotPicker : public QwtPlotPicker
{
public:
    QwtDblClickPlotPicker(QWidget*);
    ~QwtDblClickPlotPicker() override;

    virtual QwtPickerMachine* stateMachine(int) const;
};

class QTGUI_API QwtPickerDblClickPointMachine : public QwtPickerMachine
{
public:
    QwtPickerDblClickPointMachine();
    ~QwtPickerDblClickPointMachine() override;

    QList<QwtPickerMachine::Command> transition(const QwtEventPattern& eventPattern,
                                                const QEvent* e) override;
};

QTGUI_API void check_set_qss(QApplication* app);

#endif /* INCLUDED_QTGUI_UTILS_H */
