OSDN Git Service

13bf704c6690b370f8fdd5f73cce5edfcab16ce1
[qt-creator-jp/qt-creator-jp.git] / src / plugins / imageviewer / imageviewer.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 ** Copyright (c) 2010 Denis Mingulov.
7 **
8 ** Contact: Nokia Corporation (qt-info@nokia.com)
9 **
10 ** No Commercial Usage
11 **
12 ** This file contains pre-release code and may not be distributed.
13 ** You may use this file in accordance with the terms and conditions
14 ** contained in the Technology Preview License Agreement accompanying
15 ** this package.
16 **
17 ** GNU Lesser General Public License Usage
18 **
19 ** Alternatively, this file may be used under the terms of the GNU Lesser
20 ** General Public License version 2.1 as published by the Free Software
21 ** Foundation and appearing in the file LICENSE.LGPL included in the
22 ** packaging of this file.  Please review the following information to
23 ** ensure the GNU Lesser General Public License version 2.1 requirements
24 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 **
26 ** In addition, as a special exception, Nokia gives you certain additional
27 ** rights.  These rights are described in the Nokia Qt LGPL Exception
28 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 **
30 ** If you have questions regarding the use of this file, please contact
31 ** Nokia at qt-info@nokia.com.
32 **
33 **************************************************************************/
34
35 #ifndef IMAGEVIEWER_H
36 #define IMAGEVIEWER_H
37
38 #include <coreplugin/editormanager/ieditor.h>
39 #include <coreplugin/ifile.h>
40
41 #include <QtCore/QScopedPointer>
42 #include <QtCore/QStringList>
43
44 QT_FORWARD_DECLARE_CLASS(QAbstractButton)
45 QT_FORWARD_DECLARE_CLASS(QAction)
46
47 namespace ImageViewer {
48 namespace Internal {
49 class ImageViewerFile;
50
51 class ImageViewer : public Core::IEditor
52 {
53     Q_OBJECT
54     Q_DISABLE_COPY(ImageViewer)
55 public:
56     explicit ImageViewer(QWidget *parent = 0);
57     ~ImageViewer();
58
59     Core::Context context() const;
60     QWidget *widget();
61
62     bool createNew(const QString &contents = QString());
63     bool open(const QString &fileName = QString());
64     Core::IFile *file();
65     QString id() const;
66     QString displayName() const;
67     void setDisplayName(const QString &title);
68
69     bool duplicateSupported() const;
70     IEditor *duplicate(QWidget *parent);
71
72     QByteArray saveState() const;
73     bool restoreState(const QByteArray &state);
74
75     int currentLine() const;
76     int currentColumn() const;
77
78     bool isTemporary() const;
79
80     QWidget *toolBar();
81
82 public slots:
83     void scaleFactorUpdate(qreal factor);
84
85     void switchViewBackground();
86     void switchViewOutline();
87     void zoomIn();
88     void zoomOut();
89     void resetToOriginalSize();
90     void fitToScreen();
91
92 private:
93     /*!
94       \brief Try to change button's icon to the one from the current theme.
95       \param button Button where an icon should be changed
96       \param name Icon name in the in the current icon theme
97       \return true if icon is updated, false otherwise
98      */
99     bool updateButtonIconByTheme(QAbstractButton *button, const QString &name);
100
101 private:
102     QScopedPointer<struct ImageViewerPrivate> d_ptr;
103 };
104
105 } // namespace Internal
106 } // namespace ImageViewer
107
108 #endif // IMAGEVIEWER_H