summaryrefslogtreecommitdiffstats
path: root/bibletime/frontend/cmdiarea.h
blob: 5877e172734fb12dc05a31f3c61bf90b22c442fb (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
141
142
143
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2006 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/



#ifndef CMDIAREA_H
#define CMDIAREA_H

//BibleTime includes
#include "util/cpointers.h"
#include "backend/cswordmoduleinfo.h"

//Qt includes
#include <tqworkspace.h>
#include <tqptrlist.h>
#include <tqstrlist.h>
#include <tqevent.h>

class KPopupMenu;
class CSwordModuleInfo;
class CSwordKey;

/** The MDI widget we use in BibleTime.
 * Enhances TQWorkspace.
  * @author The BibleTime Team
  */
class CMDIArea : public TQWorkspace, public CPointers  {
	Q_OBJECT

public:
	/**
	* The options you can set for this widget.
	*/
	enum MDIOption {
		autoTileVertical,
		autoTileHorizontal,
		autoCascade,
		Nothing
	};
	CMDIArea(TQWidget *parent, const char *name = 0 );
	/**
	*/
	void readSettings();
	/**
	*/
	void saveSettings();
	/**
	* Enable / disable autoCascading
	*/
	void setGUIOption( const MDIOption& newOption );
	/**
	* This works around a problem/limitation in TQWorkspace. TQWorkspace sets every time the
	* application caption on its on way. This confuses BibleTime - wrong captions are generated.
	* This function returns the right caption (using the MDI child).
	*/
	inline const TQString currentApplicationCaption() const;
	void emitWindowCaptionChanged();
	/**
	* Forces an update of the currently chosen window arrangement.
	*/
	void triggerWindowUpdate();
	TQPtrList<TQWidget> usableWindowList();

public slots:
	/**
	* Called whan a client window was activated
	*/
	void slotClientActivated(TQWidget* client);
	/**
	* Deletes all the presenters in the MDI area.
	*/
	void deleteAll();
	/** Our own cascade version which, if only one window is left, shows this maximized.
	* Also necessary for autoCasacde feature
	*/
	void myCascade();
	/** Our own cascade version which, if only one window is left, shows this maximized.
	* Also necessary for autoTile feature
	*/
	void myTileVertical();
	/** Horizontal tile function
	* This function was taken from Qt's MDI example.
	*/
	void myTileHorizontal();
	/**
	 * Emits the signal to create a new display window in the MDI area.
	 */
	inline void emitCreateDisplayWindow( ListCSwordModuleInfo modules, const TQString keyName );

protected: // Protected methods
	/**
	* Used to make use of the fixedGUIOption part.
	*/
	virtual void childEvent (TQChildEvent * e);
	/**
	* Reimplementation
	*/
	virtual void resizeEvent(TQResizeEvent* e);
	/**
	* Initializes the connectiosn to SIGNALS
	*/
	void initConnections();
	/**
	* Initializes the view of the MDI area
	*/
	void initView();
	bool eventFilter( TQObject *o, TQEvent *e );

signals: // Signals
	/**
	* Emits a signal to set the acption of the toplevel widget.
	*/
	void sigSetToplevelCaption(const TQString&);
	/**
	* Is emitted when the last presenter was closed.
	*/
	void sigLastPresenterClosed();
	void createReadDisplayWindow(ListCSwordModuleInfo modules, const TQString& keyName);

private:
	MDIOption m_guiOption;
	bool m_childEvent;
	TQString m_appCaption;
};

/** This works around a problem/limitation in TQWorkspace. TQWorkspace sets every time the  application caption on its on way. This confuses BibleTime - wrong captions are generated. This function returns the right caption (using the MDI child). */
inline const TQString CMDIArea::currentApplicationCaption() const {
	return m_appCaption;
}

/** Emits the signal to create a new display window in the MDI area. */
inline void CMDIArea::emitCreateDisplayWindow( ListCSwordModuleInfo modules, const TQString keyName ) {
	emit createReadDisplayWindow(modules, keyName);
}


#endif