/[classpath]/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
ViewVC logotype

Diff of /classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by tromey, Sun Mar 24 22:26:56 2002 UTC revision 1.6 by tromey, Fri Nov 15 03:05:11 2002 UTC
# Line 38  exception statement from your version. * Line 38  exception statement from your version. *
38    
39  #include "gtkpeer.h"  #include "gtkpeer.h"
40  #include "gnu_java_awt_peer_gtk_GtkCheckboxPeer.h"  #include "gnu_java_awt_peer_gtk_GtkCheckboxPeer.h"
41    #include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
42    
43  static void item_toggled (GtkToggleButton *item, jobject peer);  static void item_toggled (GtkToggleButton *item, jobject peer);
44    
45    JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_dispose
46      (JNIEnv *env, jobject obj)
47    {
48      /* The actual underlying widget is owned by a different class.  So
49         we just clean up the hash table here.  */
50      NSA_DEL_PTR (env, obj);
51    }
52    
53    JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_remove
54      (JNIEnv *env, jobject obj, jobject checkbox)
55    {
56      GtkRadioButton *button;
57      void *ptr;
58      GSList *list;
59    
60      ptr = NSA_GET_PTR (env, checkbox);
61      gdk_threads_enter ();
62      button = GTK_RADIO_BUTTON (ptr);
63    
64      /* Update the group to point to some other widget in the group.  We
65         have to do this because Gtk doesn't have a separate object to
66         represent a radio button's group.  */
67      for (list = gtk_radio_button_group (button); list != NULL;
68           list = list->next)
69        {
70          if (list->data != button)
71            break;
72        }
73    
74      gdk_threads_leave ();
75    
76      NSA_SET_PTR (env, obj, list ? list->data : NULL);
77    }
78    
79  JNIEXPORT void JNICALL  JNIEXPORT void JNICALL
80  Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeCreate  Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeCreate
81    (JNIEnv *env, jobject obj, jobject group)    (JNIEnv *env, jobject obj, jobject group)
# Line 92  Java_gnu_java_awt_peer_gtk_GtkCheckboxPe Line 127  Java_gnu_java_awt_peer_gtk_GtkCheckboxPe
127    
128  JNIEXPORT void JNICALL  JNIEXPORT void JNICALL
129  Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeSetCheckboxGroup  Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeSetCheckboxGroup
130    (JNIEnv *env, jobject obj, jobject group, jobject old_group)    (JNIEnv *env, jobject obj, jobject group)
131  {  {
132    GtkRadioButton *button;    GtkRadioButton *button;
133    void *native_group, *ptr;    void *native_group, *ptr;
# Line 107  Java_gnu_java_awt_peer_gtk_GtkCheckboxPe Line 142  Java_gnu_java_awt_peer_gtk_GtkCheckboxPe
142    
143    button = GTK_RADIO_BUTTON (ptr);    button = GTK_RADIO_BUTTON (ptr);
144    
   if (old_group != NULL)  
     {  
       /* First, update our old group, if one exists, to point to some  
          other widget in the group.  We have to do this because Gtk  
          doesn't have a separate object to represent a radio button's  
          group.  */  
       GSList *list;  
       for (list = gtk_radio_button_group (button); list != NULL;  
            list = list->next)  
         {  
           if (list->data != button)  
             break;  
         }  
   
       NSA_SET_PTR (env, old_group, list ? list->data : NULL);  
     }  
   
145    native_group = NSA_GET_PTR (env, group);    native_group = NSA_GET_PTR (env, group);
146    if (native_group == NULL)    if (native_group == NULL)
147      gtk_radio_button_set_group (button, NULL);      gtk_radio_button_set_group (button, NULL);
# Line 136  Java_gnu_java_awt_peer_gtk_GtkCheckboxPe Line 154  Java_gnu_java_awt_peer_gtk_GtkCheckboxPe
154    
155    /* If the native group wasn't set on the new CheckboxGroup, then set    /* If the native group wasn't set on the new CheckboxGroup, then set
156       it now so that the right thing will happen with the next       it now so that the right thing will happen with the next
157       radiobutton.  */       radiobutton.  The native state for a CheckboxGroup is a pointer
158         to one of the widgets in the group.  We are careful to keep this
159         always pointing at a live widget; whenever a widget is destroyed
160         (or otherwise removed from the group), the CheckboxGroup peer is
161         notified.  */
162    if (native_group == NULL)    if (native_group == NULL)
163      NSA_SET_PTR (env, group, native_group);      NSA_SET_PTR (env, group, native_group);
164  }  }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26