/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2004 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.gnu.gtk;

import org.gnu.glib.Handle;

/**
 */
public class ComboBoxEntry extends ComboBox {

	// for libglade object creation
	public ComboBoxEntry(Handle hndl) {
		super(hndl);
	}
	
	/**
	 * Construct a new ComboBoxEntry that will contain only Strings.
	 * If you need to include objects other than strings you must
	 * use the constructor that takes a TreeModel.  When you use
	 * this constructor you should use the appendText, insertText,
	 * prependText, and removeText methods to add or remove text
	 * from the comboBox.
	 */
	public ComboBoxEntry() {
		super(gtk_combo_box_entry_new_text());
	}
	
	/**
	 * Create a new ComboBoxEntry with the provided model.  If you
	 * use this constructor you should not use the appendText,
	 * insertText, prependText, or removeText methods.  You should
	 * update the model when you need to change the values in the
	 * ComboBox. 
	 * @param model
	 * @param textColumn
	 */
	public ComboBoxEntry(TreeModel model, int textColumn) {
		super(gtk_combo_box_entry_new_with_model(model.getHandle(), textColumn));
	}
	
	/**
	 * Set the model column which the ComboBoxEntry should use to
	 * get the strings.
	 * @param textColumn
	 */
	public void setTextColumn(int textColumn) {
		gtk_combo_box_entry_set_text_column(getHandle(), textColumn);
	}
	
	/**
	 * Returns the column from the model used by this widget.
	 */
	public int getTextColumn() {
		return gtk_combo_box_entry_get_text_column(getHandle());
	}
	

	native static final protected int gtk_combo_box_entry_get_type ();
	native static final protected Handle gtk_combo_box_entry_new();
	native static final protected Handle gtk_combo_box_entry_new_with_model(Handle model, int textColumn);
	native static final protected void gtk_combo_box_entry_set_text_column(Handle entry, int textColumn);
	native static final protected int gtk_combo_box_entry_get_text_column(Handle entry);
	native static final protected Handle gtk_combo_box_entry_new_text();

}
