1 /* 2 __ 3 / _| 4 __ _ _ _ _ __ ___ _ __ __ _ | |_ ___ ___ ___ 5 / _` | | | | '__/ _ \| '__/ _` | | _/ _ \/ __/ __| 6 | (_| | |_| | | | (_) | | | (_| | | || (_) \__ \__ \ 7 \__,_|\__,_|_| \___/|_| \__,_| |_| \___/|___/___/ 8 9 Copyright (C) 2010 The Android Open Source Project. 10 Copyright (C) 2018-2019 Aurora Free Open Source Software. 11 12 This file is part of the Aurora Free Open Source Software. This 13 organization promote free and open source software that you can 14 redistribute and/or modify under the terms of the GNU Lesser General 15 Public License Version 3 as published by the Free Software Foundation or 16 (at your option) any later version approved by the Aurora Free Open Source 17 Software Organization. The license is available in the package root path 18 as 'LICENSE' file. Please review the following information to ensure the 19 GNU Lesser General Public License version 3 requirements will be met: 20 https://www.gnu.org/licenses/lgpl.html . 21 22 Alternatively, this file may be used under the terms of the GNU General 23 Public License version 3 or later as published by the Free Software 24 Foundation. Please review the following information to ensure the GNU 25 General Public License requirements will be met: 26 https://www.gnu.org/licenses/gpl-3.0.html. 27 28 NOTE: All products, services or anything associated to trademarks and 29 service marks used or referenced on this file are the property of their 30 respective companies/owners or its subsidiaries. Other names and brands 31 may be claimed as the property of others. 32 33 For more info about intellectual property visit: aurorafoss.org or 34 directly send an email to: contact (at) aurorafoss.org . 35 36 This file has bindings for an existing code, part of The Android Open Source 37 Project implementation. Check it out at android.googlesource.com . 38 */ 39 40 module aurorafw.android.platform.native_activity; 41 42 import aurorafw.jni.platform.jni; 43 import aurorafw.android.platform.rect; 44 import aurorafw.android.platform.asset_manager; 45 import aurorafw.android.platform.input; 46 import aurorafw.android.platform.native_window; 47 48 version (Android): 49 extern (C): 50 @system: 51 nothrow: 52 @nogc: 53 54 /// TODO: add android Documentation 55 56 enum 57 { 58 ANATIVEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT = 1, 59 ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED = 2 60 } 61 62 enum 63 { 64 ANATIVEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY = 1, 65 ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS = 2 66 } 67 68 struct ANativeActivity 69 { 70 ANativeActivityCallbacks* callbacks; 71 JavaVM* vm; 72 JNIEnv* env; 73 jobject clazz; 74 const(char)* internalDataPath; 75 const(char)* externalDataPath; 76 int sdkVersion; 77 void* instance; 78 AAssetManager* assetManager; 79 } 80 81 struct ANativeActivityCallbacks 82 { 83 void function(ANativeActivity*) onStart; 84 void function(ANativeActivity*) onResume; 85 void* function(ANativeActivity*, size_t*) onSaveInstanceState; 86 void function(ANativeActivity*) onPause; 87 void function(ANativeActivity*) onStop; 88 void function(ANativeActivity*) onDestroy; 89 void function(ANativeActivity*, int) onWindowFocusChanged; 90 void function(ANativeActivity*, ANativeWindow*) onNativeWindowCreated; 91 void function(ANativeActivity*, ANativeWindow*) onNativeWindowResized; 92 void function(ANativeActivity*, ANativeWindow*) onNativeWindowRedrawNeeded; 93 void function(ANativeActivity*, ANativeWindow*) onNativeWindowDestroyed; 94 void function(ANativeActivity*, AInputQueue*) onInputQueueCreated; 95 void function(ANativeActivity*, AInputQueue*) onInputQueueDestroyed; 96 void function(ANativeActivity*, const(ARect)*) onContentRectChanged; 97 void function(ANativeActivity*) onConfigurationChanged; 98 void function(ANativeActivity*) onLowMemory; 99 } 100 101 void ANativeActivity_onCreate(ANativeActivity* activity, void* savedState, size_t savedStateSize); 102 void ANativeActivity_finish(ANativeActivity* activity); 103 void ANativeActivity_setWindowFormat(ANativeActivity* activity, int format); 104 void ANativeActivity_setWindowFlags(ANativeActivity* activity, uint addFlags, uint removeFlags); 105 void ANativeActivity_showSoftInput(ANativeActivity* activity, uint flags); 106 void ANativeActivity_hideSoftInput(ANativeActivity* activity, uint flags);