Home | History | Annotate | Download | only in android
      1 #ifndef _TCUANDROIDNATIVEACTIVITY_HPP
      2 #define _TCUANDROIDNATIVEACTIVITY_HPP
      3 /*-------------------------------------------------------------------------
      4  * drawElements Quality Program Tester Core
      5  * ----------------------------------------
      6  *
      7  * Copyright 2014 The Android Open Source Project
      8  *
      9  * Licensed under the Apache License, Version 2.0 (the "License");
     10  * you may not use this file except in compliance with the License.
     11  * You may obtain a copy of the License at
     12  *
     13  *      http://www.apache.org/licenses/LICENSE-2.0
     14  *
     15  * Unless required by applicable law or agreed to in writing, software
     16  * distributed under the License is distributed on an "AS IS" BASIS,
     17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     18  * See the License for the specific language governing permissions and
     19  * limitations under the License.
     20  *
     21  *//*!
     22  * \file
     23  * \brief C++ wrapper for Android NativeActivity.
     24  *
     25  * To use this wrapper, implement your NativeActivity by extending this
     26  * class and create NativeActivity in ANativeActivity_onCreate().
     27  *
     28  * tcu::NativeActivity constructor will fill activity->callbacks and
     29  * set instance pointer.
     30  *//*--------------------------------------------------------------------*/
     31 
     32 #include "tcuDefs.hpp"
     33 
     34 #include <android/native_activity.h>
     35 
     36 namespace tcu
     37 {
     38 namespace Android
     39 {
     40 
     41 class NativeActivity
     42 {
     43 public:
     44 						NativeActivity				(ANativeActivity* activity);
     45 	virtual				~NativeActivity				(void);
     46 
     47 	virtual void		onStart						(void);
     48 	virtual void		onResume					(void);
     49 	virtual void*		onSaveInstanceState			(size_t* outSize);
     50 	virtual void		onPause						(void);
     51 	virtual void		onStop						(void);
     52 	virtual void		onDestroy					(void);
     53 
     54 	virtual void		onWindowFocusChanged		(int hasFocus);
     55 	virtual void		onNativeWindowCreated		(ANativeWindow* window);
     56 	virtual void		onNativeWindowResized		(ANativeWindow* window);
     57 	virtual void		onNativeWindowRedrawNeeded	(ANativeWindow* window);
     58 	virtual void		onNativeWindowDestroyed		(ANativeWindow* window);
     59 
     60 	virtual void		onInputQueueCreated			(AInputQueue* queue);
     61 	virtual void		onInputQueueDestroyed		(AInputQueue* queue);
     62 
     63 	virtual void		onContentRectChanged		(const ARect* rect);
     64 	virtual void		onConfigurationChanged		(void);
     65 	virtual void		onLowMemory					(void);
     66 
     67 	ANativeActivity*	getNativeActivity			(void) { return m_activity; }
     68 	void				finish						(void);
     69 
     70 private:
     71 						NativeActivity				(const NativeActivity& other);
     72 	NativeActivity&		operator=					(const NativeActivity& other);
     73 
     74 	ANativeActivity*	m_activity;
     75 };
     76 
     77 } // Android
     78 } // tcu
     79 
     80 #endif // _TCUANDROIDNATIVEACTIVITY_HPP
     81