2005-01-02 19:16:41 +00:00
|
|
|
/* Entry Completion
|
|
|
|
*
|
|
|
|
* GtkEntryCompletion provides a mechanism for adding support for
|
|
|
|
* completion in GtkEntry.
|
|
|
|
*
|
|
|
|
*/
|
2004-12-03 22:21:44 +00:00
|
|
|
using System;
|
|
|
|
using Gtk;
|
|
|
|
|
2005-04-01 21:08:14 +00:00
|
|
|
namespace GtkDemo
|
2004-12-03 22:21:44 +00:00
|
|
|
{
|
2004-12-12 22:11:44 +00:00
|
|
|
[Demo ("Entry Completion", "DemoEntryCompletion.cs")]
|
2004-12-03 22:21:44 +00:00
|
|
|
public class DemoEntryCompletion : Dialog
|
|
|
|
{
|
|
|
|
public DemoEntryCompletion () : base ("Demo Entry Completion", null, DialogFlags.DestroyWithParent)
|
|
|
|
{
|
2005-04-01 21:08:14 +00:00
|
|
|
Resizable = false;
|
|
|
|
|
|
|
|
VBox vbox = new VBox (false, 5);
|
|
|
|
vbox.BorderWidth = 5;
|
2011-06-13 16:00:08 +00:00
|
|
|
this.ContentArea.PackStart (vbox, true, true, 0);
|
2004-12-03 22:21:44 +00:00
|
|
|
|
|
|
|
Label label = new Label ("Completion demo, try writing <b>total</b> or <b>gnome</b> for example.");
|
|
|
|
label.UseMarkup = true;
|
2005-04-01 21:08:14 +00:00
|
|
|
vbox.PackStart (label, false, true, 0);
|
2004-12-03 22:21:44 +00:00
|
|
|
|
|
|
|
Entry entry = new Entry ();
|
2005-04-01 21:08:14 +00:00
|
|
|
vbox.PackStart (entry, false, true, 0);
|
|
|
|
|
2004-12-20 23:39:59 +00:00
|
|
|
entry.Completion = new EntryCompletion ();
|
|
|
|
entry.Completion.Model = CreateCompletionModel ();
|
|
|
|
entry.Completion.TextColumn = 0;
|
2004-12-03 22:21:44 +00:00
|
|
|
|
2005-04-01 21:08:14 +00:00
|
|
|
AddButton (Stock.Close, ResponseType.Close);
|
2004-12-03 22:21:44 +00:00
|
|
|
|
2005-04-01 21:08:14 +00:00
|
|
|
ShowAll ();
|
|
|
|
Run ();
|
|
|
|
Destroy ();
|
2004-12-03 22:21:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TreeModel CreateCompletionModel ()
|
|
|
|
{
|
|
|
|
ListStore store = new ListStore (typeof (string));
|
|
|
|
|
|
|
|
store.AppendValues ("GNOME");
|
|
|
|
store.AppendValues ("total");
|
|
|
|
store.AppendValues ("totally");
|
|
|
|
|
|
|
|
return store;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|