2005-06-28 Mike Kestner <mkestner@novell.com>
* gtk/ComboBox.custom : add ctor (string[]). * gtk/ComboBoxEntry.custom : add ctor (string[]). * sample/test/TestComboBox.cs : simple new ComboBox tester. * sample/test/WidgetViewer.cs : button for simple new ComboBox tester. svn path=/trunk/gtk-sharp/; revision=46657
This commit is contained in:
parent
d42ff66f68
commit
a0912263e2
9 changed files with 134 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2005-06-28 Mike Kestner <mkestner@novell.com>
|
||||||
|
|
||||||
|
* gtk/ComboBox.custom : add ctor (string[]).
|
||||||
|
* gtk/ComboBoxEntry.custom : add ctor (string[]).
|
||||||
|
* sample/test/TestComboBox.cs : simple new ComboBox tester.
|
||||||
|
* sample/test/WidgetViewer.cs : button for simple new ComboBox tester.
|
||||||
|
|
||||||
2005-06-27 Mike Kestner <mkestner@novell.com>
|
2005-06-27 Mike Kestner <mkestner@novell.com>
|
||||||
|
|
||||||
* gnome/CanvasBpath.custom : a BPath property to wrap the ugly Bpath
|
* gnome/CanvasBpath.custom : a BPath property to wrap the ugly Bpath
|
||||||
|
|
|
@ -791,5 +791,17 @@ Default value: 0
|
||||||
<since version="Gtk# 2.6" />
|
<since version="Gtk# 2.6" />
|
||||||
</Docs>
|
</Docs>
|
||||||
</Member>
|
</Member>
|
||||||
|
<Member MemberName=".ctor">
|
||||||
|
<MemberSignature Language="C#" Value="public ComboBox (string[] entries);" />
|
||||||
|
<MemberType>Constructor</MemberType>
|
||||||
|
<Parameters>
|
||||||
|
<Parameter Name="entries" Type="System.String[]" />
|
||||||
|
</Parameters>
|
||||||
|
<Docs>
|
||||||
|
<param name="entries">A list of string values for the combo entries.</param>
|
||||||
|
<summary>Creates a Combo box from a list of values.</summary>
|
||||||
|
<remarks />
|
||||||
|
</Docs>
|
||||||
|
</Member>
|
||||||
</Members>
|
</Members>
|
||||||
</Type>
|
</Type>
|
||||||
|
|
|
@ -117,5 +117,17 @@
|
||||||
</Attribute>
|
</Attribute>
|
||||||
</Attributes>
|
</Attributes>
|
||||||
</Member>
|
</Member>
|
||||||
|
<Member MemberName=".ctor">
|
||||||
|
<MemberSignature Language="C#" Value="public ComboBoxEntry (string[] entries);" />
|
||||||
|
<MemberType>Constructor</MemberType>
|
||||||
|
<Parameters>
|
||||||
|
<Parameter Name="entries" Type="System.String[]" />
|
||||||
|
</Parameters>
|
||||||
|
<Docs>
|
||||||
|
<param name="entries">a list of strings for the dropdown list.</param>
|
||||||
|
<summary>Creates a combo entry from a list of entries.</summary>
|
||||||
|
<remarks />
|
||||||
|
</Docs>
|
||||||
|
</Member>
|
||||||
</Members>
|
</Members>
|
||||||
</Type>
|
</Type>
|
||||||
|
|
|
@ -20,6 +20,14 @@
|
||||||
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
// Boston, MA 02111-1307, USA.
|
// Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
public ComboBox (string[] entries) : this (new ListStore (typeof (string)))
|
||||||
|
{
|
||||||
|
CellRendererText cell = new CellRendererText ();
|
||||||
|
PackStart (cell, true);
|
||||||
|
SetAttributes (cell, "text", 0);
|
||||||
|
foreach (string entry in entries)
|
||||||
|
AppendText (entry);
|
||||||
|
}
|
||||||
|
|
||||||
public void SetAttributes (CellRenderer cell, params object[] attrs)
|
public void SetAttributes (CellRenderer cell, params object[] attrs)
|
||||||
{
|
{
|
||||||
|
|
26
gtk/ComboBoxEntry.custom
Normal file
26
gtk/ComboBoxEntry.custom
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// Gtk.ComboBoxEntry.custom - Gtk ComboBoxEntry customizations
|
||||||
|
//
|
||||||
|
// Authors: Mike Kestner <mkestner@novell.com>
|
||||||
|
//
|
||||||
|
// Copyright (c) 2005 Novell, Inc.
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of version 2 of the Lesser GNU General
|
||||||
|
// Public License as published by the Free Software Foundation.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this program; if not, write to the
|
||||||
|
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
// Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
public ComboBoxEntry (string[] entries) : this (new ListStore (typeof (string)), 0)
|
||||||
|
{
|
||||||
|
foreach (string entry in entries)
|
||||||
|
AppendText (entry);
|
||||||
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ customs = \
|
||||||
ColorSelectionDialog.custom \
|
ColorSelectionDialog.custom \
|
||||||
Combo.custom \
|
Combo.custom \
|
||||||
ComboBox.custom \
|
ComboBox.custom \
|
||||||
|
ComboBoxEntry.custom \
|
||||||
Container.custom \
|
Container.custom \
|
||||||
Dialog.custom \
|
Dialog.custom \
|
||||||
Entry.custom \
|
Entry.custom \
|
||||||
|
|
|
@ -18,6 +18,7 @@ sources = \
|
||||||
TestFlipping.cs \
|
TestFlipping.cs \
|
||||||
TestSizeGroup.cs \
|
TestSizeGroup.cs \
|
||||||
TestCombo.cs \
|
TestCombo.cs \
|
||||||
|
TestComboBox.cs \
|
||||||
WidgetViewer.cs
|
WidgetViewer.cs
|
||||||
|
|
||||||
build_sources = $(addprefix $(srcdir)/, $(sources))
|
build_sources = $(addprefix $(srcdir)/, $(sources))
|
||||||
|
|
61
sample/test/TestComboBox.cs
Normal file
61
sample/test/TestComboBox.cs
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
// TestCombo.cs
|
||||||
|
//
|
||||||
|
// Author: Mike Kestner (mkestner@novell.com)
|
||||||
|
//
|
||||||
|
// Copyright (c) 2005, Novell, Inc.
|
||||||
|
//
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Gtk;
|
||||||
|
|
||||||
|
namespace WidgetViewer {
|
||||||
|
public class TestComboBox
|
||||||
|
{
|
||||||
|
static Window window = null;
|
||||||
|
|
||||||
|
public static Gtk.Window Create ()
|
||||||
|
{
|
||||||
|
window = new Window ("GtkComboBox");
|
||||||
|
window.SetDefaultSize (200, 100);
|
||||||
|
|
||||||
|
VBox box1 = new VBox (false, 0);
|
||||||
|
window.Add (box1);
|
||||||
|
|
||||||
|
VBox box2 = new VBox (false, 10);
|
||||||
|
box2.BorderWidth = 10;
|
||||||
|
box1.PackStart (box2, true, true, 0);
|
||||||
|
|
||||||
|
ComboBoxEntry combo = new Gtk.ComboBoxEntry (new string[] {"Foo", "Bar"});
|
||||||
|
combo.Changed += new EventHandler (OnComboActivated);
|
||||||
|
box2.PackStart (combo, true, true, 0);
|
||||||
|
|
||||||
|
HSeparator separator = new HSeparator ();
|
||||||
|
|
||||||
|
box1.PackStart (separator, false, false, 0);
|
||||||
|
|
||||||
|
box2 = new VBox (false, 10);
|
||||||
|
box2.BorderWidth = 10;
|
||||||
|
box1.PackStart (box2, false, false, 0);
|
||||||
|
|
||||||
|
Button button = new Button (Stock.Close);
|
||||||
|
button.Clicked += new EventHandler (OnCloseClicked);
|
||||||
|
button.CanDefault = true;
|
||||||
|
|
||||||
|
box2.PackStart (button, true, true, 0);
|
||||||
|
button.GrabDefault ();
|
||||||
|
return window;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void OnCloseClicked (object o, EventArgs args)
|
||||||
|
{
|
||||||
|
window.Destroy ();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void OnComboActivated (object o, EventArgs args)
|
||||||
|
{
|
||||||
|
Console.WriteLine ((o as ComboBox).ActiveText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ namespace WidgetViewer {
|
||||||
AddButton ("Check Buttons", new EventHandler (Check_Buttons));
|
AddButton ("Check Buttons", new EventHandler (Check_Buttons));
|
||||||
AddButton ("Color Selection", new EventHandler (Color_Selection));
|
AddButton ("Color Selection", new EventHandler (Color_Selection));
|
||||||
AddButton ("Combo Box", new EventHandler (Combo_Box));
|
AddButton ("Combo Box", new EventHandler (Combo_Box));
|
||||||
|
AddButton ("New Combo Box", new EventHandler (New_Combo_Box));
|
||||||
AddButton ("Dialog", new EventHandler (Dialog));
|
AddButton ("Dialog", new EventHandler (Dialog));
|
||||||
AddButton ("File Selection", new EventHandler (File_Selection));
|
AddButton ("File Selection", new EventHandler (File_Selection));
|
||||||
AddButton ("Menus", new EventHandler (Menus));
|
AddButton ("Menus", new EventHandler (Menus));
|
||||||
|
@ -151,6 +152,11 @@ namespace WidgetViewer {
|
||||||
AddWindow (TestSizeGroup.Create ());
|
AddWindow (TestSizeGroup.Create ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void New_Combo_Box (object o, EventArgs args)
|
||||||
|
{
|
||||||
|
AddWindow (TestComboBox.Create ());
|
||||||
|
}
|
||||||
|
|
||||||
static void Combo_Box (object o, EventArgs args)
|
static void Combo_Box (object o, EventArgs args)
|
||||||
{
|
{
|
||||||
AddWindow (TestCombo.Create ());
|
AddWindow (TestCombo.Create ());
|
||||||
|
|
Loading…
Reference in a new issue