/[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.10 by mark, Tue Jan 22 22:26:56 2002 UTC revision 1.11 by tromey, Mon Mar 11 00:52:00 2002 UTC
# Line 1  Line 1 
1  /* GtkCheckboxPeer.java -- Implements CheckboxPeer with GTK  /* GtkCheckboxPeer.java -- Implements CheckboxPeer with GTK
2     Copyright (C) 1998, 1999 Free Software Foundation, Inc.     Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 43  import java.awt.*; Line 43  import java.awt.*;
43  public class GtkCheckboxPeer extends GtkComponentPeer  public class GtkCheckboxPeer extends GtkComponentPeer
44    implements CheckboxPeer    implements CheckboxPeer
45  {  {
46      // Group from last time it was set.
47      public CheckboxGroup old_group;
48    
49    native void gtkRadioButtonSetGroup (Object group);    public native void nativeCreate (CheckboxGroup group);
50    native void gtkRadioButtonNew (ComponentPeer parent,    public native void nativeSetCheckboxGroup (CheckboxGroup group,
51                                   Object group, boolean checked, String label);                                               CheckboxGroup old_group);
   native void gtkCheckButtonNew (ComponentPeer parent,  
                                  boolean checked, String label);  
   native void gtkCheckButtonSetState (boolean checked);  
   native void gtkCheckButtonSetLabel (String label);  
52    
53    public GtkCheckboxPeer (Checkbox c, ComponentPeer cp)    public GtkCheckboxPeer (Checkbox c)
54    {    {
55      super (c);      super (c);
       
     CheckboxGroup group = c.getCheckboxGroup ();  
       
     if (group == null)  
       gtkCheckButtonNew (cp, c.getState (), c.getLabel ());  
     else  
       gtkRadioButtonNew (cp, group, c.getState(), c.getLabel ());  
56    }    }
57    
58    public void setCheckboxGroup (CheckboxGroup group)    // We can't fully use the ordinary getArgs code here, due to
59      // oddities of this particular widget.  In particular we must be
60      // able to switch between a checkbutton and a radiobutton
61      // dynamically.
62      public void create ()
63      {
64        CheckboxGroup g = ((Checkbox) awtComponent).getCheckboxGroup ();
65        nativeCreate (g);
66      }
67    
68      public void setState (boolean state)
69    {    {
70      gtkRadioButtonSetGroup (group);      set ("active", state);
71    }    }
72      
73    public void setLabel (String label)    public void setLabel (String label)
74    {    {
75      gtkCheckButtonSetLabel (label);      set ("label", label);
76    }    }
77      
78    public void setState (boolean state)    public void setCheckboxGroup (CheckboxGroup group)
79      {
80        nativeSetCheckboxGroup (group, old_group);
81        old_group = group;
82      }
83    
84      public void getArgs (Component component, GtkArgList args)
85    {    {
86      gtkCheckButtonSetState (state);      super.getArgs (component, args);
87        args.add ("active", ((Checkbox) component).getState ());
88        args.add ("label", ((Checkbox) component).getLabel ());
89    }    }
90  }  }

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

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