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

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

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

revision 1.16 by fitzsim, Sat Jan 10 22:42:19 2004 UTC revision 1.17 by mark, Sat Jul 31 21:15:06 2004 UTC
# Line 58  public class GtkChoicePeer extends GtkCo Line 58  public class GtkChoicePeer extends GtkCo
58            items[i] = c.getItem (i);            items[i] = c.getItem (i);
59                        
60          append (items);          append (items);
   
         // Must set our state before notifying listeners  
         ((Choice) awtComponent).select (c.getItem (0));  
         postItemEvent (c.getItem (0), ItemEvent.SELECTED);  
61        }        }
62    }    }
63    
64    native void create ();    native void create ();
65    
66    native void append (String items[]);    native void append (String items[]);
67    native int getHistory ();    native int nativeGetSelected ();
68    native void nativeAdd (String item, int index);    native void nativeAdd (String item, int index);
69    native void nativeRemove (int index);    native void nativeRemove (int index);
70      native void nativeRemoveAll ();
71    
72    native public void select (int position);    native public void select (int position);
73    
74    public void add (String item, int index)    public void add (String item, int index)
75    {    {
76      int before = getHistory();      int before = nativeGetSelected();
77            
78      nativeAdd (item, index);      nativeAdd (item, index);
79            
# Line 92  public class GtkChoicePeer extends GtkCo Line 89  public class GtkChoicePeer extends GtkCo
89    
90    public void remove (int index)    public void remove (int index)
91    {    {
92      int before = getHistory();      int before = nativeGetSelected();
93      int after;      int after;
94            
95      nativeRemove (index);      nativeRemove (index);
96      after = getHistory();      after = nativeGetSelected();
97            
98      /* Generate an ItemEvent if we are removing the currently selected item      /* Generate an ItemEvent if we are removing the currently selected item
99         and there are at least one item left. */         and there are at least one item left. */
# Line 110  public class GtkChoicePeer extends GtkCo Line 107  public class GtkChoicePeer extends GtkCo
107    
108    public void removeAll ()    public void removeAll ()
109    {    {
110      nativeRemove (-1);      nativeRemoveAll();
111    }    }
112        
113    public void addItem (String item, int position)    public void addItem (String item, int position)

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

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