当前位置: 首页>>代码示例>>C#>>正文


C# Gtk.ListStore.GetPath方法代码示例

本文整理汇总了C#中Gtk.ListStore.GetPath方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.ListStore.GetPath方法的具体用法?C# Gtk.ListStore.GetPath怎么用?C# Gtk.ListStore.GetPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.ListStore的用法示例。


在下文中一共展示了Gtk.ListStore.GetPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InsertTimestampPreferences

		public InsertTimestampPreferences () : base (false, 12)
		{	
			// Get current values
			String dateFormat = (string) Preferences.Get (
				Preferences.INSERT_TIMESTAMP_FORMAT);

			DateTime now = DateTime.Now;

			// Label
			Gtk.Label label = new Gtk.Label (Catalog.GetString (
				"Choose one of the predefined formats " +
				"or use your own."));
			label.Wrap = true;
			label.Xalign = 0;
			PackStart (label);

			// Use Selected Format
			selected_radio = new Gtk.RadioButton (Catalog.GetString (
				"Use _Selected Format"));
			PackStart (selected_radio);

			// 1st column (visible): formatted date
			// 2nd column (not visible): date format
			store = new Gtk.ListStore (typeof (string),
				typeof (string));
			foreach (String format in formats)
				store.AppendValues (now.ToString (format), format);

			scroll = new Gtk.ScrolledWindow();
			scroll.ShadowType = Gtk.ShadowType.In;
			PackStart (scroll);

			tv = new Gtk.TreeView (store);
			tv.HeadersVisible = false;
			tv.AppendColumn ("Format", new Gtk.CellRendererText (),
				"text", 0);
			scroll.Add (tv);

			// Use Custom Format
			Gtk.HBox customBox = new Gtk.HBox (false, 12);
			PackStart (customBox);

			custom_radio = new Gtk.RadioButton (
				selected_radio, Catalog.GetString ("_Use Custom Format"));
			customBox.PackStart (custom_radio);

			custom_entry = new Gtk.Entry ();
			customBox.PackStart (custom_entry);

			IPropertyEditor entryEditor = Services.Factory.CreatePropertyEditorEntry (
				Preferences.INSERT_TIMESTAMP_FORMAT, custom_entry);
			entryEditor.Setup ();

			// Activate/deactivate widgets
			bool useCustom = true;
			Gtk.TreeIter iter;
			store.GetIterFirst (out iter);

			foreach (object[] row in store) {
				if (dateFormat.Equals (row[1])) {
					// Found format in list
					useCustom = false;
					break;
				}	
				store.IterNext (ref iter);
			}

			if (useCustom) {
				custom_radio.Active = true;
				scroll.Sensitive = false;
			} else {
				selected_radio.Active = true;
				custom_entry.Sensitive = false;
				tv.Selection.SelectIter (iter);
				Gtk.TreePath path = store.GetPath (iter);				
				tv.ScrollToCell (path, null, false, 0, 0);
			}

			// Register Toggled event for one radio button only
			selected_radio.Toggled += OnSelectedRadioToggled;
			tv.Selection.Changed += OnSelectionChanged;

			ShowAll ();
		}
开发者ID:MichaelAquilina,项目名称:tomboy,代码行数:84,代码来源:InsertTimestampPreferences.cs


注:本文中的Gtk.ListStore.GetPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。