1 /*
2     SDL - Simple DirectMedia Layer
3 
4     This library is free software; you can redistribute it and/or
5     modify it under the terms of the GNU Lesser General Public
6     License as published by the Free Software Foundation; either
7     version 2.1 of the License, or (at your option) any later version.
8 
9     This library is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12     Lesser General Public License for more details.
13 
14     You should have received a copy of the GNU Lesser General Public
15     License along with this library; if not, write to the Free Software
16     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 
18 
19 */
20 
21 /*
22     SDLdata.h
23     Symbian OS services for SDL
24 
25     Markus Mertama
26 */
27 
28 #include"sdlepocapi.h"
29 #include"epoc_sdl.h"
30 #include"vectorbuffer.h"
31 
32 class CEventQueue;
33 class CDsa;
34 class CSdlAppServ;
35 class CEikAppUi;
36 
37 enum {ESDLWsEvent = EEventUser + 1000};
38 const TInt KVectorSize = 128;
39 
40 
41 
NONSHARABLE_CLASS(EpocSdlEnvData)42 NONSHARABLE_CLASS(EpocSdlEnvData)
43     {
44 public:
45     enum {EResumeNeeded = 0x1000000, ESuspend =  0x2000000, EWaitDsa =  0x4000000};
46     void Free();
47     void Delete();
48     CEventQueue*            		iEventQueue;
49     TMainFunc						iMain;
50     TInt            				iEpocEnvFlags;
51     int                     		iArgc;
52     char**                  		iArgv;
53     CDsa*                   		iDsa;
54     CSdlAppServ*            		iAppSrv;
55     TThreadId               		iId;
56     CArrayFix<TSdlCleanupItem>*     iCleanupItems;
57     CEikAppUi*					    iAppUi;
58     CSDL*							iSdl;
59     CIdle* 							iCaller;
60     TRequestStatus*				    iCallerStatus;
61     CSDL::TAppOrientation   		iAppOrientation;
62     TInt iStackSize;
63     TUint32                         iColor;
64     CArrayFix<TInt>*                iChildThreads;
65     };
66 
NONSHARABLE_CLASS(EnvUtils)67  NONSHARABLE_CLASS(EnvUtils)
68 	{
69 public:
70 	static TBool IsOwnThreaded();
71 	static void DisableKeyBlocking();
72 	static TBool Rendezvous(RThread& aThread, TRequestStatus& aStatus);
73 	static TInt RunSingleThread();
74 	static TInt SetAppOrientation(CSDL::TAppOrientation);
75 	static CSDL::TAppOrientation AppOrientation();
76 	};
77 
78  class CEventQueue : public CBase, public MEventQueue
79     {
80     public:
81         void ConstructL();
82         ~CEventQueue();
83     public:
84         TInt Append(const TWsEvent& aEvent);
85         const TWsEvent& Shift();
86         void Lock();
87         void Unlock();
88         TBool HasData();
89     private:
90         TVector<TWsEvent, KVectorSize> iVector;
91         RCriticalSection iCS;
92     };
93 
94 
95