本文整理汇总了C#中Gtk.Toolbar.GetItemIndex方法的典型用法代码示例。如果您正苦于以下问题:C# Toolbar.GetItemIndex方法的具体用法?C# Toolbar.GetItemIndex怎么用?C# Toolbar.GetItemIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Toolbar
的用法示例。
在下文中一共展示了Toolbar.GetItemIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PopulateToolbarPlaceholder
public void PopulateToolbarPlaceholder (Toolbar toolbar, string path, Widget item, bool expand)
{
ToolItem placeholder = (ToolItem)UIManager.GetWidget (path);
int position = toolbar.GetItemIndex (placeholder);
toolbar.Remove (placeholder);
if (item is ToolItem) {
((ToolItem)item).Expand = expand;
toolbar.Insert ((ToolItem)item, position);
} else {
ToolItem container_item = new Hyena.Widgets.GenericToolItem<Widget> (item);
container_item.Expand = expand;
container_item.Show ();
container_item.ToolbarReconfigured += (o, a) => {
SetItemSize (container_item, container_item.IconSize);
};
toolbar.Insert (container_item, position);
}
}
示例2: SwapSeekSlider
private void SwapSeekSlider()
{
// ripped off of Moblin extension
// First grab the type and instance of the primary window
// and make sure we're only hacking the Nereid UI
var pwin = elements_service.PrimaryWindow;
var pwin_type = pwin.GetType ();
if (pwin_type.FullName != "Nereid.PlayerInterface") {
return;
}
// Find ConnectedSeekSlider
pwin_toolbar = (Toolbar)pwin_type.GetProperty ("HeaderToolbar").GetValue (pwin, null);
foreach (var child in pwin_toolbar.Children) {
if (child.GetType ().FullName.StartsWith ("Banshee.Widgets.GenericToolItem")) {
var c = child as Container;
if (c != null && c.Children[0] is ConnectedSeekSlider) {
connected_toolitem = child as ToolItem;
break;
}
}
}
// swap original ConnectedSeekSlider with new ConnectedMoodSeekSlider
var pos = pwin_toolbar.GetItemIndex (connected_toolitem as ToolItem);
pwin_toolbar.Remove (connected_toolitem as Gtk.ToolItem);
ConnectedMoodbarSeekSlider connected_moodbar_seek_slider;
connected_moodbar_seek_slider = new ConnectedMoodbarSeekSlider ();
connected_moodbar_seek_slider.Show ();
moodbar_toolitem = new GenericToolItem<ConnectedMoodbarSeekSlider> (connected_moodbar_seek_slider);
moodbar_toolitem.Show ();
pwin_toolbar.Insert (moodbar_toolitem, pos);
}