File indexing completed on 2025-03-09 03:58:29

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2008-08-20
0007  * Description : A widget stack to embed editor view.
0008  *
0009  * SPDX-FileCopyrightText: 2008-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_IMAGE_EDITOR_STACK_VIEW_H
0016 #define DIGIKAM_IMAGE_EDITOR_STACK_VIEW_H
0017 
0018 // Qt includes
0019 
0020 #include <QStackedWidget>
0021 
0022 // Local includes
0023 
0024 #include "digikam_export.h"
0025 
0026 namespace Digikam
0027 {
0028 
0029 class Canvas;
0030 class GraphicsDImgView;
0031 
0032 class DIGIKAM_EXPORT EditorStackView : public QStackedWidget
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037 
0038     enum StackViewMode
0039     {
0040         CanvasMode = 0,
0041         ToolViewMode
0042     };
0043 
0044 public:
0045 
0046     explicit EditorStackView(QWidget* const parent = nullptr);
0047     ~EditorStackView()                                    override;
0048 
0049     void     setCanvas(Canvas* const canvas);
0050     Canvas*  canvas()                               const;
0051 
0052     void     setToolView(QWidget* const view);
0053     QWidget* toolView()                             const;
0054 
0055     void     setViewMode(int mode);
0056     int      viewMode()                             const;
0057 
0058     void     increaseZoom();
0059     void     decreaseZoom();
0060     void     toggleFitToWindow();
0061     void     fitToSelect();
0062     void     zoomTo100Percent();
0063 
0064     double   zoomMax()                              const;
0065     double   zoomMin()                              const;
0066     bool     isZoomablePreview()                    const;
0067 
0068 Q_SIGNALS:
0069 
0070     void signalZoomChanged(bool isMax, bool isMin, double zoom);
0071     void signalToggleOffFitToWindow();
0072 
0073 public Q_SLOTS:
0074 
0075     void setZoomFactor(double);
0076     void slotZoomSliderChanged(int);
0077 
0078 private Q_SLOTS:
0079 
0080     void slotZoomChanged(double);
0081     void slotToggleOffFitToWindow(bool);
0082 
0083 private:
0084 
0085     GraphicsDImgView* previewWidget()               const;
0086 
0087 private:
0088 
0089     class Private;
0090     Private* const d;
0091 };
0092 
0093 } // namespace Digikam
0094 
0095 #endif // DIGIKAM_IMAGE_EDITOR_STACK_VIEW_H