mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-16 00:37:11 -06:00
System File Chooser: support "approve" callback and system message dialog on macOS (not yet used in SystemFileChooser
This commit is contained in:
@@ -29,15 +29,43 @@
|
||||
#endif
|
||||
|
||||
|
||||
#define JNI_COCOA_TRY() \
|
||||
@try {
|
||||
|
||||
#define JNI_COCOA_CATCH() \
|
||||
} @catch( NSException *ex ) { \
|
||||
NSLog( @"Exception: %@\nReason: %@\nUser Info: %@\nStack: %@", \
|
||||
[ex name], [ex reason], [ex userInfo], [ex callStackSymbols] ); \
|
||||
}
|
||||
|
||||
#define JNI_COCOA_ENTER() \
|
||||
@autoreleasepool { \
|
||||
@try {
|
||||
JNI_COCOA_TRY()
|
||||
|
||||
#define JNI_COCOA_EXIT() \
|
||||
} @catch( NSException *ex ) { \
|
||||
NSLog( @"Exception: %@\nReason: %@\nUser Info: %@\nStack: %@", \
|
||||
[ex name], [ex reason], [ex userInfo], [ex callStackSymbols] ); \
|
||||
} \
|
||||
JNI_COCOA_CATCH() \
|
||||
}
|
||||
|
||||
#define JNI_THREAD_ENTER( jvm, returnValue ) \
|
||||
JNIEnv *env; \
|
||||
bool detach = false; \
|
||||
switch( jvm->GetEnv( (void**) &env, JNI_VERSION_1_6 ) ) { \
|
||||
case JNI_OK: break; \
|
||||
case JNI_EDETACHED: \
|
||||
if( jvm->AttachCurrentThread( (void**) &env, NULL ) != JNI_OK ) \
|
||||
return returnValue; \
|
||||
detach = true; \
|
||||
break; \
|
||||
default: return returnValue; \
|
||||
} \
|
||||
@try {
|
||||
|
||||
#define JNI_THREAD_EXIT( jvm ) \
|
||||
} @finally { \
|
||||
if( env->ExceptionCheck() ) \
|
||||
env->ExceptionDescribe(); \
|
||||
if( detach ) \
|
||||
jvm->DetachCurrentThread(); \
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -82,10 +82,18 @@ JNIEXPORT jboolean JNICALL Java_com_formdev_flatlaf_ui_FlatNativeMacLibrary_togg
|
||||
/*
|
||||
* Class: com_formdev_flatlaf_ui_FlatNativeMacLibrary
|
||||
* Method: showFileChooser
|
||||
* Signature: (ZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;III[Ljava/lang/String;)[Ljava/lang/String;
|
||||
* Signature: (ZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IILcom/formdev/flatlaf/ui/FlatNativeMacLibrary/FileChooserCallback;I[Ljava/lang/String;)[Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jobjectArray JNICALL Java_com_formdev_flatlaf_ui_FlatNativeMacLibrary_showFileChooser
|
||||
(JNIEnv *, jclass, jboolean, jstring, jstring, jstring, jstring, jstring, jstring, jstring, jint, jint, jint, jobjectArray);
|
||||
(JNIEnv *, jclass, jboolean, jstring, jstring, jstring, jstring, jstring, jstring, jstring, jint, jint, jobject, jint, jobjectArray);
|
||||
|
||||
/*
|
||||
* Class: com_formdev_flatlaf_ui_FlatNativeMacLibrary
|
||||
* Method: showMessageDialog
|
||||
* Signature: (JILjava/lang/String;Ljava/lang/String;I[Ljava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_formdev_flatlaf_ui_FlatNativeMacLibrary_showMessageDialog
|
||||
(JNIEnv *, jclass, jlong, jint, jstring, jstring, jint, jobjectArray);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user