本文整理汇总了C#中EventBox类的典型用法代码示例。如果您正苦于以下问题:C# EventBox类的具体用法?C# EventBox怎么用?C# EventBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EventBox类属于命名空间,在下文中一共展示了EventBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
Gtk.Window window;
EventBox eventbox;
Label label;
Application.Init();
window = new Gtk.Window ("Eventbox");
window.DeleteEvent += new DeleteEventHandler (delete_event);
window.BorderWidth = 10;
window.Resize(400,300);
eventbox = new EventBox ();
window.Add (eventbox);
eventbox.Show();
label = new Label ("Click here to quit");
eventbox.Add(label);
label.Show();
label.SetSizeRequest(110, 20);
eventbox.ButtonPressEvent += new ButtonPressEventHandler (exitbutton_event);
eventbox.Realize();
window.Show();
Application.Run();
}
示例2: TIcon
public TIcon(CInterfaceGateway in_krnGateway, Gtk.Window mwindow)
{
krnGateway = in_krnGateway;
mainwindow = mwindow;
menu = new Gtk.Menu ();
EventBox eb = new EventBox ();
eb.ButtonPressEvent += new ButtonPressEventHandler (TIconClicked);
eb.Add (new Gtk.Image (new Gdk.Pixbuf (null, "lPhant.png")));
MenuItem it_show = new MenuItem ("Show");
it_show.Activated += new EventHandler (TIconShow);
MenuItem it_options = new MenuItem ("Options");
it_options.Activated += new EventHandler (TIconOptions);
ImageMenuItem it_quit = new ImageMenuItem("Quit");
it_quit.Activated += new EventHandler (TIconQuit);
menu.Append (it_show);
menu.Append (it_options);
menu.Append (it_quit);
t = new TrayIcon ("eLePhantGTK");
t.Add (eb);
t.ShowAll ();
}
示例3: buildWindow
private void buildWindow()
{
this.Resizable = false;
EventBox labelContainer = new EventBox ();
Label badFileLabel = new Label (Constants.Constants.badFilePathPopupText);
//set the style of the label
Style labelStyle = badFileLabel.Style.Copy();
labelStyle.FontDescription.Family = Constants.Constants.welcomeWindowFontFamily;
labelStyle.FontDescription.Size = Constants.Constants.CONFIRM_RELOAD_MESSAGE_SIZE;
badFileLabel.Style = labelStyle.Copy();
labelContainer.Add (badFileLabel);
closeButton = new Button (Constants.Constants.closeButtonText);
closeButton.Clicked += new EventHandler (dismissDialog);
//set the style of close button
Style buttonStyle = closeButton.Style.Copy ();
buttonStyle.FontDescription.Family = Constants.Constants.welcomeWindowFontFamily;
buttonStyle.FontDescription.Size = Constants.Constants.WELCOME_BUTTON_FONT_SIZE;
closeButton.Style = buttonStyle.Copy ();
HBox masterContainer = new HBox ();
VBox mainContainer = new VBox ();
mainContainer.PackStart (labelContainer, false, false, 50);
mainContainer.PackStart (closeButton, false, false, 50);
masterContainer.PackStart (mainContainer, true, true, 100);
this.Add (masterContainer);
}
示例4: TabLabel
public TabLabel (Label label, Gtk.Image icon) : base (false, 0)
{
this.title = label;
this.icon = icon;
icon.Xpad = 2;
EventBox eventBox = new EventBox ();
eventBox.BorderWidth = 0;
eventBox.VisibleWindow = false;
eventBox.Add (icon);
this.PackStart (eventBox, false, true, 0);
titleBox = new EventBox ();
titleBox.VisibleWindow = false;
titleBox.Add (title);
this.PackStart (titleBox, true, true, 0);
Gtk.Rc.ParseString ("style \"MonoDevelop.TabLabel.CloseButton\" {\n GtkButton::inner-border = {0,0,0,0}\n }\n");
Gtk.Rc.ParseString ("widget \"*.MonoDevelop.TabLabel.CloseButton\" style \"MonoDevelop.TabLabel.CloseButton\"\n");
Button button = new Button ();
button.CanDefault = false;
var closeIcon = new Xwt.ImageView (closeImage).ToGtkWidget ();
button.Image = closeIcon;
button.Relief = ReliefStyle.None;
button.BorderWidth = 0;
button.Clicked += new EventHandler(ButtonClicked);
button.Name = "MonoDevelop.TabLabel.CloseButton";
this.PackStart (button, false, true, 0);
this.ClearFlag (WidgetFlags.CanFocus);
this.BorderWidth = 0;
this.ShowAll ();
}
示例5: SetupWindow
public SetupWindow()
: base("SparkleShare Setup")
{
SetWmclass ("SparkleShare", "SparkleShare");
IconName = "org.sparkleshare.SparkleShare";
Resizable = false;
WindowPosition = WindowPosition.CenterAlways;
Deletable = false;
TypeHint = Gdk.WindowTypeHint.Dialog;
SetSizeRequest (400, 400);
DeleteEvent += delegate (object sender, DeleteEventArgs args) { args.RetVal = true; };
VBox layout_vertical = new VBox (false, 16);
layout_vertical.BorderWidth = 16;
this.content_area = new EventBox ();
this.option_area = new EventBox ();
this.buttons = CreateButtonBox ();
HBox layout_actions = new HBox (false , 16);
layout_actions.PackStart (this.option_area, true, true, 0);
layout_actions.PackStart (this.buttons, false, false, 0);
layout_vertical.PackStart (this.content_area, true, true, 0);
layout_vertical.PackStart (layout_actions, false, false, 0);
base.Add (layout_vertical);
}
示例6: PlainSurfaceItem
public PlainSurfaceItem(int maxWidth, int maxHeight, int widthRequest = 0, int heightRequest = 0, string label = null)
{
//Console.WriteLine ("PlainSurfaceItem");
_label = label;
this._evtBox = new EventBox ();
this._draw = new global::Gtk.DrawingArea ();
if(widthRequest > 0) {
_draw.WidthRequest = widthRequest;
}
if(heightRequest > 0) {
_draw.HeightRequest = heightRequest;
}
this._evtBox.Add (this._draw);
maxWidth = Math.Max (maxWidth, widthRequest);
maxHeight = Math.Max (maxHeight, heightRequest);
this._height = Math.Max(_draw.Allocation.Height, heightRequest);
this._width = Math.Max(_draw.Allocation.Width, widthRequest);
this._mode = DisplayMode.Snapshot;
this._surface = new ImageSurface(Format.Argb32, maxWidth, maxHeight);
this._button = MouseButton.None;
this._background = new Color (1.0, 1.0, 1.0);
_draw.ExposeEvent += DrawExpose;
_evtBox.ButtonPressEvent += DrawButtonPressEvent;
_evtBox.ButtonReleaseEvent += DrawButtonReleaseEvent;
_evtBox.MotionNotifyEvent += DrawMotionNotifyEvent;
}
示例7: AutoHideBox
public AutoHideBox (DockFrame frame, DockItem item, Gtk.PositionType pos, int size)
{
this.position = pos;
this.frame = frame;
this.targetSize = size;
horiz = pos == PositionType.Left || pos == PositionType.Right;
startPos = pos == PositionType.Top || pos == PositionType.Left;
Events = Events | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask;
Box fr;
CustomFrame cframe = new CustomFrame ();
switch (pos) {
case PositionType.Left: cframe.SetMargins (1, 1, 0, 1); break;
case PositionType.Right: cframe.SetMargins (1, 1, 1, 0); break;
case PositionType.Top: cframe.SetMargins (0, 1, 1, 1); break;
case PositionType.Bottom: cframe.SetMargins (1, 0, 1, 1); break;
}
EventBox sepBox = new EventBox ();
cframe.Add (sepBox);
if (horiz) {
fr = new HBox ();
sepBox.Realized += delegate { sepBox.GdkWindow.Cursor = resizeCursorW; };
sepBox.WidthRequest = gripSize;
} else {
fr = new VBox ();
sepBox.Realized += delegate { sepBox.GdkWindow.Cursor = resizeCursorH; };
sepBox.HeightRequest = gripSize;
}
sepBox.Events = EventMask.AllEventsMask;
if (pos == PositionType.Left || pos == PositionType.Top)
fr.PackEnd (cframe, false, false, 0);
else
fr.PackStart (cframe, false, false, 0);
Add (fr);
ShowAll ();
Hide ();
scrollable = new ScrollableContainer ();
scrollable.ScrollMode = false;
scrollable.Show ();
if (item.Widget.Parent != null) {
((Gtk.Container)item.Widget.Parent).Remove (item.Widget);
}
item.Widget.Show ();
scrollable.Add (item.Widget);
fr.PackStart (scrollable, true, true, 0);
sepBox.ButtonPressEvent += OnSizeButtonPress;
sepBox.ButtonReleaseEvent += OnSizeButtonRelease;
sepBox.MotionNotifyEvent += OnSizeMotion;
sepBox.ExposeEvent += OnGripExpose;
sepBox.EnterNotifyEvent += delegate { insideGrip = true; sepBox.QueueDraw (); };
sepBox.LeaveNotifyEvent += delegate { insideGrip = false; sepBox.QueueDraw (); };
}
示例8: WebViewer
public WebViewer()
: base(WindowType.Toplevel)
{
xml = new XML (null, "MainWindow.glade", "mainBox", null);
xml.Autoconnect (this);
Gdk.Pixbuf pix = new Gdk.Pixbuf (null, "webnotes-16.png");
//Window settings
Title = "WebNotes";
WindowPosition = WindowPosition.Center;
Icon = pix;
Resize (650,600);
//Trayicon stuff
trayIcon = new TrayIcon ("WebNotes");
EventBox ebox = new EventBox ();
ebox.ButtonPressEvent += ButtonPressed;
Image image = new Image (pix);
ebox.Add (image);
trayIcon.Add (ebox);
trayIcon.ShowAll ();
//Gecko webcontrol
wc = new WebControl ();
wc.LoadUrl ("http://localhost:8000");
geckoBox.Add (wc);
optionMenu.Changed += OptionChanged;
BuildMenu ();
int firstPage = list.IndexOf ("WikiHome");
if (firstPage != -1)
optionMenu.SetHistory ((uint)firstPage);
Add (mainBox);
}
示例9: ImageWindow
public ImageWindow(string src)
: base(src)
{
Decorated = false;
KeepAbove = true;
Resize (640, 240);
Move (100, 100);
//Opacity = 1.0;
pixbuf = new Pixbuf (src);
Gtk.Image image = new Gtk.Image ();
image.Pixbuf = pixbuf;
EventBox box = new EventBox ();
box.Add (image);
box.ButtonPressEvent += new ButtonPressEventHandler (WindowController.OnButtonDragPress);
box.ExposeEvent += HandleMyWinExposeEvent;
Add (box);
WindowController.HandleMyWinScreenChanged(this, null);
WindowController.SetWindowShapeFromPixbuf (this, image.Pixbuf);
DestroyEvent += new DestroyEventHandler (delegate(object o, DestroyEventArgs args) {
if(cr!=null){
((IDisposable)cr).Dispose();
}
});
ShowAll();
}
示例10: TreeViewCellContainer
public TreeViewCellContainer (Gtk.Widget child)
{
box = new EventBox ();
box.ButtonPressEvent += new ButtonPressEventHandler (OnClickBox);
box.Add (child);
child.Show ();
Show ();
}
示例11: EventBoxTooltip
/// <summary>
/// The EventBox should have Visible set to false otherwise the tooltip pop window
/// will have the wrong location.
/// </summary>
public EventBoxTooltip (EventBox eventBox)
{
this.eventBox = eventBox;
eventBox.EnterNotifyEvent += HandleEnterNotifyEvent;
eventBox.LeaveNotifyEvent += HandleLeaveNotifyEvent;
Position = PopupPosition.TopLeft;
}
示例12: CreateColorBox
private Widget CreateColorBox(string name, Gdk.Color color)
{
EventBox eb = new EventBox();
eb.ModifyBg(StateType.Normal, color);
Label l = new Label(name);
eb.Add(l);
l.Show();
return eb;
}
示例13: TreeViewCellContainer
public TreeViewCellContainer (Gtk.Widget child)
{
box = new EventBox ();
box.ButtonPressEvent += new ButtonPressEventHandler (OnClickBox);
box.ModifyBg (StateType.Normal, Style.White);
box.Add (child);
child.Show ();
Show ();
}
示例14: ChatsPage
private ChatsPage()
{
base.FocusGrabbed += base_FocusGrabbed;
closePixbuf = new Gdk.Pixbuf(null, "FileFind.Meshwork.GtkClient.smallclose.png");
tabLabelPages = new Dictionary<Widget, ChatSubpageBase>();
notebook = new Notebook();
notebook.TabPos = PositionType.Bottom;
notebook.SwitchPage += notebook_SwitchPage;
notebook.PageReordered += notebook_PageReordered;
ScrolledWindow swindow = new ScrolledWindow();
swindow.HscrollbarPolicy = PolicyType.Automatic;
swindow.VscrollbarPolicy = PolicyType.Automatic;
chatList = new TreeView ();
swindow.Add(chatList);
chatTreeStore = new NetworkGroupedTreeStore<ChatRoom>(chatList);
chatList.Model = chatTreeStore;
TreeViewColumn column;
column = chatList.AppendColumn("Room Name", new CellRendererText(), new TreeCellDataFunc (NameDataFunc));
column.Expand = true;
column.Sizing = TreeViewColumnSizing.Autosize;
var pixbufCell = new CellRendererPixbuf();
column.PackStart(pixbufCell, false);
column.SetCellDataFunc(pixbufCell, new TreeCellDataFunc(RoomSecureDataFunc));
column = chatList.AppendColumn("Users", new CellRendererText(), new TreeCellDataFunc (RoomUsersDataFunc));
column.Sizing = TreeViewColumnSizing.Autosize;
chatList.RowActivated += chatList_RowActivated;
chatList.ButtonPressEvent += chatList_ButtonPressEvent;
EventBox box = new EventBox();
box.Add(new Label("Chatroom List"));
box.ButtonPressEvent += HandleTabButtonPressEvent;
box.ShowAll();
notebook.AppendPage(swindow, box);
this.PackStart(notebook, true, true, 0);
notebook.ShowAll();
foreach (Network network in Core.Networks) {
Core_NetworkAdded (network);
}
Core.NetworkAdded +=
(NetworkEventHandler)DispatchService.GuiDispatch(
new NetworkEventHandler(Core_NetworkAdded)
);
}
示例15: Build
private void Build ()
{
HeightRequest = 24;
eventbox = new EventBox ();
eventbox.Events = (Gdk.EventMask)256;
eventbox.VisibleWindow = false;
Add (eventbox);
}