File indexing completed on 2025-01-05 03:53:13
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2002-30-09 0007 * Description : a tool to print images 0008 * 0009 * SPDX-FileCopyrightText: 2002-2003 by Todd Shoemaker <todd at theshoemakers dot net> 0010 * SPDX-FileCopyrightText: 2007-2012 by Angelo Naselli <anaselli at linux dot it> 0011 * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #ifndef DIGIKAM_ADV_PRINT_CROP_FRAME_H 0018 #define DIGIKAM_ADV_PRINT_CROP_FRAME_H 0019 0020 // Qt includes 0021 0022 #include <QWidget> 0023 0024 class QResizeEvent; 0025 0026 namespace DigikamGenericPrintCreatorPlugin 0027 { 0028 0029 class AdvPrintPhoto; 0030 0031 class AdvPrintCropFrame : public QWidget 0032 { 0033 Q_OBJECT 0034 0035 public: 0036 0037 explicit AdvPrintCropFrame(QWidget* const parent); 0038 ~AdvPrintCropFrame() override; 0039 0040 void init(AdvPrintPhoto* const photo, 0041 int woutlay, 0042 int houtlay, 0043 bool autoRotate, 0044 bool paint); 0045 0046 void setColor(const QColor&); 0047 QColor color() const; 0048 0049 void drawCropRectangle(bool draw = true); 0050 0051 protected: 0052 0053 void paintEvent(QPaintEvent*) override; 0054 void mousePressEvent(QMouseEvent*) override; 0055 void mouseReleaseEvent(QMouseEvent*) override; 0056 void mouseMoveEvent(QMouseEvent*) override; 0057 void keyReleaseEvent(QKeyEvent*) override; 0058 0059 private: 0060 0061 QRect screenToPhotoRect(const QRect&) const; 0062 QRect photoToScreenRect(const QRect&) const; 0063 void resizeEvent(QResizeEvent*) override; 0064 void updateImage(); 0065 0066 private: 0067 0068 class Private; 0069 Private* const d; 0070 }; 0071 0072 } // Namespace Digikam 0073 0074 #endif // DIGIKAM_ADV_PRINT_CROP_FRAME_H