Remove IMPORT_C / EXPORT_C.
[SDL.s60v3.git] / symbian / include / sdlepocapi.h
blob49d44d9d2452f86885a7e6295a155aa8b28fac8c
1 #ifndef EPOC_SDL_H
2 #define EPOC_SDL_H
4 #include <e32std.h>
5 #include <remconcoreapitargetobserver.h>
7 class CDesC8Array;
8 class TWsEvent;
9 class RWindow;
10 class CAknAppUi;
11 class RWsSession;
12 class CWsScreenDevice;
13 class CBitmapContext;
14 class CFbsBitmap;
16 //internal stuff
17 extern "C"
19 typedef int (*mainfunc1) ();
20 typedef int (*mainfunc2) (int argc, char* argv[]);
21 typedef int (*mainfunc3) (int argc, char* argv[], char* env[]);
22 typedef void (*mainfunc4) ();
23 typedef void (*mainfunc5) (int argc, char* argv[]);
24 typedef void (*mainfunc6) (int argc, char* argv[], char* env[]);
27 //internal stuff
28 extern "C"
30 int SDL_main (int argc, char* argv[]);
33 //internal stuff
34 class TMainFunc
36 public:
37 TMainFunc();
38 TMainFunc(mainfunc1);
39 TMainFunc(mainfunc2);
40 TMainFunc(mainfunc3);
41 TMainFunc(mainfunc4);
42 TMainFunc(mainfunc5);
43 TMainFunc(mainfunc6);
44 const void* operator[](TInt aIndex) const;
46 private:
47 void* iMainFunc[6];
50 class MSDLObserver
52 public:
53 enum //these events indicates the state changes in SDL
55 EEventWindowReserved, //window is created, nothing else should use the window
56 EEventWindowNotAvailable, //window not available, can be ignored
57 EEventSuspend, //SDL thread will be stopped next
58 EEventResume, //SDL thread resumed
59 EEventKeyMapInit, //Keymap is inited and can now be rewritten
60 EEventMainExit,
62 enum //these are fixed return values that event handler sends back to SDL
64 EParameterNone,
65 ESuspendNoSuspend //after EEventSuspend, prevents the suspend.
67 virtual TInt SdlEvent(TInt aEvent, TInt aParam) = 0; //event is called in application thread
71 class CSDL : public CBase, public MRemConCoreApiTargetObserver
73 public:
74 enum TFlags //these flags set SDL modes
76 ENoFlags = 0x0,
77 EEnableFocusStop = 0x1, //let SDL thread to be stopped if not on top
78 EMainThread = 0x2000, //always put SDL in application thread
81 static CSDL* NewL(TInt aFlags = CSDL::ENoFlags);
82 MSDLObserver* Observer(); //get current observer
83 void SetObserver(MSDLObserver* aObserver); //set observer to receive events, if NULL then observer is removed
84 void SetContainerWindowL(RWindow& aWindow, RWsSession& aSession, CWsScreenDevice& aDevice); //the window where drawn happens, should be recalled (propably in application HandleResourceChange) if screen device changes
85 ~CSDL();
86 TInt AppendWsEvent(const TWsEvent& aEvent); //give event to SDL, return error code if event buffer is full (insert in application HandleWsEvent)
87 TInt GetSDLCode(TInt aScanCode); //get SDL internal key code bind to given scancode, return -1 if scancode is not found, aScancode must be postive number
88 TInt SetSDLCode(TInt aScanCode, TInt aSDLCode); //set internal SDL code with given key code, return replaced code
89 TInt SDLCodesCount() const; //return count of scancodes
90 void ResetSDLCodes(); //rest all code replacement to their initial values
91 void Resume(); //restart SDL main
92 void Suspend(); //stop SDL main
93 void SDLPanic(const TDesC& aInfo, TInt aErr); //Panic from SDL thread (see SDLThreadEvent)
94 TThreadId CallMainL(const TMainFunc& aFunc, TRequestStatus* const aStatus, const CDesC8Array* const iArg, TInt aStackSize); //internal
95 void Resize();
97 void MrccatoCommand(TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction aButtonAct);
99 protected:
100 CSDL();
103 #endif