本文整理汇总了C#中Gtk.Toolbar.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# Toolbar.Insert方法的具体用法?C# Toolbar.Insert怎么用?C# Toolbar.Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Toolbar
的用法示例。
在下文中一共展示了Toolbar.Insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainWindow
public MainWindow()
: base(Gtk.WindowType.Toplevel)
{
Application.Init ();
this.Resize(640,480);
//menu bar very top
MenuBar mb = new MenuBar ();
Menu fileMenu = new Menu ();
MenuItem menuItem = new MenuItem ("_File");
menuItem.Submenu = fileMenu;
mb.Append(menuItem);
MenuItem menuFileQuit = new MenuItem("Quit");
fileMenu.Append(menuFileQuit);
vboxMain.PackStart(mb,false,false,0);
//toolbar
Toolbar tbTop = new Toolbar ();
//toolbutton Staff
ToolButton tbStaff = new ToolButton (Gtk.Stock.OrientationPortrait);
tbStaff.Label="Staff";
tbStaff.IsImportant=true;
tbStaff.Clicked += HandleTbStaffClicked;
tbTop.Insert(tbStaff,0);
//toolbutton Clients
ToolButton tbClients = new ToolButton (Gtk.Stock.About);
tbClients.Label="Clients";
tbClients.IsImportant=true;
tbClients.Clicked+= HandleTbClientsClicked;
tbTop.Insert(tbClients,1);
//media bar
Label lbMediaTemp = new Label ();
lbMediaTemp.Text="Media holder";
lbMediaTemp.Show();
//pack the toolbar and media bar in the top hbox//
hbTop.PackStart(tbTop);
hbTop.PackStart(lbMediaTemp);
//pack the top hbox in the main vbox
vboxMain.PackStart(hbTop,false,false,1);
// horizontal pane
verticalPane.Position=200;
verticalPane.Pack1(scrollWindowLeft,false,false);
verticalPane.Pack2(scrollWindowRight,false,false);
vboxMain.PackStart(verticalPane);
scrollWindowLeft.Add(viewPortLeft);
scrollWindowRight.Add(viewPortRight);
Label lbMain = new Label ();
lbMain.Text= "main";
viewPortRight.Add(lbMain);
verticalPane.ShowAll();
//status bar very bottom
Statusbar sb = new Statusbar ();
vboxMain.PackStart(sb,false,false,1);
this.Add(vboxMain);
//hb1.Add(tbTop);
this.ShowAll ();
Build ();
}
示例2: DemoIconView
public DemoIconView () : base ("Gtk.IconView demo")
{
SetDefaultSize (650, 400);
DeleteEvent += new DeleteEventHandler (OnWinDelete);
VBox vbox = new VBox (false, 0);
Add (vbox);
Toolbar toolbar = new Toolbar ();
vbox.PackStart (toolbar, false, false, 0);
upButton = new ToolButton (Stock.GoUp);
upButton.IsImportant = true;
upButton.Sensitive = false;
toolbar.Insert (upButton, -1);
ToolButton homeButton = new ToolButton (Stock.Home);
homeButton.IsImportant = true;
toolbar.Insert (homeButton, -1);
fileIcon = GetIcon (Stock.File);
dirIcon = GetIcon (Stock.Open);
ScrolledWindow sw = new ScrolledWindow ();
sw.ShadowType = ShadowType.EtchedIn;
sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
vbox.PackStart (sw, true, true, 0);
// Create the store and fill it with the contents of '/'
store = CreateStore ();
FillStore ();
IconView iconView = new IconView (store);
iconView.SelectionMode = SelectionMode.Multiple;
upButton.Clicked += new EventHandler (OnUpClicked);
homeButton.Clicked += new EventHandler (OnHomeClicked);
iconView.TextColumn = COL_DISPLAY_NAME;
iconView.PixbufColumn = COL_PIXBUF;
iconView.ItemActivated += new ItemActivatedHandler (OnItemActivated);
sw.Add (iconView);
iconView.GrabFocus ();
ShowAll ();
}
示例3: DefaultMonitorPad
public DefaultMonitorPad(string title, string icon)
{
buffer = new Gtk.TextBuffer (new Gtk.TextTagTable ());
textEditorControl = new Gtk.TextView (buffer);
textEditorControl.Editable = false;
scroller = new Gtk.ScrolledWindow ();
scroller.ShadowType = ShadowType.In;
scroller.Add (textEditorControl);
Toolbar toolbar = new Toolbar ();
toolbar.IconSize = IconSize.SmallToolbar;
toolbar.Orientation = Orientation.Vertical;
toolbar.ToolbarStyle = ToolbarStyle.Icons;
buttonStop = new ToolButton ("gtk-stop");
buttonStop.Clicked += new EventHandler (OnButtonStopClick);
buttonStop.SetTooltip (tips, "Stop", "Stop");
toolbar.Insert (buttonStop, -1);
ToolButton buttonClear = new ToolButton ("gtk-clear");
buttonClear.Clicked += new EventHandler (OnButtonClearClick);
buttonClear.SetTooltip (tips, "Clear console", "Clear console");
toolbar.Insert (buttonClear, -1);
hbox = new HBox (false, 5);
hbox.PackStart (scroller, true, true, 0);
hbox.PackEnd (toolbar, false, false, 0);
bold = new TextTag ("bold");
bold.Weight = Pango.Weight.Bold;
buffer.TagTable.Add (bold);
tag = new TextTag ("0");
tag.Indent = 10;
buffer.TagTable.Add (tag);
tags.Add (tag);
Runtime.ProjectService.CombineOpened += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnCombineOpen));
Runtime.ProjectService.CombineClosed += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnCombineClosed));
this.title = title;
this.icon = icon;
this.markupTitle = title;
Control.ShowAll ();
}
示例4: CreateToolbar
private Toolbar CreateToolbar()
{
Toolbar tb = new Toolbar();
ToolbarTooltips = new Tooltips();
SaveButton = new ToolButton(Gtk.Stock.Save);
SaveButton.SetTooltip(ToolbarTooltips, Util.GS("Save the synchronization log"), "Toolbar/Save Log");
SaveButton.Clicked += new EventHandler(SaveLogHandler);
tb.Insert(SaveButton, -1);
ClearButton = new ToolButton(Gtk.Stock.Clear);
ClearButton.SetTooltip(ToolbarTooltips, Util.GS("Clear the synchronization log"), "Toolbar/Clear Log");
ClearButton.Clicked += new EventHandler(ClearLogHandler);
tb.Insert(ClearButton, -1);
SaveButton.Sensitive = false;
ClearButton.Sensitive = false;
return tb;
}
示例5: BuildToolbar
public static void BuildToolbar(Toolbar toolbar, Tooltips tooltips, ActionModelNode node, int depth)
{
if (node.Action != null)
{
// create the tool button
ToolButton button = new ActiveToolbarButton((IClickAction)node.Action, tooltips);
toolbar.Insert(button, toolbar.NItems);
}
else
{
foreach (ActionModelNode child in node.ChildNodes)
{
BuildToolbar(toolbar, tooltips, child, depth + 1);
}
}
}
示例6: SingleView
public SingleView(SafeUri [] uris)
{
this.uri = uris [0];
Log.Debug ("uri: " + this.uri);
GtkBeans.Builder builder = new GtkBeans.Builder ("single_view.ui");
builder.Autoconnect (this);
LoadPreference (Preferences.VIEWER_WIDTH);
LoadPreference (Preferences.VIEWER_MAXIMIZED);
Gtk.Toolbar toolbar = new Gtk.Toolbar ();
toolbar_hbox.PackStart (toolbar);
rl_button = GtkUtil.ToolButtonFromTheme ("object-rotate-left", Catalog.GetString ("Rotate Left"), true);
rl_button.Clicked += HandleRotate270Command;
rl_button.TooltipText = Catalog.GetString ("Rotate photo left");
toolbar.Insert (rl_button, -1);
rr_button = GtkUtil.ToolButtonFromTheme ("object-rotate-right", Catalog.GetString ("Rotate Right"), true);
rr_button.Clicked += HandleRotate90Command;
rr_button.TooltipText = Catalog.GetString ("Rotate photo right");
toolbar.Insert (rr_button, -1);
toolbar.Insert (new SeparatorToolItem (), -1);
ToolButton fs_button = GtkUtil.ToolButtonFromTheme ("view-fullscreen", Catalog.GetString ("Fullscreen"), true);
fs_button.Clicked += HandleViewFullscreen;
fs_button.TooltipText = Catalog.GetString ("View photos fullscreen");
toolbar.Insert (fs_button, -1);
ToolButton ss_button = GtkUtil.ToolButtonFromTheme ("media-playback-start", Catalog.GetString ("Slideshow"), true);
ss_button.Clicked += HandleViewSlideshow;
ss_button.TooltipText = Catalog.GetString ("View photos in a slideshow");
toolbar.Insert (ss_button, -1);
collection = new UriCollection (uris);
TargetList targetList = new TargetList();
targetList.AddTextTargets((uint)DragDropTargets.TargetType.PlainText);
targetList.AddUriTargets((uint)DragDropTargets.TargetType.UriList);
directory_view = new SelectionCollectionGridView (collection);
directory_view.Selection.Changed += HandleSelectionChanged;
directory_view.DragDataReceived += HandleDragDataReceived;
Gtk.Drag.DestSet (directory_view, DestDefaults.All, (TargetEntry[])targetList,
DragAction.Copy | DragAction.Move);
directory_view.DisplayTags = false;
directory_view.DisplayDates = false;
directory_view.DisplayRatings = false;
directory_scrolled = new ScrolledWindow();
directory_scrolled.Add (directory_view);
sidebar = new Sidebar ();
info_vbox.Add (sidebar);
sidebar.AppendPage (directory_scrolled, Catalog.GetString ("Folder"), "gtk-directory");
AddinManager.AddExtensionNodeHandler ("/FSpot/Sidebar", OnSidebarExtensionChanged);
sidebar.Context = ViewContext.Single;
sidebar.CloseRequested += HandleHideSidePane;
sidebar.Show ();
ThumbnailLoader.Default.OnPixbufLoaded += delegate { directory_view.QueueDraw (); };
image_view = new PhotoImageView (collection);
GtkUtil.ModifyColors (image_view);
GtkUtil.ModifyColors (image_scrolled);
image_view.ZoomChanged += HandleZoomChanged;
image_view.Item.Changed += HandleItemChanged;
image_view.ButtonPressEvent += HandleImageViewButtonPressEvent;
image_view.DragDataReceived += HandleDragDataReceived;
Gtk.Drag.DestSet (image_view, DestDefaults.All, (TargetEntry[])targetList,
DragAction.Copy | DragAction.Move);
image_scrolled.Add (image_view);
Window.ShowAll ();
zoom_scale.ValueChanged += HandleZoomScaleValueChanged;
LoadPreference (Preferences.VIEWER_SHOW_TOOLBAR);
LoadPreference (Preferences.VIEWER_INTERPOLATION);
LoadPreference (Preferences.VIEWER_TRANSPARENCY);
LoadPreference (Preferences.VIEWER_TRANS_COLOR);
ShowSidebar = collection.Count > 1;
LoadPreference (Preferences.VIEWER_SHOW_FILENAMES);
Preferences.SettingChanged += OnPreferencesChanged;
Window.DeleteEvent += HandleDeleteEvent;
collection.Changed += HandleCollectionChanged;
// wrap the methods to fit to the delegate
image_view.Item.Changed += delegate (object sender, BrowsablePointerChangedEventArgs old) {
BrowsablePointer pointer = sender as BrowsablePointer;
//.........这里部分代码省略.........
示例7: TestResultsPad
public TestResultsPad()
{
title = "Test results";
testService.TestSuiteChanged += new EventHandler (OnTestSuiteChanged);
panel = new VBox ();
Toolbar toolbar = new Toolbar ();
toolbar.IconSize = IconSize.SmallToolbar;
panel.PackStart (toolbar, false, false, 0);
buttonSuccess = new ToggleToolButton ();
buttonSuccess.Label = "Successful Tests";
buttonSuccess.Active = false;
buttonSuccess.IconWidget = new Gtk.Image (CircleImage.Success);
buttonSuccess.IsImportant = true;
buttonSuccess.Toggled += new EventHandler (OnShowSuccessfulToggled);
buttonSuccess.SetTooltip (tips, "Show Successful Tests", "Show Successful Tests");
toolbar.Insert (buttonSuccess, -1);
buttonFailures = new ToggleToolButton ();
buttonFailures.Label = "Failed Tests";
buttonFailures.Active = true;
buttonFailures.IconWidget = new Gtk.Image (CircleImage.Failure);
buttonFailures.IsImportant = true;
buttonFailures.Toggled += new EventHandler (OnShowFailuresToggled);
buttonFailures.SetTooltip (tips, "Show Failed Tests", "Show Failed Tests");
toolbar.Insert (buttonFailures, -1);
buttonIgnored = new ToggleToolButton ();
buttonIgnored.Label = "Ignored Tests";
buttonIgnored.Active = true;
buttonIgnored.IconWidget = new Gtk.Image (CircleImage.NotRun);
buttonIgnored.Toggled += new EventHandler (OnShowIgnoredToggled);
buttonIgnored.IsImportant = true;
buttonIgnored.SetTooltip (tips, "Show Ignored Tests", "Show Ignored Tests");
toolbar.Insert (buttonIgnored, -1);
buttonOutput = new ToggleToolButton ();
buttonOutput.Label = "Output";
buttonOutput.Active = false;
buttonOutput.IconWidget = Runtime.Gui.Resources.GetImage (MonoDevelop.Gui.Stock.OutputIcon, IconSize.SmallToolbar);
buttonOutput.Toggled += new EventHandler (OnShowOutputToggled);
buttonOutput.IsImportant = true;
buttonOutput.SetTooltip (tips, "Show Output", "Show Output");
toolbar.Insert (buttonOutput, -1);
toolbar.Insert (new SeparatorToolItem (), -1);
buttonStop = new ToolButton ("gtk-stop");
toolbar.Insert (buttonStop, -1);
toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
toolbar.ShowArrow = false;
// Results notebook
book = new HPaned ();
panel.PackStart (book, true, true, 0);
// Failures tree
failuresTreeView = new TreeView ();
failuresTreeView.HeadersVisible = false;
failuresStore = new TreeStore (typeof(Pixbuf), typeof (string), typeof(object));
CellRendererPixbuf pr = new CellRendererPixbuf ();
CellRendererText tr = new CellRendererText ();
TreeViewColumn col = new TreeViewColumn ();
col.PackStart (pr, false);
col.AddAttribute (pr, "pixbuf", 0);
col.PackStart (tr, false);
col.AddAttribute (tr, "markup", 1);
failuresTreeView.AppendColumn (col);
failuresTreeView.Model = failuresStore;
Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow ();
sw.Add(failuresTreeView);
Frame frame = new Frame ();
frame.Add (sw);
book.Pack1 (frame, true, true);
outputView = new TextView();
outputView.Editable = false;
sw = new Gtk.ScrolledWindow ();
sw.Add(outputView);
frame = new Frame ();
frame.Add (sw);
book.Pack2 (frame, true, true);
outputViewScrolled = frame;
// Run panel
HBox runPanel = new HBox ();
runPanel.BorderWidth = 5;
infoSep = new VSeparator ();
resultLabel.UseMarkup = true;
runPanel.PackStart (resultLabel, false, false, 0);
runPanel.PackStart (progressBar, false, false, 0);
//.........这里部分代码省略.........
示例8: LogView
public LogView (string filepath, bool isDirectory, Revision [] history, Repository vc)
: base (Path.GetFileName (filepath) + " Log")
{
this.vc = vc;
this.filepath = filepath;
this.history = history;
try {
this.vinfo = vc.GetVersionInfo (filepath, false);
}
catch (Exception ex) {
MessageService.ShowException (ex, GettextCatalog.GetString ("Version control command failed."));
}
// Widget setup
VBox box = new VBox (false, 6);
widget = box;
// Create the toolbar
commandbar = new Toolbar ();
commandbar.ToolbarStyle = Gtk.ToolbarStyle.BothHoriz;
commandbar.IconSize = Gtk.IconSize.Menu;
box.PackStart (commandbar, false, false, 0);
if (vinfo != null) {
Gtk.ToolButton button = new Gtk.ToolButton (new Gtk.Image ("vc-diff", Gtk.IconSize.Menu), GettextCatalog.GetString ("View Changes"));
button.IsImportant = true;
if (isDirectory) {
button.Clicked += new EventHandler (DirDiffButtonClicked);
commandbar.Insert (button, -1);
} else {
button.Clicked += new EventHandler (DiffButtonClicked);
commandbar.Insert (button, -1);
button = new Gtk.ToolButton (new Gtk.Image (Gtk.Stock.Open, Gtk.IconSize.Menu), GettextCatalog.GetString ("View File"));
button.IsImportant = true;
button.Clicked += new EventHandler (ViewTextButtonClicked);
commandbar.Insert (button, -1);
}
}
revertButton = new Gtk.ToolButton (new Gtk.Image ("vc-revert-command", Gtk.IconSize.Menu), GettextCatalog.GetString ("Revert changes from this revision"));
revertButton.IsImportant = true;
revertButton.Sensitive = false;
revertButton.Clicked += new EventHandler (RevertRevisionClicked);
commandbar.Insert (revertButton, -1);
revertToButton = new Gtk.ToolButton (new Gtk.Image ("vc-revert-command", Gtk.IconSize.Menu), GettextCatalog.GetString ("Revert to this revision"));
revertToButton.IsImportant = true;
revertToButton.Sensitive = false;
revertToButton.Clicked += new EventHandler (RevertToRevisionClicked);
commandbar.Insert (revertToButton, -1);
// A paned with two trees
Gtk.VPaned paned = new Gtk.VPaned ();
box.PackStart (paned, true, true, 0);
// Create the log list
loglist = new TreeView ();
ScrolledWindow loglistscroll = new ScrolledWindow ();
loglistscroll.ShadowType = Gtk.ShadowType.In;
loglistscroll.Add (loglist);
loglistscroll.HscrollbarPolicy = PolicyType.Automatic;
loglistscroll.VscrollbarPolicy = PolicyType.Automatic;
paned.Add1 (loglistscroll);
((Paned.PanedChild)paned [loglistscroll]).Resize = true;
TreeView changedPaths = new TreeView ();
ScrolledWindow changedPathsScroll = new ScrolledWindow ();
changedPathsScroll.ShadowType = Gtk.ShadowType.In;
changedPathsScroll.HscrollbarPolicy = PolicyType.Automatic;
changedPathsScroll.VscrollbarPolicy = PolicyType.Automatic;
changedPathsScroll.Add (changedPaths);
paned.Add2 (changedPathsScroll);
((Paned.PanedChild)paned [changedPathsScroll]).Resize = false;
widget.ShowAll ();
// Revision list setup
CellRendererText textRenderer = new CellRendererText ();
textRenderer.Yalign = 0;
TreeViewColumn colRevNum = new TreeViewColumn (GettextCatalog.GetString ("Revision"), textRenderer, "text", 0);
TreeViewColumn colRevDate = new TreeViewColumn (GettextCatalog.GetString ("Date"), textRenderer, "text", 1);
TreeViewColumn colRevAuthor = new TreeViewColumn (GettextCatalog.GetString ("Author"), textRenderer, "text", 2);
TreeViewColumn colRevMessage = new TreeViewColumn (GettextCatalog.GetString ("Message"), textRenderer, "text", 3);
loglist.AppendColumn (colRevNum);
loglist.AppendColumn (colRevDate);
loglist.AppendColumn (colRevAuthor);
loglist.AppendColumn (colRevMessage);
ListStore logstore = new ListStore (typeof (string), typeof (string), typeof (string), typeof (string));
loglist.Model = logstore;
//.........这里部分代码省略.........
示例9: SingleView
public SingleView (Uri [] uris)
{
string glade_name = "single_view";
this.uri = uris [0];
System.Console.WriteLine ("uri = {0}", uri.ToString ());
xml = new Glade.XML (null, "f-spot.glade", glade_name, "f-spot");
xml.Autoconnect (this);
window = (Gtk.Window) xml.GetWidget (glade_name);
LoadPreference (Preferences.VIEWER_WIDTH);
LoadPreference (Preferences.VIEWER_MAXIMIZED);
Gtk.Toolbar toolbar = new Gtk.Toolbar ();
toolbar_hbox.PackStart (toolbar);
ToolButton rl_button = GtkUtil.ToolButtonFromTheme ("object-rotate-left", Catalog.GetString ("Rotate Left"), true);
rl_button.Clicked += HandleRotate270Command;
rl_button.SetTooltip (toolTips, Catalog.GetString ("Rotate photo left"), null);
toolbar.Insert (rl_button, -1);
ToolButton rr_button = GtkUtil.ToolButtonFromTheme ("object-rotate-right", Catalog.GetString ("Rotate Right"), true);
rr_button.Clicked += HandleRotate90Command;
rr_button.SetTooltip (toolTips, Catalog.GetString ("Rotate photo right"), null);
toolbar.Insert (rr_button, -1);
toolbar.Insert (new SeparatorToolItem (), -1);
ToolButton fs_button = GtkUtil.ToolButtonFromTheme ("view-fullscreen", Catalog.GetString ("Fullscreen"), true);
fs_button.Clicked += HandleViewFullscreen;
fs_button.SetTooltip (toolTips, Catalog.GetString ("View photos fullscreen"), null);
toolbar.Insert (fs_button, -1);
ToolButton ss_button = GtkUtil.ToolButtonFromTheme ("media-playback-start", Catalog.GetString ("Slideshow"), true);
ss_button.Clicked += HandleViewSlideshow;
ss_button.SetTooltip (toolTips, Catalog.GetString ("View photos in a slideshow"), null);
toolbar.Insert (ss_button, -1);
collection = new UriCollection (uris);
TargetEntry [] dest_table = { new TargetEntry ("text/uri-list", 0, 0),
new TargetEntry ("text/plain", 0, 1)};
directory_view = new FSpot.Widgets.IconView (collection);
directory_view.Selection.Changed += HandleSelectionChanged;
directory_view.DragDataReceived += HandleDragDataReceived;
Gtk.Drag.DestSet (directory_view, DestDefaults.All, dest_table,
DragAction.Copy | DragAction.Move);
directory_view.DisplayTags = false;
directory_view.DisplayDates = false;
directory_view.DisplayRatings = false;
directory_scrolled = new ScrolledWindow();
directory_scrolled.Add (directory_view);
sidebar = new Sidebar ();
info_vbox.Add (sidebar);
sidebar.AppendPage (directory_scrolled, Catalog.GetString ("Folder"), "gtk-directory");
AddinManager.AddExtensionNodeHandler ("/FSpot/Sidebar", OnSidebarExtensionChanged);
sidebar.Context = ViewContext.Single;
sidebar.CloseRequested += HandleHideSidePane;
sidebar.Show ();
ThumbnailGenerator.Default.OnPixbufLoaded += delegate { directory_view.QueueDraw (); };
image_view = new PhotoImageView (collection);
GtkUtil.ModifyColors (image_view);
GtkUtil.ModifyColors (image_scrolled);
image_view.ZoomChanged += HandleZoomChanged;
image_view.Item.Changed += HandleItemChanged;
image_view.ButtonPressEvent += HandleImageViewButtonPressEvent;
image_view.DragDataReceived += HandleDragDataReceived;
Gtk.Drag.DestSet (image_view, DestDefaults.All, dest_table,
DragAction.Copy | DragAction.Move);
image_scrolled.Add (image_view);
Window.ShowAll ();
zoom_scale.ValueChanged += HandleZoomScaleValueChanged;
LoadPreference (Preferences.VIEWER_SHOW_TOOLBAR);
LoadPreference (Preferences.VIEWER_INTERPOLATION);
LoadPreference (Preferences.VIEWER_TRANSPARENCY);
LoadPreference (Preferences.VIEWER_TRANS_COLOR);
ShowSidebar = collection.Count > 1;
LoadPreference (Preferences.VIEWER_SHOW_FILENAMES);
Preferences.SettingChanged += OnPreferencesChanged;
window.DeleteEvent += HandleDeleteEvent;
collection.Changed += HandleCollectionChanged;
// wrap the methods to fit to the delegate
//.........这里部分代码省略.........
示例10: CreateControlFromInfo
void CreateControlFromInfo ()
{
this.vc = info.Item.Repository;
this.filepath = info.Item.Path;
// Widget setup
VBox box = new VBox (false, 6);
widget = box;
// Create the toolbar
commandbar = new Toolbar ();
commandbar.ToolbarStyle = Gtk.ToolbarStyle.BothHoriz;
commandbar.IconSize = Gtk.IconSize.Menu;
box.PackStart (commandbar, false, false, 0);
if (vinfo != null) {
Gtk.ToolButton button = new Gtk.ToolButton (new Gtk.Image ("vc-diff", Gtk.IconSize.Menu), GettextCatalog.GetString ("View Changes"));
button.IsImportant = true;
button.Clicked += new EventHandler (DiffButtonClicked);
commandbar.Insert (button, -1);
button = new Gtk.ToolButton (new Gtk.Image (Gtk.Stock.Open, Gtk.IconSize.Menu), GettextCatalog.GetString ("View File"));
button.IsImportant = true;
button.Clicked += new EventHandler (ViewTextButtonClicked);
commandbar.Insert (button, -1);
}
revertButton = new Gtk.ToolButton (new Gtk.Image ("vc-revert-command", Gtk.IconSize.Menu), GettextCatalog.GetString ("Revert changes from this revision"));
revertButton.IsImportant = true;
revertButton.Sensitive = false;
revertButton.Clicked += new EventHandler (RevertRevisionClicked);
commandbar.Insert (revertButton, -1);
revertToButton = new Gtk.ToolButton (new Gtk.Image ("vc-revert-command", Gtk.IconSize.Menu), GettextCatalog.GetString ("Revert to this revision"));
revertToButton.IsImportant = true;
revertToButton.Sensitive = false;
revertToButton.Clicked += new EventHandler (RevertToRevisionClicked);
commandbar.Insert (revertToButton, -1);
// A paned with two trees
Gtk.VPaned paned = new Gtk.VPaned ();
box.PackStart (paned, true, true, 0);
// Create the log list
loglist = new TreeView ();
ScrolledWindow loglistscroll = new ScrolledWindow ();
loglistscroll.ShadowType = Gtk.ShadowType.In;
loglistscroll.Add (loglist);
loglistscroll.HscrollbarPolicy = PolicyType.Automatic;
loglistscroll.VscrollbarPolicy = PolicyType.Automatic;
paned.Add1 (loglistscroll);
((Paned.PanedChild)paned [loglistscroll]).Resize = true;
TreeView changedPaths = new TreeView ();
ScrolledWindow changedPathsScroll = new ScrolledWindow ();
changedPathsScroll.ShadowType = Gtk.ShadowType.In;
changedPathsScroll.HscrollbarPolicy = PolicyType.Automatic;
changedPathsScroll.VscrollbarPolicy = PolicyType.Automatic;
changedPathsScroll.Add (changedPaths);
paned.Add2 (changedPathsScroll);
((Paned.PanedChild)paned [changedPathsScroll]).Resize = false;
widget.ShowAll ();
// Revision list setup
CellRendererText textRenderer = new CellRendererText ();
textRenderer.Yalign = 0;
TreeViewColumn colRevNum = new TreeViewColumn (GettextCatalog.GetString ("Revision"), textRenderer, "text", 0);
colRevNum.Resizable = true;
TreeViewColumn colRevDate = new TreeViewColumn (GettextCatalog.GetString ("Date"), textRenderer, "text", 1);
colRevDate.Resizable = true;
TreeViewColumn colRevAuthor = new TreeViewColumn (GettextCatalog.GetString ("Author"), textRenderer, "text", 2);
colRevAuthor.Resizable = true;
TreeViewColumn colRevMessage = new TreeViewColumn (GettextCatalog.GetString ("Message"), textRenderer, "text", 3);
colRevMessage.Resizable = true;
loglist.AppendColumn (colRevNum);
loglist.AppendColumn (colRevDate);
loglist.AppendColumn (colRevAuthor);
loglist.AppendColumn (colRevMessage);
logstore = new ListStore (typeof (string), typeof (string), typeof (string), typeof (string));
loglist.Model = logstore;
// Changed paths list setup
changedpathstore = new ListStore (typeof(Gdk.Pixbuf), typeof (string), typeof(Gdk.Pixbuf), typeof (string));
changedPaths.Model = changedpathstore;
TreeViewColumn colOperation = new TreeViewColumn ();
CellRendererText crt = new CellRendererText ();
var crp = new CellRendererPixbuf ();
//.........这里部分代码省略.........
示例11: FullScreenView
public FullScreenView(IBrowsableCollection collection, Gtk.Window parent)
: base("Full Screen Mode")
{
//going fullscreen on the same screen the parent window
Gdk.Screen screen = Screen;
int monitor = screen.GetMonitorAtWindow (parent.GdkWindow);
Gdk.Rectangle bounds = screen.GetMonitorGeometry (monitor);
Move (bounds.X, bounds.Y);
string style = "style \"test\" {\n" +
"GtkToolbar::shadow_type = GTK_SHADOW_NONE\n" +
"}\n" +
"class \"GtkToolbar\" style \"test\"";
Gtk.Rc.ParseString (style);
Name = "FullscreenContainer";
try {
//scroll = new Gtk.ScrolledWindow (null, null);
actions = new ActionGroup ("joe");
actions.Add (new ActionEntry [] {
new ActionEntry (HideToolbar, Stock.Close,
Catalog.GetString ("Hide"),
null,
Catalog.GetString ("Hide toolbar"),
HideToolbarAction)});
actions.Add (new ToggleActionEntry [] {
new ToggleActionEntry (Info,
Stock.Info,
Catalog.GetString ("Info"),
null,
Catalog.GetString ("Image information"),
InfoAction,
false)});
Gtk.Action exit_full_screen = new Gtk.Action (ExitFullScreen,
Catalog.GetString ("Exit fullscreen"),
null,
null);
exit_full_screen.IconName = "view-restore";
exit_full_screen.Activated += ExitAction;
actions.Add (exit_full_screen);
Gtk.Action slide_show = new Gtk.Action (SlideShow,
Catalog.GetString ("Slideshow"),
Catalog.GetString ("Start slideshow"),
null);
slide_show.IconName = "media-playback-start";
slide_show.Activated += SlideShowAction;
actions.Add (slide_show);
new WindowOpacityFader (this, 1.0, 600);
notebook = new Notebook ();
notebook.ShowBorder = false;
notebook.ShowTabs = false;
notebook.Show ();
scroll = new ScrolledView ();
scroll.ScrolledWindow.SetPolicy (PolicyType.Never, PolicyType.Never);
view = new PhotoImageView (collection);
// FIXME this should be handled by the new style setting code
view.ModifyBg (Gtk.StateType.Normal, this.Style.Black);
this.Add (notebook);
view.Show ();
view.MotionNotifyEvent += HandleViewMotion;
view.PointerMode = PointerMode.Scroll;
scroll.ScrolledWindow.Add (view);
Toolbar tbar = new Toolbar ();
tbar.ToolbarStyle = Gtk.ToolbarStyle.BothHoriz;
tbar.ShowArrow = false;
tbar.BorderWidth = 15;
ToolItem t_item = (actions [ExitFullScreen]).CreateToolItem () as ToolItem;
t_item.IsImportant = true;
tbar.Insert (t_item, -1);
Gtk.Action action = new PreviousPictureAction (view.Item);
actions.Add (action);
tbar.Insert (action.CreateToolItem () as ToolItem, -1);
play_pause_button = (actions [SlideShow]).CreateToolItem () as ToolButton;
tbar.Insert (play_pause_button, -1);
action = new NextPictureAction (view.Item);
actions.Add (action);
tbar.Insert (action.CreateToolItem () as ToolItem, -1);
t_item = new ToolItem ();
t_item.Child = new Label (Catalog.GetString ("Slide transition:"));
tbar.Insert (t_item, -1);
display = new SlideShow (view.Item);
display.AddEvents ((int) (Gdk.EventMask.PointerMotionMask));
display.ModifyBg (Gtk.StateType.Normal, this.Style.Black);
display.MotionNotifyEvent += HandleViewMotion;
//.........这里部分代码省略.........
示例12: MainWindow
public MainWindow()
{
ToolItem spacerItem;
FileSearchEntry searchEntry;
ToolItem searchEntryItem;
Alignment searchEntryBox;
object[] attrs= Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), true);
AssemblyTitleAttribute attr = (AssemblyTitleAttribute)attrs[0];
AssemblyName asmName = Assembly.GetExecutingAssembly().GetName();
string title = String.Format ("{0} (BETA) {1} (Protocol Version: {2})",
attr.Title, asmName.Version,
Core.ProtocolVersion);
// Create the interface
window = new Window (title);
window.SetDefaultSize (850, 550);
window.DeleteEvent += on_win_delete;
window.ConfigureEvent += on_MainWindow_configure_event;
window.FocusInEvent += window_FocusInEvent;
((ToggleAction)Runtime.BuiltinActions["ToggleMainToolbar"]).Active = Gui.Settings.ShowToolbar;
Runtime.BuiltinActions["ToggleMainToolbar"].Activated += ToggleMainToolbar_Activated;
((ToggleAction)Runtime.BuiltinActions["ToggleMainStatusbar"]).Active = Gui.Settings.ShowStatusBar;
Runtime.BuiltinActions["ToggleMainStatusbar"].Activated += ToggleMainStatusbar_Activated;
window.AddAccelGroup (Runtime.UIManager.AccelGroup);
mainVBox = new VBox ();
window.Add (mainVBox);
mainVBox.Show ();
if (Common.OSName == "Darwin") {
MenuBar menubar = (MenuBar) Runtime.UIManager.GetWidget ("/OSXAppMenu");
Imendio.MacIntegration.Menu.SetMenuBar(menubar);
MenuItem preferencesItem = (MenuItem) Runtime.UIManager.GetWidget ("/OSXAppMenu/NetworkMenu/Preferences");
MenuItem aboutItem = (MenuItem) Runtime.UIManager.GetWidget ("/OSXAppMenu/NetworkMenu/About");
IntPtr group = Imendio.MacIntegration.Menu.AddAppMenuGroup();
Imendio.MacIntegration.Menu.AddAppMenuItem(group, aboutItem, "About Meshwork");
group = Imendio.MacIntegration.Menu.AddAppMenuGroup();
Imendio.MacIntegration.Menu.AddAppMenuItem(group, preferencesItem, "Preferences");
MenuItem quitItem = (MenuItem) Runtime.UIManager.GetWidget ("/OSXAppMenu/NetworkMenu/Quit");
Imendio.MacIntegration.Menu.SetQuitMenuItem(quitItem);
} else {
MenuBar menubar = (MenuBar) Runtime.UIManager.GetWidget ("/MainWindowMenuBar");
mainVBox.PackStart (menubar, false, false, 0);
menubar.Show ();
}
toolbar = (Toolbar) Runtime.UIManager.GetWidget ("/MainWindowToolbar");
toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
toolbar.IconSize = IconSize.LargeToolbar;
spacerItem = new ToolItem();
spacerItem.Expand = true;
toolbar.Insert(spacerItem, -1);
spacerItem.Show();
searchEntry = new FileSearchEntry();
searchEntryBox = new Alignment(0.5f, 0.5f, 0, 0);
searchEntryBox.LeftPadding = 4;
searchEntryBox.RightPadding = 1;
searchEntryBox.Add(searchEntry);
searchEntryItem = new ToolItem();
searchEntryItem.Add(searchEntryBox);
toolbar.Insert(searchEntryItem, -1);
searchEntryItem.ShowAll();
mainVBox.PackStart (toolbar, false, false, 0);
mainPaned = new HPaned();
mainPaned.Mapped += delegate (object sender, EventArgs args) {
// XXX: Remember the user's last setting instead
mainPaned.Position = 190;
// Set some colors
//infoBoxSeparator.ModifyBg(StateType.Normal, GtkHelper.DarkenColor (mainbar.Style.Background(StateType.Normal), 2));
//infoSwitcherTree.ModifyBase(StateType.Normal, infoSwitcherTree.Style.Base(StateType.Active));
//infoSwitcherTree.ModifyBase(StateType.Active, infoBoxSeparator.Style.Base(StateType.Selected));
};
mainPaned.Show();
mainVBox.PackStart (mainPaned, true, true, 0);
// Create page notebook
pageNotebook = new Notebook();
pageNotebook.ShowTabs = false;
pageNotebook.ShowBorder = false;
mainPaned.Pack2(pageNotebook, true, true);
pageNotebook.ShowAll();
//.........这里部分代码省略.........
示例13: Toolbox
public Toolbox(ServiceContainer parentServices)
{
this.parentServices = parentServices;
//we need this service, so create it if not present
toolboxService = parentServices.GetService (typeof (IToolboxService)) as ToolboxService;
if (toolboxService == null) {
toolboxService = new ToolboxService ();
parentServices.AddService (typeof (IToolboxService), toolboxService);
}
#region Toolbar
toolbar = new Toolbar ();
toolbar.ToolbarStyle = ToolbarStyle.Icons;
toolbar.IconSize = IconSize.SmallToolbar;
base.PackStart (toolbar, false, false, 0);
filterToggleButton = new ToggleToolButton ();
filterToggleButton.IconWidget = new Image (Stock.MissingImage, IconSize.SmallToolbar);
filterToggleButton.Toggled += new EventHandler (toggleFiltering);
toolbar.Insert (filterToggleButton, 0);
catToggleButton = new ToggleToolButton ();
catToggleButton.IconWidget = new Image (Stock.MissingImage, IconSize.SmallToolbar);
catToggleButton.Toggled += new EventHandler (toggleCategorisation);
toolbar.Insert (catToggleButton, 1);
SeparatorToolItem sep = new SeparatorToolItem();
toolbar.Insert (sep, 2);
filterEntry = new Entry();
filterEntry.WidthRequest = 150;
filterEntry.Changed += new EventHandler (filterTextChanged);
#endregion
scrolledWindow = new ScrolledWindow ();
base.PackEnd (scrolledWindow, true, true, 0);
//Initialise model
store = new ToolboxStore ();
//initialise view
nodeView = new NodeView (store);
nodeView.Selection.Mode = SelectionMode.Single;
nodeView.HeadersVisible = false;
//cell renderers
CellRendererPixbuf pixbufRenderer = new CellRendererPixbuf ();
CellRendererText textRenderer = new CellRendererText ();
textRenderer.Ellipsize = Pango.EllipsizeMode.End;
//Main column with text, icons
TreeViewColumn col = new TreeViewColumn ();
col.PackStart (pixbufRenderer, false);
col.SetAttributes (pixbufRenderer,
"pixbuf", ToolboxStore.Columns.Icon,
"visible", ToolboxStore.Columns.IconVisible,
"cell-background-gdk", ToolboxStore.Columns.BackgroundColour);
col.PackEnd (textRenderer, true);
col.SetAttributes (textRenderer,
"text", ToolboxStore.Columns.Label,
"weight", ToolboxStore.Columns.FontWeight,
"cell-background-gdk", ToolboxStore.Columns.BackgroundColour);
nodeView.AppendColumn (col);
//Initialise self
scrolledWindow.VscrollbarPolicy = PolicyType.Automatic;
scrolledWindow.HscrollbarPolicy = PolicyType.Never;
scrolledWindow.WidthRequest = 150;
scrolledWindow.AddWithViewport (nodeView);
//selection events
nodeView.NodeSelection.Changed += OnSelectionChanged;
nodeView.RowActivated += OnRowActivated;
//update view when toolbox service updated
toolboxService.ToolboxChanged += new EventHandler (tbsChanged);
Refresh ();
//track expanded state of nodes
nodeView.RowCollapsed += new RowCollapsedHandler (whenRowCollapsed);
nodeView.RowExpanded += new RowExpandedHandler (whenRowExpanded);
//set initial state
filterToggleButton.Active = false;
catToggleButton.Active = true;
}
示例14: MainWindow
//
// Constructor
//
public MainWindow (Db db)
{
foreach (ServiceNode service in AddinManager.GetExtensionNodes ("/FSpot/Services")) {
try {
service.Initialize ();
service.Start ();
} catch (Exception e) {
Log.WarningFormat ("Something went wrong while starting the {0} extension.", service.Id);
Log.DebugException (e);
}
}
Database = db;
GtkBeans.Builder builder = new GtkBeans.Builder ("main_window.ui");
builder.Autoconnect (this);
//Set the global DefaultColormap. Allows transparency according
//to the theme (work on murrine engine)
Gdk.Colormap colormap = ((Widget)main_window).Screen.RgbaColormap;
if (colormap == null) {
Log.Debug ("Your screen doesn't support alpha channels!");
colormap = ((Widget)main_window).Screen.RgbColormap;
}
Gtk.Widget.DefaultColormap = colormap;
LoadPreference (Preferences.MAIN_WINDOW_WIDTH);
LoadPreference (Preferences.MAIN_WINDOW_X);
LoadPreference (Preferences.MAIN_WINDOW_MAXIMIZED);
main_window.ShowAll ();
LoadPreference (Preferences.SIDEBAR_POSITION);
LoadPreference (Preferences.METADATA_EMBED_IN_IMAGE);
pagesetup_menu_item.Activated += HandlePageSetupActivated;
toolbar = new Gtk.Toolbar ();
toolbar_vbox.PackStart (toolbar);
ToolButton import_button = GtkUtil.ToolButtonFromTheme ("gtk-add", Catalog.GetString ("Import Photos…"), true);
import_button.Clicked += (o, args) => StartImport (null);
import_button.TooltipText = Catalog.GetString ("Import new photos");
toolbar.Insert (import_button, -1);
toolbar.Insert (new SeparatorToolItem (), -1);
rl_button = GtkUtil.ToolButtonFromTheme ("object-rotate-left", Catalog.GetString ("Rotate Left"), false);
rl_button.Clicked += HandleRotate270Command;
toolbar.Insert (rl_button, -1);
rr_button = GtkUtil.ToolButtonFromTheme ("object-rotate-right", Catalog.GetString ("Rotate Right"), false);
rr_button.Clicked += HandleRotate90Command;
toolbar.Insert (rr_button, -1);
toolbar.Insert (new SeparatorToolItem (), -1);
browse_button = new ToggleToolButton ();
browse_button.Label = Catalog.GetString ("Browsing");
browse_button.IconName = "mode-browse";
browse_button.IsImportant = true;
browse_button.Toggled += HandleToggleViewBrowse;
browse_button.TooltipText = Catalog.GetString ("Browse your photo library");
toolbar.Insert (browse_button, -1);
edit_button = new ToggleToolButton ();
edit_button.Label = Catalog.GetString ("Editing");
edit_button.IconName = "mode-image-edit";
edit_button.IsImportant = true;
edit_button.Toggled += HandleToggleViewPhoto;
edit_button.TooltipText = Catalog.GetString ("Edit your photos");
toolbar.Insert (edit_button, -1);
toolbar.Insert (new SeparatorToolItem (), -1);
ToolButton fs_button = GtkUtil.ToolButtonFromTheme ("view-fullscreen", Catalog.GetString ("Fullscreen"), false);
fs_button.Clicked += HandleViewFullscreen;
fs_button.TooltipText = Catalog.GetString ("View photos fullscreen");
toolbar.Insert (fs_button, -1);
ToolButton ss_button = GtkUtil.ToolButtonFromTheme ("media-playback-start", Catalog.GetString ("Slideshow"), false);
ss_button.Clicked += HandleViewSlideShow;
ss_button.TooltipText = Catalog.GetString ("View photos in a slideshow");
toolbar.Insert (ss_button, -1);
SeparatorToolItem white_space = new SeparatorToolItem ();
white_space.Draw = false;
white_space.Expand = true;
toolbar.Insert (white_space, -1);
ToolItem label_item = new ToolItem ();
count_label = new Label (String.Empty);
label_item.Child = count_label;
toolbar.Insert (label_item, -1);
display_previous_button = new ToolButton (Stock.GoBack);
toolbar.Insert (display_previous_button, -1);
display_previous_button.TooltipText = Catalog.GetString ("Previous photo");
//.........这里部分代码省略.........
示例15: CreateStatusbar
private void CreateStatusbar()
{
statusBar = new Toolbar();
statusBar.ShowArrow = false;
statusBar.ToolbarStyle = ToolbarStyle.BothHoriz;
statusBar.ExposeEvent += StatusBarExposeEvent;
statusLabel = new Label();
statusLabel.Xalign = 0;
statusLabel.Xpad = 6;
ToolItem statusLabelItem = new ToolItem();
Alignment statusAlign = new Alignment(0.5f, 0.5f, 1.0f, 1.0f);
statusLabelItem.Add(statusLabel);
statusLabelItem.Expand = true;
statusBar.Insert(statusLabelItem, -1);
statusLabelItem.ShowAll();
taskStatusIcon = new Hyena.Widgets.AnimatedImage();
taskStatusIcon.Pixbuf = Gui.LoadIcon(22, "process-working");
taskStatusIcon.FrameHeight = 22;
taskStatusIcon.FrameWidth = 22;
taskStatusIcon.Load();
EventBox taskStatusIconBox = new EventBox();
taskStatusIconBox.MotionNotifyEvent += delegate {
UpdateTaskStatusIcon();
};
taskStatusIconBox.ButtonReleaseEvent += delegate {
IndexingStatusWindow.Instance.Show();
};
taskStatusIconBox.SizeAllocated += delegate (object o, SizeAllocatedArgs args) {
statusAlign.LeftPadding = (uint)args.Allocation.Width;
};
taskStatusIconBox.SetSizeRequest(22, 22);
taskStatusIconBox.Add(taskStatusIcon);
taskStatusIconBox.Show();
ToolItem taskStatusIconItem = new ToolItem();
taskStatusIconItem.Add(taskStatusIconBox);
statusBar.Insert(taskStatusIconItem, -1);
taskStatusIconItem.Show();
mainVBox.PackStart(statusBar, false, false, 0);
UpdateTaskStatusIcon();
UpdateStatusText();
}