本文整理汇总了C#中Gtk.Toolbar.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Toolbar.Add方法的具体用法?C# Toolbar.Add怎么用?C# Toolbar.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Toolbar
的用法示例。
在下文中一共展示了Toolbar.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addToolbars
/// <summary>
/// reads the given config file and creates toolbars and buttons
/// </summary>
/// <param name='frame'>
/// Frame.
/// </param>
public static void addToolbars(Toolbar toolbar, String configfile, bool hookdelegates, Type type = null, object callingObject=null)
{
String xpath = "//toolbar";
if (type != null)
{
xpath += "[@class='" + type.ToString() + "']";
} else
{
xpath += "[not(@class)]";
}
Console.WriteLine ("addToolbars:" + configfile + xpath);
XmlNodeList lst = Sharpend.Configuration.ConfigurationManager.getValues(configfile, xpath);
foreach (XmlNode nd in lst)
{
XmlNodeList btns = nd.SelectNodes(".//button");
foreach (XmlNode bn in btns)
{
String classname = XmlHelper.getAttributeValue(bn,"class");
String assembly = XmlHelper.getAttributeValue(bn,"assembly");
String icon = XmlHelper.getAttributeValue(bn,"icon");
String btn_title = XmlHelper.getAttributeValue(bn,"title");
String stock_id = XmlHelper.getAttributeValue(bn,"stock_id");
String eventargs = XmlHelper.getAttributeValue(bn,"eventargs");
String buttonname = XmlHelper.getAttributeValue(bn,"name");
Widget btn = createButton(classname,assembly,icon,btn_title,stock_id, eventargs);
if (btn != null)
{
btn.Visible = true;
toolbar.Add(btn);
if (hookdelegates)
{
hookDelegates(bn,btn, callingObject);
}
if (!String.IsNullOrEmpty(buttonname))
{
btn.Name = buttonname;
}
}
}
}
}
示例2: CreateFindbar
private void CreateFindbar()
{
// FindEntry
find_entry = new Gtk.Entry ();
//find_entry.Activated += new EventHandler(on_uri_activate);
Gtk.ToolItem find_item = new Gtk.ToolItem ();
//find_item.Expand = true;
find_item.Add (find_entry);
// Toolbar
findbar = new Toolbar ();
findbar.ToolbarStyle = ToolbarStyle.Icons;
findbar.Orientation = Orientation.Horizontal;
findbar.ShowArrow = true;
// Toolbar Itens
findbar.Add (action_stop.CreateToolItem());
findbar.Add (find_item);
findbar.Add (action_back.CreateToolItem());
findbar.Add (action_forward.CreateToolItem());
}
示例3: SqlQueryView
public SqlQueryView ()
{
stoppedQueries = new List<object> ();
MonoDevelop.SourceEditor.Extension.TemplateExtensionNodeLoader.Init ();
this.UntitledName = string.Concat (AddinCatalog.GetString ("Untitled Sql Script"), ".sql");
vbox = new VBox (false, 6);
vbox.BorderWidth = 6;
Toolbar toolbar = new Toolbar ();
toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
buttonExecute = new ToolButton (ImageService.GetImage ("md-db-execute", IconSize.SmallToolbar),
AddinCatalog.GetString ("_Execute"));
buttonExecute.Label = AddinCatalog.GetString ("Execute");
buttonExecute.Sensitive = false;
buttonExecute.TooltipMarkup = AddinCatalog.GetString ("Execute Query");
buttonExecute.IsImportant = true;
buttonExecute.Clicked += new EventHandler (ExecuteClicked);
buttonStop = new ToolButton ("gtk-stop");
buttonStop.TooltipText = AddinCatalog.GetString ("Stop Query Execution");
buttonStop.Sensitive = false;
buttonStop.Clicked += new EventHandler (StopClicked);
buttonClear = new ToolButton (ImageService.GetImage ("gtk-clear", IconSize.Button),
AddinCatalog.GetString ("Clear Results"));
buttonClear.TooltipText = AddinCatalog.GetString ("Clear Results");
buttonClear.Clicked += new EventHandler (ClearClicked);
comboConnections = new DatabaseConnectionContextComboBox ();
selectedConnection = comboConnections.DatabaseConnection;
comboConnections.Changed += new EventHandler (ConnectionChanged);
ToolItem comboItem = new ToolItem ();
comboItem.Child = comboConnections;
toolbar.Add (buttonExecute);
toolbar.Add (buttonStop);
toolbar.Add (buttonClear);
toolbar.Add (new SeparatorToolItem ());
toolbar.Add (comboItem);
pane = new VPaned ();
// Sql History Window
ScrolledWindow windowHistory = new ScrolledWindow ();
history = new SqlEditorWidget ();
history.Editable = false;
windowHistory.AddWithViewport (history);
// Status of the Last Query
ScrolledWindow windowStatus = new ScrolledWindow ();
status = new TextView ();
windowStatus.Add (status);
notebook = new Notebook ();
notebook.AppendPage (windowStatus, new Label (AddinCatalog.GetString ("Status")));
notebook.AppendPage (windowHistory, new Label (AddinCatalog.GetString ("Query History")));
pane.Pack2 (notebook, true, true);
vbox.PackStart (toolbar, false, true, 0);
vbox.PackStart (pane, true, true, 0);
this.Document.TextReplaced += SqlChanged;
vbox.ShowAll ();
Document.DocumentUpdated += delegate (object sender, EventArgs args) {
// Default mime type or a provider defined.
if (selectedConnection == null)
Document.MimeType = "text/x-sql";
else
Document.MimeType = GetMimeType ();
};
notebook.Hide ();
}
示例4: GetFeed
static void GetFeed(string ticket)
{
nv = new NameValueCollection ();
nv.Add ("ticket", ticket);
XmlNodeList nl = Request (
"http://live.nicovideo.jp/api/getalertstatus",
@"//communities|//addr|//port|//thread",
nv);
if (nl.Count == 0) {
Console.WriteLine ("チケットの値が不正です");
LoginRequest ();
return;
}
Server sv = new Server ();
Notebook nb = new Notebook ();
nb.AppendPage(sv.Page_all (), new MultiTab("最新の放送",nb));
nb.AppendPage(sv.Page_mylist (), new MultiTab("お気に入り",nb));
nb.AppendPage(Page_tab ("common"), new MultiTab("タブ(一般)",nb));
nb.AppendPage(Page_tab ("live"), new MultiTab("タブ(ゲーム)",nb));
nb.AppendPage(Page_tab ("face"), new MultiTab("タブ(顔出し)",nb));
nb.AppendPage(Page_tab ("totu"), new MultiTab("タブ(凸待ち)",nb));
nb.AppendPage(Page_tab ("req"), new MultiTab("タブ(動画紹介)",nb));
nb.AppendPage(Page_tab ("try"), new MultiTab("タブ(やってみた)",nb));
nb.AppendPage(Page_tab ("r18"), new MultiTab("タブ(R―18)",nb));
//nb.SwitchPage += (sender, e) => PageChangedEvent(sender, e);
Gtk.Window window = new Gtk.Window ("ニコ生フィーダー v1.0");
window.DeleteEvent += new DeleteEventHandler (OnQuit);
window.SetSizeRequest (300, 550);
window.KeepAbove = true;
Toolbar bar = new Toolbar ();
ToggleToolButton sendBackBtn = new ToggleToolButton ();
sendBackBtn.Toggled += (sender, e) => SendBack(sender, e, ref window);
sendBackBtn.TooltipText = "最前面での固定を解除";
ToggleToolButton logoutBtn = new ToggleToolButton ();
logoutBtn.TooltipText = "ログアウト";
logoutBtn.Clicked += (sender, e) => Logout(sender, e, ref window);
bar.HeightRequest = 25;
Gtk.Image img = new Gtk.Image();
img.Pixbuf = new Gdk.Pixbuf("go_back.png",12,12);
sendBackBtn.IconWidget = img;
Gtk.Image img2 = new Gtk.Image();
img2.Pixbuf = new Gdk.Pixbuf("logout.png",16,16);
logoutBtn.IconWidget = img2;
logoutBtn.HeightRequest = 25;
sendBackBtn.HeightRequest = 25;
bar.Add (logoutBtn);
bar.Add (sendBackBtn);
bar.ShowAll ();
VBox vbox = new VBox(false, 0);
vbox.PackStart (bar, false, true, 0);
vbox.PackStart (nb, true, true, 0);
window.Add (vbox);
window.ShowAll ();
window.Focus = nb;
MainClass.communities = nl [0].InnerText;
sv.receiveFromServer (nl [1].InnerText, nl [2].InnerText, nl [3].InnerText);
}
示例5: DisplayWindow
public DisplayWindow()
: base(WindowType.Toplevel)
{
MenuBar mb = new MenuBar();
MenuItem mi_file = new MenuItem("File");
Menu m_file = new Menu();
MenuItem mi_file_opendll = new MenuItem("Connect with algorithm library...");
mi_file_opendll.Activated += openLibFile;
MenuItem mi_file_openxml = new MenuItem("Open configuration file...");
mi_file_openxml.Activated += openConfigFile;
MenuItem mi_file_quit = new MenuItem("Quit");
mi_file_quit.Activated += delegate {
Application.Quit();
};
MenuItem mi_edit = new MenuItem("Edit");
Menu m_edit = new Menu();
RadioMenuItem mi_edit_move = new RadioMenuItem("Move nodes");
RadioMenuItem mi_edit_insp = new RadioMenuItem(mi_edit_move, "Inspect node");
MenuItem mi_edit_play = new ImageMenuItem(Stock.MediaPlay, null);
MenuItem mi_edit_pause = new ImageMenuItem(Stock.MediaPause, null);
mb.Add(mi_file);
mi_file.Submenu = m_file;
m_file.Add(mi_file_opendll);
m_file.Add(mi_file_openxml);
m_file.Add(new SeparatorMenuItem());
m_file.Add(mi_file_quit);
mi_edit.Submenu = m_edit;
m_edit.Add(mi_edit_move);
m_edit.Add(mi_edit_insp);
m_edit.Add(new SeparatorMenuItem());
m_edit.Add(mi_edit_play);
m_edit.Add(mi_edit_pause);
mb.Add(mi_edit);
Toolbar tb = new Toolbar();
StockItem si;
StockManager.Lookup(Stock.MediaPlay, ref si);
ToolButton tb_opendll = new ToolButton(Stock.Connect);
tb_opendll.Clicked += openLibFile;
ToolButton tb_openxml = new ToolButton(Stock.Open);
tb_openxml.Clicked += openConfigFile;
ToolButton tb_move = new ToggleToolButton(Stock.Preferences);
ToolButton tb_insp = new ToggleToolButton(Stock.ZoomIn);
ToolButton tb_play = new ToolButton(Stock.MediaPlay);
ToolButton tb_pause = new ToolButton(Stock.MediaPause);
tb.Add(tb_opendll);
tb.Add(tb_openxml);
tb.Add(new SeparatorToolItem());
tb.Add(tb_move);
tb.Add(tb_insp);
tb.Add(new SeparatorToolItem());
tb.Add(tb_play);
tb.Add(tb_pause);
this.bpsp = new BlueprintParallelStatePainter();
this.bm = new BlueprintMediabar();
this.bm.CurrentChanged += HandleBmhandleCurrentChanged;
this.bm.CurrentChanged += this.bpsp.RepaintEdges;
this.bs = new BlueprintTabControl(1, 1, 1);
this.bs.CurrentChanged += HandleBshandleCurrentChanged;
;
vb.PackStart(mb, false, false, 0x00);
vb.PackStart(tb, false, false, 0x00);
vb.PackStart(this.bpsp, true, true, 0x00);
vb.PackStart(this.bm, false, false, 0x00);
vb.PackStart(this.bs, false, false, 0x00);
this.Title = "Parallel Visualizer";
this.Resize(640, 480);
this.Add(vb);
this.ShowAll();
}
示例6: MessageView
public MessageView(String messagebox)
{
this.messagebox = messagebox;
messagesWindow = new ScrolledWindow();
messagesWindow.ShadowType = ShadowType.EtchedIn;
messagesWindow.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
treeviewMessages = new TreeView();
treeviewMessages.BorderWidth = 0;
treeviewMessages.AppendColumn ("Site", new CellRendererText(), "text", 2).Resizable = true;;
treeviewMessages.AppendColumn ("User", new CellRendererText(), "text", 3).Resizable = true;;
treeviewMessages.AppendColumn ("Subject", new CellRendererText(), "text", 4).Resizable = true;;
treeviewMessages.AppendColumn ("Date", new CellRendererText(), "text", 5).Resizable = true;;
treeviewMessages.RowActivated += treeviewMessages_RowActivated;
messagesWindow.Add(treeviewMessages);
this.Add1 (messagesWindow);
contentBox = new VBox(false, 0);
Toolbar toolbar = new Toolbar();
toolbar.HeightRequest = 38;
toolbar.ToolbarStyle = ToolbarStyle.Icons;
toolbar.BorderWidth = 0;
Image tmpimage = new Image();
tmpimage.Pixbuf = new Gdk.Pixbuf(".images/icon_up.png");
upbtn = new ToolButton(tmpimage, "");
upbtn.TooltipText = "Expand view to top";
upbtn.Clicked += upbtn_Clicked;
Image tmpimage2 = new Image();
tmpimage2.Pixbuf = new Gdk.Pixbuf(".images/icon_down.png");
downbtn = new ToolButton(tmpimage2, "");
downbtn.TooltipText = "Split view";
downbtn.Clicked += downbtn_Clicked;
Image tmpimage3 = new Image();
tmpimage3.Pixbuf = new Gdk.Pixbuf(".images/reply.png");
replybtn = new ToolButton(tmpimage3, "");
replybtn.TooltipText = "Reply to sender";
SeparatorToolItem sepSpacer = new SeparatorToolItem();
sepSpacer.Expand = true;
sepSpacer.Draw = false;
messageWindow = new ScrolledWindow();
messagebrowser = new WebView();
messagebrowser.Editable = false;
messageWindow.Add(messagebrowser);
contentBox.PackStart(toolbar, false, false, 0);
contentBox.PackStart(messageWindow);
toolbar.Add(replybtn);
toolbar.Add(sepSpacer);
toolbar.Add(upbtn);
toolbar.Add(downbtn);
this.Add2(contentBox);
this.ShowAll();
downbtn.Hide ();
replybtn.Sensitive = false;
treestoreMessages = new TreeStore (typeof(string),typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
forums = new List<Forum> ();
getBoxMessages(messagebox);
treestoreMessages.AppendValues("000", "000", "SharpTalk", "Admin", "Welcome to SharpTalk", "");
treestoreMessages.SetSortColumnId(5, SortType.Descending);
treeviewMessages.Model = treestoreMessages;
}
示例7: ForumView
public ForumView(Forum site, String forum)
{
this.site = site;
this.forum = forum;
this.Destroyed += delegate(object sender, EventArgs e) {
if (iconThread != null)
if (iconThread.IsAlive)
iconThread.Abort ();
};
topicWindow = new ScrolledWindow ();
topicWindow.ShadowType = ShadowType.EtchedIn;
topicWindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
treeviewTopics = new TreeView ();
treeviewTopics.BorderWidth = 0;
treeviewTopics.AppendColumn ("", new CellRendererPixbuf (), "pixbuf", 5);
CellRendererText cellTopic = new CellRendererText ();
TreeViewColumn topicCol = treeviewTopics.AppendColumn ("Topic", cellTopic, "text", 1);
topicCol.SetCellDataFunc (cellTopic, new Gtk.TreeCellDataFunc (renderTopic));
topicCol.Resizable = true;
treeviewTopics.AppendColumn ("Author", new CellRendererText (), "text", 2).Resizable = true;
;
treeviewTopics.AppendColumn ("Replies", new CellRendererText (), "text", 3).Resizable = true;
;
treeviewTopics.AppendColumn ("Last Reply", new CellRendererText (), "text", 4).Resizable = true;
;
// Use treeView.Selection.Changed?
treeviewTopics.RowActivated += treeviewTopics_RowActivated;
treeviewTopics.ButtonPressEvent += treeviewTopics_ButtonPress;
topicWindow.Add (treeviewTopics);
this.Add1 (topicWindow);
contentBox = new VBox (false, 0);
Toolbar toolbar = new Toolbar ();
toolbar.HeightRequest = 38;
toolbar.ToolbarStyle = ToolbarStyle.Icons;
toolbar.BorderWidth = 0;
firstbtn = new ToolButton (Stock.GotoFirst);
firstbtn.TooltipText = "First page";
firstbtn.Sensitive = false;
firstbtn.Clicked += firstbtn_Clicked;
prevbtn = new ToolButton (Stock.GoBack);
prevbtn.TooltipText = "Previous page";
prevbtn.Sensitive = false;
prevbtn.Clicked += prevbtn_Clicked;
nextbtn = new ToolButton (Stock.GoForward);
nextbtn.TooltipText = "Next page";
nextbtn.Sensitive = false;
nextbtn.Clicked += nextbtn_Clicked;
lastbtn = new ToolButton (Stock.GotoLast);
lastbtn.TooltipText = "Last page";
lastbtn.Sensitive = false;
lastbtn.Clicked += lastbtn_Clicked;
Image tmpimage = new Image ();
tmpimage.Pixbuf = new Gdk.Pixbuf (".images/icon_up.png");
upbtn = new ToolButton (tmpimage, "");
upbtn.TooltipText = "Expand view to top";
upbtn.Clicked += upbtn_Clicked;
Image tmpimage2 = new Image ();
tmpimage2.Pixbuf = new Gdk.Pixbuf (".images/icon_down.png");
downbtn = new ToolButton (tmpimage2, "");
downbtn.TooltipText = "Split view";
downbtn.Clicked += downbtn_Clicked;
closebtn = new ToolButton (Stock.Close);
closebtn.TooltipText = "Close image view";
closebtn.Clicked += closebtn_Clicked;
Image tmpimage3 = new Image ();
tmpimage3.Pixbuf = new Gdk.Pixbuf (".images/rotate_16.png");
rotatebtn = new ToolButton (tmpimage3, "");
rotatebtn.TooltipText = "Rotate image clockwise";
rotatebtn.Clicked += rotatebtn_Clicked;
Image tmpimage4 = new Image ();
tmpimage4.Pixbuf = new Gdk.Pixbuf (".images/icon_save.png");
savebtn = new ToolButton (tmpimage4, "");
savebtn.TooltipText = "Download image";
savebtn.Clicked += savebtn_Clicked;
pageLabel = new Label ("");
ToolItem textItem = new ToolItem ();
textItem.Expand = false;
textItem.Add (pageLabel);
imageviewbtn = new ToggleToolButton (Stock.ZoomFit);
imageviewbtn.TooltipText = "Image view";
imageviewbtn.Toggled += imageviewbtn_Toggled;
textviewbtn = new ToggleToolButton (Stock.Properties);
textviewbtn.TooltipText = "Thread view";
textviewbtn.Active = true;
textviewbtn.Toggled += textviewbtn_Toggled;
SeparatorToolItem sepSpacer = new SeparatorToolItem ();
sepSpacer.Expand = true;
sepSpacer.Draw = false;
sepFullsize = new SeparatorToolItem ();
imageSortAscending = new ToggleToolButton (Stock.SortAscending);
imageSortAscending.TooltipText = "Show earliest images first";
imageSortAscending.Active = true;
imageSortAscending.Toggled += imageSortAscending_Toggled;
imageSortDescending = new ToggleToolButton (Stock.SortDescending);
imageSortDescending.TooltipText = "Show latest images first";
//.........这里部分代码省略.........
示例8: AppToolbar
public AppToolbar(DebugManager mgr, DebugPane dpane)
{
debugManager = mgr;
debugPane = dpane;
toolBar = new Toolbar();
// Debugger control buttons
debuggerStart = new ToolButton(Stock.MediaPlay);
debuggerStart.Clicked += OnDebuggerStart;
debuggerStart.Label = "Start";
debuggerStart.TooltipText = "Start debugger";
toolBar.Add(debuggerStart);
debuggerStop = new ToolButton(Stock.MediaStop);
debuggerStop.Clicked += OnDebuggerStop;
debuggerStop.Label = "Stop";
debuggerStop.TooltipText = "Stop debugger";
toolBar.Add(debuggerStop);
debuggerInterrupt = new ToolButton(Stock.Cancel);
debuggerInterrupt.Clicked += OnDebuggerInterrupt;
debuggerInterrupt.Label = "Interrupt";
debuggerInterrupt.TooltipText = "Interrupt debugger";
toolBar.Add(debuggerInterrupt);
debuggerStart.Sensitive = true;
debuggerStop.Sensitive = false;
debuggerInterrupt.Sensitive = false;
toolBar.Add(new SeparatorToolItem());
// Command macros
var cmdProg = new ToolButton(Stock.Open);
cmdProg.Clicked += OnCommandProgram;
cmdProg.Label = "Program";
cmdProg.TooltipText = "Program...";
toolBar.Add(cmdProg);
commandMacros.Add(cmdProg);
var cmdReset = new ToolButton(Stock.Clear);
cmdReset.Clicked += (obj, evt) =>
debugPane.DebugView.RunCommand("reset");
cmdReset.Label = "Reset";
cmdReset.TooltipText = "Reset";
toolBar.Add(cmdReset);
commandMacros.Add(cmdReset);
var cmdRun = new ToolButton(Stock.GoForward);
cmdRun.Clicked += (obj, evt) =>
debugPane.DebugView.RunCommand("run");
cmdRun.Label = "Run";
cmdRun.TooltipText = "Run";
toolBar.Add(cmdRun);
commandMacros.Add(cmdRun);
var cmdStep = new ToolButton(Stock.MediaNext);
cmdStep.Clicked += (obj, evt) =>
debugPane.DebugView.RunCommand("step");
cmdStep.Label = "Step";
cmdStep.TooltipText = "Step";
toolBar.Add(cmdStep);
commandMacros.Add(cmdStep);
foreach (ToolButton m in commandMacros)
m.Sensitive = false;
toolBar.Add(new SeparatorToolItem());
// Zoom controls
var zoomIn = new ToolButton(Stock.ZoomIn);
zoomIn.Clicked += (obj, evt) => debugPane.PowerView.ZoomIn();
zoomIn.Label = "Zoom in";
zoomIn.TooltipText = "Zoom in";
toolBar.Add(zoomIn);
var zoomOut = new ToolButton(Stock.ZoomOut);
zoomOut.Clicked += (obj, evt) => debugPane.PowerView.ZoomOut();
zoomOut.Label = "Zoom out";
zoomOut.TooltipText = "Zoom out";
toolBar.Add(zoomOut);
var zoomFit = new ToolButton(Stock.ZoomFit);
zoomFit.Clicked += (obj, evt) => debugPane.PowerView.ZoomFit();
zoomFit.Label = "Zoom fit";
zoomFit.TooltipText = "Zoom to fit";
toolBar.Add(zoomFit);
var zoomFull = new ToolButton(Stock.Zoom100);
zoomFull.Clicked += (obj, evt) => debugPane.PowerView.ZoomFull();
zoomFull.Label = "Zoom full";
zoomFull.TooltipText = "Zoom full";
toolBar.Add(zoomFull);
// Debug manager listeners
debugManager.DebuggerBusy += OnDebuggerBusy;
debugManager.DebuggerReady += OnDebuggerReady;
debugManager.DebuggerStarted += OnDebuggerStarted;
debugManager.DebuggerExited += OnDebuggerExited;
}
示例9: CreateExprBar
private void CreateExprBar()
{
// UrlEntry
expr_entry = new Gtk.Entry ();
expr_entry.Activated += new EventHandler(on_expr_activate);
Gtk.ToolItem expr_item = new Gtk.ToolItem ();
expr_item.Expand = true;
expr_item.Add (expr_entry);
// Toolbar
exprbar = new Toolbar ();
exprbar.ToolbarStyle = ToolbarStyle.Icons;
exprbar.Orientation = Orientation.Horizontal;
exprbar.ShowArrow = true;
// Toolbar Itens
exprbar.Add (expr_item);
exprbar.Add (action_expr.CreateToolItem());
}
示例10: Main
static void Main()
{
#if TRACE
System.Diagnostics.TextWriterTraceListener listener
= new System.Diagnostics.TextWriterTraceListener (System.Console.Out);
System.Diagnostics.Trace.Listeners.Add (listener);
#endif
Application.Init ();
#region Packing and layout
Window window = new Window ("AspNetEdit Host Sample");
window.SetDefaultSize (1000, 700);
window.DeleteEvent += new DeleteEventHandler (window_DeleteEvent);
VBox outerBox = new VBox ();
window.Add (outerBox);
HPaned leftBox = new HPaned ();
outerBox.PackEnd (leftBox, true, true, 0);
HPaned rightBox = new HPaned ();
leftBox.Add2 (rightBox);
geckoFrame = new Frame ();
geckoFrame.Shadow = ShadowType.In;
rightBox.Pack1 (geckoFrame, true, false);
#endregion
#region Toolbar
// * Save/Open
Toolbar buttons = new Toolbar ();
outerBox.PackStart (buttons, false, false, 0);
ToolButton saveButton = new ToolButton (Stock.Save);
buttons.Add (saveButton);
saveButton.Clicked += new EventHandler (saveButton_Clicked);
ToolButton openButton = new ToolButton(Stock.Open);
buttons.Add(openButton);
openButton.Clicked += new EventHandler(openButton_Clicked);
buttons.Add (new SeparatorToolItem());
// * Clipboard
ToolButton undoButton = new ToolButton (Stock.Undo);
buttons.Add (undoButton);
undoButton.Clicked +=new EventHandler (undoButton_Clicked);
ToolButton redoButton = new ToolButton (Stock.Redo);
buttons.Add (redoButton);
redoButton.Clicked += new EventHandler (redoButton_Clicked);
ToolButton cutButton = new ToolButton (Stock.Cut);
buttons.Add (cutButton);
cutButton.Clicked += new EventHandler (cutButton_Clicked);
ToolButton copyButton = new ToolButton (Stock.Copy);
buttons.Add (copyButton);
copyButton.Clicked += new EventHandler (copyButton_Clicked);
ToolButton pasteButton = new ToolButton (Stock.Paste);
buttons.Add (pasteButton);
pasteButton.Clicked += new EventHandler (pasteButton_Clicked);
buttons.Add (new SeparatorToolItem());
// * Text style
ToolButton boldButton = new ToolButton (Stock.Bold);
buttons.Add (boldButton);
boldButton.Clicked += new EventHandler (boldButton_Clicked);
ToolButton italicButton = new ToolButton (Stock.Italic);
buttons.Add (italicButton);
italicButton.Clicked += new EventHandler (italicButton_Clicked);
ToolButton underlineButton = new ToolButton (Stock.Underline);
buttons.Add (underlineButton);
underlineButton.Clicked += new EventHandler (underlineButton_Clicked);
ToolButton indentButton = new ToolButton (Stock.Indent);
buttons.Add (indentButton);
indentButton.Clicked += new EventHandler (indentButton_Clicked);
ToolButton unindentButton = new ToolButton (Stock.Unindent);
buttons.Add (unindentButton);
unindentButton.Clicked += new EventHandler (unindentButton_Clicked);
buttons.Add (new SeparatorToolItem());
// * Toolbox
ToolButton toolboxAddButton = new ToolButton (Stock.Add);
buttons.Add (toolboxAddButton);
toolboxAddButton.Clicked += new EventHandler (toolboxAddButton_Clicked);
//.........这里部分代码省略.........
示例11: BuildToolbar
Toolbar BuildToolbar ()
{
Toolbar buttons = new Toolbar ();
// * Clipboard
ToolButton undoButton = new ToolButton (Stock.Undo);
buttons.Add (undoButton);
undoButton.Clicked += delegate { host.DesignerHost.RootDocument.DoCommand (EditorCommand.Undo); };
ToolButton redoButton = new ToolButton (Stock.Redo);
buttons.Add (redoButton);
redoButton.Clicked += delegate { host.DesignerHost.RootDocument.DoCommand (EditorCommand.Redo); };
ToolButton cutButton = new ToolButton (Stock.Cut);
buttons.Add (cutButton);
cutButton.Clicked += delegate { host.DesignerHost.RootDocument.DoCommand (EditorCommand.Cut); };
ToolButton copyButton = new ToolButton (Stock.Copy);
buttons.Add (copyButton);
copyButton.Clicked += delegate { host.DesignerHost.RootDocument.DoCommand (EditorCommand.Copy); };
ToolButton pasteButton = new ToolButton (Stock.Paste);
buttons.Add (pasteButton);
pasteButton.Clicked += delegate { host.DesignerHost.RootDocument.DoCommand (EditorCommand.Paste); };
// * Text style
buttons.Add (new SeparatorToolItem());
ToolButton boldButton = new ToolButton (Stock.Bold);
buttons.Add (boldButton);
boldButton.Clicked += delegate { host.DesignerHost.RootDocument.DoCommand (EditorCommand.Bold); };
ToolButton italicButton = new ToolButton (Stock.Italic);
buttons.Add (italicButton);
italicButton.Clicked += delegate { host.DesignerHost.RootDocument.DoCommand (EditorCommand.Italic); };
ToolButton underlineButton = new ToolButton (Stock.Underline);
buttons.Add (underlineButton);
underlineButton.Clicked += delegate { host.DesignerHost.RootDocument.DoCommand (EditorCommand.Underline); };
ToolButton indentButton = new ToolButton (Stock.Indent);
buttons.Add (indentButton);
indentButton.Clicked += delegate { host.DesignerHost.RootDocument.DoCommand (EditorCommand.Indent); };
ToolButton unindentButton = new ToolButton (Stock.Unindent);
buttons.Add (unindentButton);
unindentButton.Clicked += delegate { host.DesignerHost.RootDocument.DoCommand (EditorCommand.Outdent); };
return buttons;
}
示例12: CreateCatList
private Widget CreateCatList()
{
var scroll = new ScrolledWindow();
var box = new VBox();
scroll.Add(box);
var tb = new Toolbar();
tb.Orientation = Orientation.Vertical;
tb.ToolbarStyle = ToolbarStyle.BothHoriz;
tb.ShowArrow = false;
box.Add(tb);
allButton = createCatButton(TLauncherIndex.Current.catHash["All"]);
tb.Add(allButton);
tb.Add(new SeparatorToolItem());
foreach (var entry in TLauncherIndex.Current.Categories)
if (!entry.meta)
tb.Add(createCatButton(entry));
var noneButton = createCatButton(TLauncherIndex.Current.catHash["None"]);
tb.Add(noneButton);
var frame = new Frame();
frame.Add(scroll);
return frame;
}
示例13: SqlQueryView
public SqlQueryView()
: base()
{
control = new Frame ();
control.Show ();
VBox vbox = new VBox ();
vbox.Show ();
Tooltips tips = new Tooltips ();
Toolbar toolbar = new Toolbar ();
vbox.PackStart (toolbar, false, true, 0);
toolbar.Show ();
Image image = new Image ();
image.Pixbuf = Gdk.Pixbuf.LoadFromResource ("MonoQuery.Execute");
image.Show ();
Button execute = new Button (image);
execute.Clicked += new EventHandler (OnExecute);
execute.Relief = ReliefStyle.None;
tips.SetTip (execute, "Execute", "");
toolbar.Add (execute);
execute.Show ();
image = new Image ();
image.Pixbuf = Gdk.Pixbuf.LoadFromResource ("MonoQuery.RunFromCursor");
image.Show ();
Button run = new Button (image);
run.Clicked += new EventHandler (OnRunFromCursor);
run.Relief = ReliefStyle.None;
tips.SetTip (run, "Run from cursor", "");
toolbar.Add (run);
run.Show ();
image = new Image ();
image.Pixbuf = Gdk.Pixbuf.LoadFromResource ("MonoQuery.Explain");
image.Show ();
Button explain = new Button (image);
explain.Clicked += new EventHandler (OnExplain);
explain.Relief = ReliefStyle.None;
tips.SetTip (explain, "Explain query", "");
toolbar.Add (explain);
explain.Show ();
image = new Image ();
image.Pixbuf = Gdk.Pixbuf.LoadFromResource ("MonoQuery.Stop");
image.Show ();
Button stop = new Button (image);
stop.Clicked += new EventHandler (OnStop);
stop.Relief = ReliefStyle.None;
stop.Sensitive = false;
tips.SetTip (stop, "Stop", "");
toolbar.Add (stop);
stop.Show ();
VSeparator sep = new VSeparator ();
toolbar.Add (sep);
sep.Show ();
model = new ListStore (typeof (string), typeof (DbProviderBase));
providers = new ComboBox ();
providers.Model = model;
CellRendererText ctext = new CellRendererText ();
providers.PackStart (ctext, true);
providers.AddAttribute (ctext, "text", 0);
toolbar.Add (providers);
providers.Show ();
SourceLanguagesManager lm = new SourceLanguagesManager ();
SourceLanguage lang = lm.GetLanguageFromMimeType ("text/x-sql");
SourceBuffer buf = new SourceBuffer (lang);
buf.Highlight = true;
sourceView = new SourceView (buf);
sourceView.ShowLineNumbers = true;
sourceView.Show ();
ScrolledWindow scroller = new ScrolledWindow ();
scroller.Add (sourceView);
scroller.Show ();
vbox.PackStart (scroller, true, true, 0);
control.Add (vbox);
service = (MonoQueryService)
ServiceManager.GetService (typeof (MonoQueryService));
changedHandler
= (EventHandler) Runtime.DispatchService.GuiDispatch (
new EventHandler (OnProvidersChanged));
service.Providers.Changed += changedHandler;
foreach (DbProviderBase p in service.Providers) {
model.AppendValues (p.Name, p);
}
}
示例14: CreateToolbar
private void CreateToolbar()
{
// UrlEntry
uri_entry = new Gtk.Entry ();
uri_entry.Activated += new EventHandler(on_uri_activate);
Gtk.ToolItem uri_item = new Gtk.ToolItem ();
uri_item.Expand = true;
uri_item.Add (uri_entry);
// Toolbar
toolbar = new Toolbar ();
toolbar.ToolbarStyle = ToolbarStyle.Icons;
toolbar.Orientation = Orientation.Horizontal;
toolbar.ShowArrow = true;
// Toolbar Itens
toolbar.Add (action_back.CreateToolItem());
toolbar.Add (action_forward.CreateToolItem());
toolbar.Add (action_reload.CreateToolItem());
toolbar.Add (action_stop.CreateToolItem());
toolbar.Add (uri_item);
toolbar.Add (action_jump.CreateToolItem());
}
示例15: ModelerCanvasWidget
public ModelerCanvasWidget(ModelerCanvas owner, modelController controller)
{
this.Build ();
_owner = owner;
_controller = controller;
VBox mainVbox = new VBox (false, 6);
mainVbox.BorderWidth = 6;
this.Add(mainVbox);
//Create Toolbar
Toolbar toolbar = new Toolbar ();
toolbar.Name = "toolbar";
toolbar.ShowArrow = true;
toolbar.IconSize = Gtk.IconSize.LargeToolbar;
toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
toolbar.Sensitive=true;
toolbar.Activate();
mainVbox.Add(toolbar);
Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild)(mainVbox[toolbar]));
w1.Position = 0;
w1.Expand = false;
w1.Fill = true;
//Create SCrollWindow
mainScrolledWindow = new ScrolledWindow();
mainScrolledWindow.Activate();
mainScrolledWindow.SetPolicy( Gtk.PolicyType.Always,Gtk.PolicyType.Always);
mainScrolledWindow.CanFocus = true;
mainScrolledWindow.Name = "mainScrolledWindow";
mainScrolledWindow.ShadowType = ((Gtk.ShadowType)(1));
mainVbox.Add(mainScrolledWindow);
Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(mainVbox[mainScrolledWindow]));
w2.Position = 1;
w2.Fill=true;
w2.Expand=true;
//Create Toolbar Buttons
//Add New Table
buttonNew = new ToolButton(new Gtk.Image (Gtk.Stock.New, IconSize.Button),"Add Table");
buttonNew.Sensitive = true;
buttonNew.TooltipMarkup = "Add a new empty table";
buttonNew.IsImportant = true;
buttonNew.Clicked += new EventHandler (OnbuttonNewActionActivated);
buttonNew.Activate();
buttonNew.Show();
toolbar.Add (buttonNew);
//Create a Relationship between two tables
buttonRelationship = new ToolButton(new Gtk.Image (Gtk.Stock.New, IconSize.Button),"Relationship");
buttonRelationship.Sensitive = true;
buttonRelationship.TooltipMarkup = "Add a new relationship between tables";
buttonRelationship.IsImportant = true;
buttonRelationship.Clicked += new EventHandler (OnbuttonRelationshipActivated);
buttonRelationship.Activate();
buttonRelationship.Show();
toolbar.Add (buttonRelationship);
//Delete Selected Figure(s)
buttonDelete = new ToolButton(new Gtk.Image (Gtk.Stock.New, IconSize.Button),"Remove");
buttonDelete.Sensitive = true;
buttonDelete.TooltipMarkup = "Remove selected figure(s) from diagram (table or relationship)";
buttonDelete.IsImportant = true;
buttonDelete.Clicked += new EventHandler (buttonDeleteRelationshipActivated);
buttonDelete.Activate();
buttonDelete.Show();
toolbar.Add (buttonDelete);
//Select Active Database
comboConnections = new DatabaseConnectionContextComboBox ();
selectedConnection = comboConnections.DatabaseConnection;
comboConnections.Changed += new EventHandler (ConnectionChanged);
ToolItem comboItem = new ToolItem ();
comboItem.Child = comboConnections;
comboItem.Show();
toolbar.Add (new SeparatorToolItem ());
toolbar.Add (comboItem);
//Show all items
mainVbox.ShowAll ();
}