OSDN Git Service

It's 2011 now.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / coreplugin / outputpanemanager.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef OUTPUTPANEMANAGER_H
35 #define OUTPUTPANEMANAGER_H
36
37 #include <QtCore/QMap>
38 #include <QtGui/QPushButton>
39
40 QT_BEGIN_NAMESPACE
41 class QAction;
42 class QComboBox;
43 class QToolButton;
44 class QStackedWidget;
45 class QSplitter;
46 QT_END_NAMESPACE
47
48 namespace Core {
49
50 class IMode;
51 class IOutputPane;
52
53 namespace Internal {
54 class OutputPaneManager;
55 class MainWindow;
56 }
57
58 namespace Internal {
59
60 class OutputPaneManager : public QWidget
61 {
62     Q_OBJECT
63
64 public:
65     void init();
66     static OutputPaneManager *instance();
67     void setCloseable(bool b);
68     bool closeable();
69     QWidget *buttonsWidget();
70     void updateStatusButtons(bool visible);
71
72     bool isMaximized()const;
73
74 public slots:
75     void slotHide();
76     void slotNext();
77     void slotPrev();
78     void shortcutTriggered();
79     void slotMinMax();
80
81 protected:
82     void focusInEvent(QFocusEvent *e);
83
84 private slots:
85     void changePage();
86     void showPage(bool focus);
87     void togglePage(bool focus);
88     void clearPage();
89     void buttonTriggered();
90     void updateNavigateState();
91
92 private:
93     // the only class that is allowed to create and destroy
94     friend class MainWindow;
95
96     static void create();
97     static void destroy();
98
99     explicit OutputPaneManager(QWidget *parent = 0);
100     ~OutputPaneManager();
101
102     void showPage(int idx, bool focus);
103     void ensurePageVisible(int idx);
104     int findIndexForPage(IOutputPane *out);
105     QComboBox *m_widgetComboBox;
106     QToolButton *m_clearButton;
107     QToolButton *m_closeButton;
108
109     QAction *m_minMaxAction;
110     QToolButton *m_minMaxButton;
111
112     QAction *m_nextAction;
113     QAction *m_prevAction;
114     QToolButton *m_prevToolButton;
115     QToolButton *m_nextToolButton;
116     QWidget *m_toolBar;
117
118     QMap<int, Core::IOutputPane*> m_pageMap;
119     int m_lastIndex;
120
121     QStackedWidget *m_outputWidgetPane;
122     QStackedWidget *m_opToolBarWidgets;
123     QWidget *m_buttonsWidget;
124     QMap<int, QPushButton *> m_buttons;
125     QMap<QAction *, int> m_actions;
126     QPixmap m_minimizeIcon;
127     QPixmap m_maximizeIcon;
128     bool m_maximised;
129 };
130
131 class OutputPaneToggleButton : public QPushButton
132 {
133     Q_OBJECT
134 public:
135     OutputPaneToggleButton(int number, const QString &text, QAction *action,
136                            QWidget *parent = 0);
137     QSize sizeHint() const;
138     void paintEvent(QPaintEvent *event);
139
140 private slots:
141     void updateToolTip();
142
143 private:
144     QString m_number;
145     QString m_text;
146     QAction *m_action;
147 };
148
149 } // namespace Internal
150 } // namespace Core
151
152 #endif // OUTPUTPANEMANAGER_H