65
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
* Multiple Windows' WindowManager.
|
|
16 |
*
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
|
|
21 |
#ifndef __MULTIPLE_WINDOWS_WINDOWMANAGER_H__
|
|
22 |
#define __MULTIPLE_WINDOWS_WINDOWMANAGER_H__
|
|
23 |
|
|
24 |
// INCLUDES FILES
|
|
25 |
#include "WmlBrowserBuild.h"
|
|
26 |
#include "Preferences.h"
|
|
27 |
#include <e32base.h>
|
|
28 |
#include <brctldefs.h>
|
|
29 |
#include "WindowObserver.h"
|
|
30 |
|
|
31 |
// FORWARD DECLARATIONS
|
|
32 |
class CBrowserWindow;
|
|
33 |
class MApiProvider;
|
|
34 |
class CBrowserContentView;
|
|
35 |
class MWindowInfoProvider;
|
|
36 |
class CWindowInfo;
|
|
37 |
class CBrowserWindowQue;
|
|
38 |
|
|
39 |
// CLASS DECLARATION
|
|
40 |
|
|
41 |
/**
|
|
42 |
* Interface to query several API implementations via Window class.
|
|
43 |
*
|
|
44 |
* @lib Browser.app
|
|
45 |
* @since Series 60 3.0
|
|
46 |
*/
|
|
47 |
class CBrowserWindowManager : public CBase,
|
|
48 |
public MPreferencesObserver
|
|
49 |
{
|
|
50 |
public: // constructors / destructor
|
|
51 |
|
|
52 |
static CBrowserWindowManager* NewLC(
|
|
53 |
MApiProvider& aApiProvider,
|
|
54 |
CBrowserContentView& aContentView,
|
|
55 |
TInt aMaxWindowCount );
|
|
56 |
static CBrowserWindowManager* NewL(
|
|
57 |
MApiProvider& aApiProvider,
|
|
58 |
CBrowserContentView& aContentView,
|
|
59 |
TInt aMaxWindowCount );
|
|
60 |
~CBrowserWindowManager();
|
|
61 |
|
|
62 |
public: // accessing windows / window data
|
|
63 |
|
|
64 |
TInt WindowCount() const;
|
|
65 |
|
|
66 |
inline TInt MaxWindowCount() const;
|
|
67 |
|
|
68 |
// @returns window object
|
|
69 |
// possible error codes: KErrNotFound, KErrGeneral
|
|
70 |
// searching for a window identified by an Id
|
|
71 |
TInt Window( TInt aWindowId, CBrowserWindow*& aWindow );
|
|
72 |
|
|
73 |
// @returns window object
|
|
74 |
// possible error codes: KErrNotFound, KErrGeneral
|
|
75 |
// searching for a window identified by an Id
|
|
76 |
CBrowserWindow* FindWindowL(
|
|
77 |
const TDesC& aTargetName );
|
|
78 |
|
|
79 |
CBrowserWindow* CurrentWindow() const;
|
|
80 |
|
|
81 |
CBrowserWindowQue* CurrentWindowQue() const;
|
|
82 |
|
|
83 |
inline MApiProvider* ApiProvider() const;
|
|
84 |
|
|
85 |
inline CBrowserContentView* ContentView() const;
|
|
86 |
|
|
87 |
CArrayFixFlat<CWindowInfo*>* GetWindowInfoL(
|
|
88 |
MWindowInfoProvider* aWindowInfo );
|
|
89 |
|
|
90 |
inline void SetUserExit( TBool aUserExit );
|
|
91 |
|
|
92 |
void SendCommandToAllWindowsL( TInt aCommand );
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Adds an observer which is notified about window events
|
|
96 |
* @param aObserver The observer which will receive window events.
|
|
97 |
* @since series 60 3.1
|
|
98 |
*/
|
|
99 |
void AddObserverL( MWindowObserver* aObserver );
|
|
100 |
|
|
101 |
/**
|
|
102 |
* Removes an observer which won`t be notified about window events.
|
|
103 |
* @param aObserver The observer which will not receive
|
|
104 |
* further window events.
|
|
105 |
* @since 3.1
|
|
106 |
*/
|
|
107 |
void RemoveObserver( MWindowObserver* aObserver );
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Notifies the observer about an event.
|
|
111 |
* @param aEvent The type of the event.
|
|
112 |
* @since 3.1
|
|
113 |
*/
|
|
114 |
void NotifyObserversL( TWindowEvent aEvent, TInt aWindowId = 0 );
|
|
115 |
|
|
116 |
public: // window management
|
|
117 |
|
|
118 |
// possible leave codes: KErrNoMemory
|
|
119 |
// Window specific settings are read from ApiProvider().Preferences()
|
|
120 |
// based on the current state
|
|
121 |
CBrowserWindow* CreateWindowL(
|
|
122 |
TInt aParentId,
|
|
123 |
const TDesC* aTargetName );
|
|
124 |
|
|
125 |
/**
|
|
126 |
* Deletes a window.
|
|
127 |
* @param aWindowId the window to be deleted
|
|
128 |
* @param aUserInitiated: user or script initiated the process
|
|
129 |
* @return the windowId should be activated or 0
|
|
130 |
*/
|
|
131 |
TInt DeleteWindowL( TInt aWindowId, TBool aForceDelete = EFalse );
|
|
132 |
|
|
133 |
// possible leave codes: KErrNotFound
|
|
134 |
TInt SwitchWindowL( TInt aWindowId, TBool aDraw = ETrue );
|
|
135 |
|
|
136 |
// is there any content in the window?
|
|
137 |
inline TBool IsContentExist() const;
|
|
138 |
|
|
139 |
// content was shown in the window
|
|
140 |
inline void SetContentExist( TBool aValue );
|
|
141 |
|
|
142 |
// Sets the type of content in the view
|
|
143 |
void SetCurrentWindowViewState(TBrCtlDefs::TBrCtlState aViewState, TInt aValue);
|
|
144 |
|
|
145 |
//Closes all windows except the current one
|
|
146 |
void CloseAllWindowsExceptCurrent();
|
|
147 |
|
|
148 |
public: // from MPreferencesObserver
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Observer for Preference changes
|
|
152 |
*/
|
|
153 |
virtual void HandlePreferencesChangeL(
|
|
154 |
const TPreferencesEvent aEvent,
|
|
155 |
TPreferencesValues& aValues,
|
|
156 |
TBrCtlDefs::TBrCtlSettings aSettingType );
|
|
157 |
|
|
158 |
protected:
|
|
159 |
|
|
160 |
CBrowserWindowManager(
|
|
161 |
MApiProvider& aApiProvider,
|
|
162 |
CBrowserContentView& aContentView,
|
|
163 |
TInt aMaxWindowCount );
|
|
164 |
/**
|
|
165 |
* 2nd phase constructor
|
|
166 |
*/
|
|
167 |
void ConstructL();
|
|
168 |
|
|
169 |
// searching for a window identified by its Id and TargetName
|
|
170 |
// returns with the Window
|
|
171 |
TInt Window(
|
|
172 |
TInt aParentId,
|
|
173 |
const TDesC* aTargetName,
|
|
174 |
CBrowserWindow*& aWindow,
|
|
175 |
CBrowserWindowQue* aStartingItem ) const;
|
|
176 |
|
|
177 |
// searching for a window identified by its Id
|
|
178 |
// returns with the Queue element of that Window
|
|
179 |
TInt Window(
|
|
180 |
TInt aWindowId,
|
|
181 |
CBrowserWindowQue*& aWindowQue,
|
|
182 |
CBrowserWindowQue* aStartingItem ) const;
|
|
183 |
|
|
184 |
// really delete a window
|
|
185 |
TInt DeleteOneWindowL( TInt aWindowId );
|
|
186 |
|
|
187 |
// removes already deleted (status) windows from the queue
|
|
188 |
void RemoveDeletedWindowsL();
|
|
189 |
|
|
190 |
private:
|
|
191 |
static TInt iWindowIdGenerator; // for generating window's id
|
|
192 |
MApiProvider* iApiProvider; // not owned
|
|
193 |
CBrowserContentView* iContentView; // not owned
|
|
194 |
TInt iMaxWindowCount;
|
|
195 |
TInt iWindowCount;
|
|
196 |
TInt iDeletedWindowCount;
|
|
197 |
CBrowserWindowQue* iWindowQueue; // head of the windows
|
|
198 |
CBrowserWindowQue* iCurrentWindow; // points to the current window
|
|
199 |
TBool iUserExit;
|
|
200 |
TBool iIsContentExist;
|
|
201 |
CArrayPtrFlat< MWindowObserver >* iObservers;
|
|
202 |
};
|
|
203 |
|
|
204 |
#include "BrowserWindowManager.inl"
|
|
205 |
|
|
206 |
#endif // __MULTIPLE_WINDOWS_WINDOWMANAGER_H__
|
|
207 |
|
|
208 |
// End of File
|