#include "scroll_tool.h"
#include <QApplication>
#include <QScreen>
#include <QDesktopWidget>
#include <QtX11Extras/QX11Info>
#include <X11/extensions/shape.h>

ScrollTool::ScrollTool(QObject *parent) : AbstractActionTool(parent)
{
    setObjectName("Kylin-screenshot_QPushButton_scrollTool");
}

bool ScrollTool::closeOnButtonPressed() const
{
    return false;
}

QIcon ScrollTool::icon(const QColor &background, bool inEditor) const
{
    Q_UNUSED(background);
    return inEditor ? QIcon(QStringLiteral(":/img/material/black/") + "scrollshot.svg")
        : QIcon(QStringLiteral(":/img/material/white/") + "scrollshot.png");
}

#ifdef SUPPORT_UKUI
QIcon ScrollTool::icon(const QColor &background, bool inEditor, const CaptureContext &context) const
{
    if ((context.style_name.compare("ukui-dark") == 0)
        || (context.style_name.compare("ukui-black") == 0)) {
        return inEditor ? QIcon(QStringLiteral(":/img/material/black/") + "scrollshot.svg")
               : QIcon(QStringLiteral(":/img/material/black/") + "scrollshot.svg");
    }

    return inEditor ? QIcon(QStringLiteral(":/img/material/black/") + "scrollshot.svg")
        : QIcon(QStringLiteral(":/img/material/white/") + "scrollshot.png");
}
#endif

QString ScrollTool::name() const
{
    return tr("scrollshot");
}

QString ScrollTool::nameID()
{
    return QLatin1String("");
}

QString ScrollTool::description() const
{
    return tr("Click to activate scroll screenshot mode");
}

CaptureTool *ScrollTool::copy(QObject *parent)
{
    return new ScrollTool(parent);
}

void ScrollTool::pressed(const CaptureContext &context)
{
    AbstractActionTool::pressed(context);
    return;
}
