summaryrefslogtreecommitdiffstats
path: root/src/simplemainwindow.h
blob: 684f4839ecdb52be4523e8446f470989b0a55903 (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                                  *
 *   [email protected]                                                    *
 *                                                                         *
 *   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 TQPopupMenu;
class MainWindowShare;
class Context;

namespace KParts {
    class ReadOnlyPart;
}

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

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

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

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

    virtual KMainWindow *main();

    void init();

public slots:
    void slotDropEvent( TQDropEvent *event );
    void setCaption(const TQString &);

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

protected slots:
    virtual void closeTab();
    virtual void closeTab(TQWidget *w);
    virtual void tabContext(TQWidget *w, const TQPoint &p);
    void contextMenu(TQPopupMenu *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( TQDragEnterEvent *event );
    void dropEvent( TQDropEvent *event );
    void openDocumentsAfterSplit(DTabWidget *tab);
    TQWidget *widgetForURL(KURL url);
    TQWidget *widgetInTab(TQWidget *w);
    KParts::ReadOnlyPart *activePartForSplitting();
    void embedView( DDockWindow::Position position, TQWidget *view, const TQString & title );
    DDockWindow::Position recallToolViewPosition( const TQString & name, DDockWindow::Position defaultPos );
    void rememberToolViewPosition( const TQString & 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;
    TQPopupMenu *m_windowMenu;
    TQValueList<QPair<int, KURL> > m_windowList;

    KURL::List m_splitURLs;
};

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

#endif