~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to lib/qextmdi/kmdiguiclient.h

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2006-05-23 18:39:42 UTC
  • Revision ID: james.westby@ubuntu.com-20060523183942-hucifbvh68k2bwz7
Tags: upstream-3.3.2
Import upstream version 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE libraries
 
2
   Copyright (C) 2003 Joseph Wenninger
 
3
 
 
4
   This library is free software; you can redistribute it and/or
 
5
   modify it under the terms of the GNU Library General Public
 
6
   License version 2 as published by the Free Software Foundation.
 
7
 
 
8
   This library is distributed in the hope that it will be useful,
 
9
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
   Library General Public License for more details.
 
12
 
 
13
   You should have received a copy of the GNU Library General Public License
 
14
   along with this library; see the file COPYING.LIB.  If not, write to
 
15
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
16
   Boston, MA 02111-1307, USA.
 
17
*/
 
18
 
 
19
#ifndef KMDIGUICLIENT_H
 
20
#define KMDIGUICLIENT_H
 
21
 
 
22
#include <qobject.h>
 
23
#include <qguardedptr.h>
 
24
#include <kxmlguiclient.h>
 
25
#include <kaction.h>
 
26
#include "kmdidefines.h"
 
27
 
 
28
class KMainWindow;
 
29
class KToolBar;
 
30
class KMdiToolViewAccessor;
 
31
class KMdiMainFrm;
 
32
class KDockWidget;
 
33
 
 
34
namespace KMDIPrivate {
 
35
 
 
36
/**
 
37
 * A class derived from KXMLGUIClient that handles the various
 
38
 * KMDI modes
 
39
 */
 
40
class KMDI_EXPORT KMDIGUIClient : public QObject,
 
41
                       public KXMLGUIClient
 
42
{
 
43
    Q_OBJECT
 
44
public:
 
45
 
 
46
    KMDIGUIClient( KMdiMainFrm *mdiMainFrm, bool showMDIModeAction, const char *name = 0 );
 
47
    virtual ~KMDIGUIClient();
 
48
 
 
49
    /**
 
50
     * Add a new tool view to this KMDIGUIClient. Reads the shortcut
 
51
     * for the tool view from the KMDI application's config file and also
 
52
     * adds a ToggleToolViewAction so that the visibility of the toolviews
 
53
     * can be turned on and off
 
54
     */
 
55
    void addToolView(KMdiToolViewAccessor*);
 
56
 
 
57
private slots:
 
58
 
 
59
    /**
 
60
     * The XMLGUIClient factory has added an XMLGUI client. Plug our actions
 
61
     * in if we're the client that's been added.
 
62
     */
 
63
    void clientAdded( KXMLGUIClient *client );
 
64
    /**
 
65
     * Plug in the various toggle actions we have into the tool views menu
 
66
     */
 
67
    void setupActions();
 
68
 
 
69
    /**
 
70
     * Change the view mode. This will automatically change the view mode
 
71
     * of the KMdiMainFrm associated with this KMDIGUIClient
 
72
     */
 
73
    void changeViewMode(int id);
 
74
 
 
75
    /**
 
76
     * One of our tool view toggle actions has been deleted. Redo the
 
77
     * tool views menu
 
78
     */
 
79
    void actionDeleted(QObject*);
 
80
 
 
81
    /**
 
82
     * Updates the action that lets the user change the MDI mode to the
 
83
     * correct value based on the current mode
 
84
     */
 
85
    void mdiModeHasBeenChangedTo(KMdi::MdiMode);
 
86
 
 
87
signals:
 
88
    /** Toggle the top tool dock */
 
89
    void toggleTop();
 
90
 
 
91
    /** Toggle the left tool dock */
 
92
    void toggleLeft();
 
93
 
 
94
    /** Toggle the right tool dock */
 
95
    void toggleRight();
 
96
 
 
97
    /** Toggle the bottom tool dock */
 
98
    void toggleBottom();
 
99
 
 
100
private:
 
101
    class KMDIGUIClientPrivate;
 
102
    KMDIGUIClientPrivate *d;
 
103
    KMdi::MdiMode m_mdiMode;
 
104
 
 
105
    QGuardedPtr<KMdiMainFrm> m_mdiMainFrm;
 
106
    QPtrList<KAction> m_toolViewActions;
 
107
    QPtrList<KAction> m_documentViewActions;
 
108
 
 
109
    KActionMenu *m_docMenu;
 
110
    KActionMenu *m_toolMenu;
 
111
    KSelectAction *m_mdiModeAction;
 
112
 
 
113
    KActionMenu *m_gotoToolDockMenu;
 
114
};
 
115
 
 
116
/**
 
117
 * A KToggleAction specifically for toggling the showing
 
118
 * or the hiding of a KMDI tool view
 
119
 */
 
120
class KMDI_EXPORT ToggleToolViewAction:public KToggleAction
 
121
{
 
122
Q_OBJECT
 
123
public:
 
124
 
 
125
        ToggleToolViewAction( const QString& text, const KShortcut& cut = KShortcut(),KDockWidget *dw=0,KMdiMainFrm *mdiMainFrm=0,
 
126
                QObject* parent = 0, const char* name = 0 );
 
127
 
 
128
        virtual ~ToggleToolViewAction();
 
129
 
 
130
private:
 
131
 
 
132
        KDockWidget *m_dw;
 
133
        KMdiMainFrm *m_mdiMainFrm;
 
134
protected slots:
 
135
        
 
136
        void slotToggled(bool);
 
137
        void anDWChanged();
 
138
        void slotWidgetDestroyed();
 
139
};
 
140
 
 
141
 
 
142
}
 
143
 
 
144
#endif