summaryrefslogtreecommitdiffstats
path: root/src/newui/dmainwindow.h
blob: 8745c454aa34e89239032d51734c2607eecbd1f8 (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
/***************************************************************************
 *   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 DMAINWINDOW_H
#define DMAINWINDOW_H

#include <kxmlguiclient.h>
#include <tdeparts/mainwindow.h>

#include "ddockwindow.h"

class DTabWidget;
namespace Ideal {
    class DockSplitter;
}

/**Main window which provides simplified IDEA mode.*/
class DMainWindow: public KParts::MainWindow {
    TQ_OBJECT
  
public:
    DMainWindow(TQWidget *parent = 0, const char *name = 0);
    virtual ~DMainWindow();

    /**@return The tool window in given @p position.*/
    DDockWindow *toolWindow(DDockWindow::Position position) const;

    /**Adds a tabbed widget into the active (focused) tab widget.
    If @p widget is null then only tab is created.*/
    virtual void addWidget(TQWidget *widget, const TQString &title);
    virtual void addWidget(DTabWidget *tab, TQWidget *widget, const TQString &title);
    /**Removes widget. Does not delete it.*/
    virtual void removeWidget(TQWidget *widget);
   /**Moves a widget from an existing dockposition to a new position**/
    virtual void moveWidget(DDockWindow::Position newPosition, TQWidget *widget, const TQString & title);

    /**Adds a dock widget into given position.*/
    virtual void addDockWidget(DDockWindow::Position position, TQWidget *view, const TQString &title);
    /**Removes a dock widget.*/
    virtual void removeDockWidget(TQWidget *view);

    virtual void saveSettings();

    bool hasDockWidget(TQWidget *view);
    DDockWindow::Position dockWidgetPosition(TQWidget *view);

public slots:
    DTabWidget *splitHorizontal();
    DTabWidget *splitVertical();

protected slots:
    /**This does nothing. Reimplement in subclass to close the tab
    when corner close button is pressed.*/
    virtual void closeTab();
    /**This does nothing. Reimplement in subclass to close the tab
    when hover close button is pressed.*/
    virtual void closeTab(TQWidget*);
    /**This does nothing. Reimplement in subclass to show tab context menu.*/
    virtual void tabContext(TQWidget*,const TQPoint &);

    void widgetDestroyed();

signals:
    void widgetChanged(TQWidget *);

protected:
    bool eventFilter(TQObject *obj, TQEvent *ev);

    virtual void loadSettings();

    virtual void createToolWindows();
    virtual DTabWidget *createTab();

    DDockWindow *m_leftDock;
    DDockWindow *m_rightDock;
    DDockWindow *m_bottomDock;

    TQMap<TQWidget*, DDockWindow::Position> m_docks;

    Ideal::DockSplitter *m_central;
    DTabWidget *m_activeTabWidget;

    TQValueList<DTabWidget*> m_tabs;

    bool m_openTabAfterCurrent;
    bool m_showIconsOnTabs;
    bool m_firstRemoved;

    TQValueList<TQWidget*> m_widgets;
    TQMap<TQWidget*, DTabWidget*> m_widgetTabs;
    TQWidget *m_currentWidget;

private slots:
    void invalidateActiveTabWidget();

};

#endif