/[classpath]/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
ViewVC logotype

Diff of /classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java

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

revision 1.17 by mkoch, Mon May 31 21:11:40 2004 UTC revision 1.18 by mark, Fri Jul 30 23:16:58 2004 UTC
# Line 52  public class GtkCheckboxPeer extends Gtk Line 52  public class GtkCheckboxPeer extends Gtk
52    // The current state of the GTK checkbox.    // The current state of the GTK checkbox.
53    private boolean currentState;      private boolean currentState;  
54    
55    public native void nativeCreate (GtkCheckboxGroupPeer group,    public native void create (GtkCheckboxGroupPeer group);
                                    boolean state);  
56    public native void nativeSetCheckboxGroup (GtkCheckboxGroupPeer group);    public native void nativeSetCheckboxGroup (GtkCheckboxGroupPeer group);
57    public native void connectSignals ();    public native void connectSignals ();
58    native void gtkSetFont (String name, int style, int size);    native void gtkSetFont (String name, int style, int size);
59    public native void gtkSetLabel (String label);    native void gtkButtonSetLabel (String label);
60      native void gtkToggleButtonSetActive (boolean is_active);
61    
62    public GtkCheckboxPeer (Checkbox c)    public GtkCheckboxPeer (Checkbox c)
63    {    {
64      super (c);      super (c);
65    }    }
66    
67    // We can't fully use the ordinary getArgs code here, due to    // FIXME: we must be able to switch between a checkbutton and a
68    // oddities of this particular widget.  In particular we must be    // radiobutton dynamically.
   // able to switch between a checkbutton and a radiobutton  
   // dynamically.  
69    public void create ()    public void create ()
70    {    {
71      CheckboxGroup g = ((Checkbox) awtComponent).getCheckboxGroup ();      Checkbox checkbox = (Checkbox) awtComponent;
72        CheckboxGroup g = checkbox.getCheckboxGroup ();
73      old_group = GtkCheckboxGroupPeer.getCheckboxGroupPeer (g);      old_group = GtkCheckboxGroupPeer.getCheckboxGroupPeer (g);
74      currentState = ((Checkbox)awtComponent).getState();      create (old_group);
75      nativeCreate (old_group, currentState);      gtkToggleButtonSetActive (checkbox.getState ());
76        gtkButtonSetLabel (checkbox.getLabel ());
77    }    }
78    
79    public void setState (boolean state)    public void setState (boolean state)
80    {    {
81      if (currentState != state)      if (currentState != state)
82        set ("active", state);        gtkToggleButtonSetActive (state);
83    }    }
84    
85    public void setLabel (String label)    public void setLabel (String label)
86    {    {
87      gtkSetLabel (label);      gtkButtonSetLabel (label);
88    }    }
89    
90    public void setCheckboxGroup (CheckboxGroup group)    public void setCheckboxGroup (CheckboxGroup group)
# Line 100  public class GtkCheckboxPeer extends Gtk Line 100  public class GtkCheckboxPeer extends Gtk
100        }        }
101    }    }
102    
   public void getArgs (Component component, GtkArgList args)  
   {  
     super.getArgs (component, args);  
     args.add ("active", ((Checkbox) component).getState ());  
     args.add ("label", ((Checkbox) component).getLabel ());  
   }  
   
103    // Override the superclass postItemEvent so that the peer doesn't    // Override the superclass postItemEvent so that the peer doesn't
104    // need information that we have.    // need information that we have.
105    public void postItemEvent (Object item, int stateChange)    public void postItemEvent (Object item, int stateChange)

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

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