< prev index next >

modules/javafx.graphics/src/main/native-glass/mac/GlassWindow.m

Print this page




 811     GLASS_POOL_EXIT;
 812     GLASS_CHECK_EXCEPTION(env);
 813 }
 814 
 815 /*
 816  * Class:     com_sun_glass_ui_mac_MacWindow
 817  * Method:    _setEnabled
 818  * Signature: (JZ)V
 819  */
 820 JNIEXPORT void JNICALL Java_com_sun_glass_ui_mac_MacWindow__1setEnabled
 821 (JNIEnv *env, jobject jwindow, jlong jPtr, jboolean isEnabled)
 822 {
 823     LOG("Java_com_sun_glass_ui_mac_MacWindow__1setEnabled");
 824     if (!jPtr) return;
 825 
 826     GLASS_ASSERT_MAIN_JAVA_THREAD(env);
 827     GLASS_POOL_ENTER;
 828     {
 829         GlassWindow *window = getGlassWindow(env, jPtr);
 830         window->isEnabled = (BOOL)isEnabled;
 831 
 832         if (!window->isEnabled) {
 833             window->enabledStyleMask = [window->nsWindow styleMask];
 834             [window->nsWindow setStyleMask: (window->enabledStyleMask & ~(NSUInteger)(NSMiniaturizableWindowMask | NSResizableWindowMask))];
 835 
 836             //XXX: perhaps we could simply enable/disable the buttons w/o playing with the styles at all
 837             NSButton *zoomButton = [window->nsWindow standardWindowButton:NSWindowZoomButton];
 838             [zoomButton setEnabled:NO];
 839         } else {
 840             [window->nsWindow setStyleMask: window->enabledStyleMask];
 841 
 842             if (window->enabledStyleMask & NSResizableWindowMask) {
 843                 NSButton *zoomButton = [window->nsWindow standardWindowButton:NSWindowZoomButton];
 844                 [zoomButton setEnabled:YES];
 845             }
 846         }










 847     }
 848     GLASS_POOL_EXIT;
 849     GLASS_CHECK_EXCEPTION(env);
 850 }
 851 
 852 /*
 853  * Class:     com_sun_glass_ui_mac_MacWindow
 854  * Method:    _setAlpha
 855  * Signature: (F)V
 856  */
 857 JNIEXPORT void JNICALL Java_com_sun_glass_ui_mac_MacWindow__1setAlpha
 858 (JNIEnv *env, jobject jWindow, jlong jPtr, jfloat jAlpha)
 859 {
 860     LOG("Java_com_sun_glass_ui_mac_MacWindow__1setAlpha");
 861     if (!jPtr) return;
 862 
 863     GLASS_ASSERT_MAIN_JAVA_THREAD(env);
 864     GLASS_POOL_ENTER;
 865     {
 866         GlassWindow *window = getGlassWindow(env, jPtr);




 811     GLASS_POOL_EXIT;
 812     GLASS_CHECK_EXCEPTION(env);
 813 }
 814 
 815 /*
 816  * Class:     com_sun_glass_ui_mac_MacWindow
 817  * Method:    _setEnabled
 818  * Signature: (JZ)V
 819  */
 820 JNIEXPORT void JNICALL Java_com_sun_glass_ui_mac_MacWindow__1setEnabled
 821 (JNIEnv *env, jobject jwindow, jlong jPtr, jboolean isEnabled)
 822 {
 823     LOG("Java_com_sun_glass_ui_mac_MacWindow__1setEnabled");
 824     if (!jPtr) return;
 825 
 826     GLASS_ASSERT_MAIN_JAVA_THREAD(env);
 827     GLASS_POOL_ENTER;
 828     {
 829         GlassWindow *window = getGlassWindow(env, jPtr);
 830         window->isEnabled = (BOOL)isEnabled;






 831         NSButton *zoomButton = [window->nsWindow standardWindowButton:NSWindowZoomButton];
 832         if ((window->isEnabled)&&(window->isResizable)){

 833             [window->nsWindow setStyleMask: window->enabledStyleMask];

 834             if (window->enabledStyleMask & NSResizableWindowMask) {

 835                 [zoomButton setEnabled:YES];
 836             }
 837         }
 838         else if((window->isEnabled)&&(!window->isResizable)){
 839             [window->nsWindow setStyleMask: (window->enabledStyleMask & ~(NSUInteger)
 840                                              NSResizableWindowMask)];
 841             [zoomButton setEnabled:NO];
 842         }
 843         else{
 844             window->enabledStyleMask = [window->nsWindow styleMask];
 845             [window->nsWindow setStyleMask: (window->enabledStyleMask & ~(NSUInteger)(NSMiniaturizableWindowMask | NSResizableWindowMask))];
 846             [zoomButton setEnabled:NO];
 847         }
 848     }
 849     GLASS_POOL_EXIT;
 850     GLASS_CHECK_EXCEPTION(env);
 851 }
 852 
 853 /*
 854  * Class:     com_sun_glass_ui_mac_MacWindow
 855  * Method:    _setAlpha
 856  * Signature: (F)V
 857  */
 858 JNIEXPORT void JNICALL Java_com_sun_glass_ui_mac_MacWindow__1setAlpha
 859 (JNIEnv *env, jobject jWindow, jlong jPtr, jfloat jAlpha)
 860 {
 861     LOG("Java_com_sun_glass_ui_mac_MacWindow__1setAlpha");
 862     if (!jPtr) return;
 863 
 864     GLASS_ASSERT_MAIN_JAVA_THREAD(env);
 865     GLASS_POOL_ENTER;
 866     {
 867         GlassWindow *window = getGlassWindow(env, jPtr);


< prev index next >