summaryrefslogtreecommitdiffstats
path: root/src/simplemainwindow.h
blob: 39f23ff6f15cb2ac5d302be83a2862d101b88f3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/***************************************************************************
 *   Copyright (C) 2005 by Alexander Dymo                                  *
 *   adymo@kdevelop.org                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU Library General Public     *
 *   License along with this program; if not, write to the                 *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
 ***************************************************************************/
#ifndef SIMPLEMAINWINDOW_H
#define SIMPLEMAINWINDOW_H

#include <dmainwindow.h>
#include <kdevplugin.h>
#include <kdevmainwindow.h>
#include <kdevpartcontroller.h>

class KAction;
class QPopupMenu;
class MainWindowShare;
class Context;

namespace KParts {
    class ReadOnlyPart;
}

class SimpleMainWindow: public DMainWindow, public KDevMainWindow {
    Q_OBJECT
public:
    SimpleMainWindow(QWidget* parent = 0, const char *name = 0);
    virtual ~SimpleMainWindow();

    virtual void embedPartView(QWidget *view, const QString &title, const QString& toolTip = QString::null);
    virtual void embedSelectView(QWidget *view, const QString &title, const QString &toolTip);
    virtual void embedOutputView(QWidget *view, const QString &title, const QString &toolTip);
    virtual void embedSelectViewRight(QWidget* view, const QString& title, const QString &toolTip);

    virtual void removeView(QWidget *view);
    virtual void setViewAvailable(QWidget *pView, bool bEnabled);
    virtual void raiseView(QWidget *view);
    virtual void lowerView(QWidget *view);

    virtual void loadSettings();
    virtual void saveSettings();
    virtual void setCurrentDocumentCaption( const QString &caption );

    virtual KMainWindow *main();

    void init();

public slots:
    void slotDropEvent( QDropEvent *event );
    void setCaption(const QString &);

protected:
    virtual bool queryClose();
    virtual bool queryExit();

protected slots:
    virtual void closeTab();
    virtual void closeTab(QWidget *w);
    virtual void tabContext(QWidget *w, const QPoint &p);
    void contextMenu(QPopupMenu *popupMenu, const Context *context);

private slots:
    void gotoNextWindow();
    void gotoPreviousWindow();
    void gotoFirstWindow();
    void gotoLastWindow();
    void switchToNextTabWidget();
    void slotCoreInitialized();
    void projectOpened();
    void projectClosed();
    void slotPartURLChanged(KParts::ReadOnlyPart *part);
    void activePartChanged(KParts::Part *part);
    void documentChangedState(const KURL &url, DocumentState state);
    void tabContextActivated(int);
    void configureToolbars();
    void slotNewToolbarConfig();
    void raiseEditor();
    void openURL(int w);
    void fillWindowMenu();
    void slotSplitVertical();
    void slotSplitHorizontal();
    void slotSplitVerticalBase();
    void slotSplitHorizontalBase();
    void createGUI(KParts::Part *part);
    void raiseBottomDock();
    void raiseLeftDock();
    void raiseRightDock();
    void raiseDock(DDockWindow *dock);
    void lowerAllDocks();

private:
    void createFramework();
    void createActions();
    void setupWindowMenu();
    void dragEnterEvent( QDragEnterEvent *event );
    void dropEvent( QDropEvent *event );
    void openDocumentsAfterSplit(DTabWidget *tab);
    QWidget *widgetForURL(KURL url);
    QWidget *widgetInTab(QWidget *w);
    KParts::ReadOnlyPart *activePartForSplitting();
    void embedView( DDockWindow::Position position, QWidget *view, const QString & title );
    DDockWindow::Position recallToolViewPosition( const QString & name, DDockWindow::Position defaultPos );
    void rememberToolViewPosition( const QString & name, DDockWindow::Position pos );

    MainWindowShare *m_mainWindowShare;

    KURL m_currentTabURL;
    KAction *m_raiseEditor;
    KAction *m_lowerAllDocks;
    KAction *m_splitHor;
    KAction *m_splitVer;
    KAction *m_splitHor1;
    KAction *m_splitVer1;
    KAction *m_splitHor2;
    KAction *m_splitVer2;
    KAction *m_raiseBottomDock;
    KAction *m_raiseLeftDock;
    KAction *m_raiseRightDock;
    QPopupMenu *m_windowMenu;
    QValueList<QPair<int, KURL> > m_windowList;

    KURL::List m_splitURLs;
};

// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on

#endif