本文整理汇总了C#中Gtk.Widget类的典型用法代码示例。如果您正苦于以下问题:C# Widget类的具体用法?C# Widget怎么用?C# Widget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Widget类属于Gtk命名空间,在下文中一共展示了Widget类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddScrolledWindow
public static ScrolledWindow AddScrolledWindow(Widget widget)
{
ScrolledWindow swindow = new ScrolledWindow();
swindow.Add(widget);
swindow.Show();
return swindow;
}
开发者ID:codebutler,项目名称:meshwork,代码行数:7,代码来源:Gui.cs
示例2: InitCell
public void InitCell (Widget container, bool diffMode, string[] lines, TreePath path)
{
if (isDisposed)
return;
this.lines = lines;
this.diffMode = diffMode;
this.path = path;
if (diffMode) {
if (lines != null && lines.Length > 0) {
int maxlen = -1;
int maxlin = -1;
for (int n=0; n<lines.Length; n++) {
if (lines [n].Length > maxlen) {
maxlen = lines [n].Length;
maxlin = n;
}
}
DisposeLayout ();
layout = CreateLayout (container, lines [maxlin]);
layout.GetPixelSize (out width, out lineHeight);
height = lineHeight * lines.Length;
}
else
width = height = 0;
}
else {
DisposeLayout ();
layout = CreateLayout (container, string.Join (Environment.NewLine, lines));
layout.GetPixelSize (out width, out height);
}
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:32,代码来源:CellRendererDiff.cs
示例3: HighlightMatch
protected static string HighlightMatch (Widget widget, string text, string toMatch)
{
var lane = StringMatcher.GetMatcher (toMatch, false).GetMatch (text);
if (lane != null) {
StringBuilder result = new StringBuilder ();
int lastPos = 0;
for (int n=0; n < lane.Length; n++) {
int pos = lane[n];
if (pos - lastPos > 0)
result.Append (GLib.Markup.EscapeText (text.Substring (lastPos, pos - lastPos)));
result.Append ("<span foreground=\"");
var color = Mono.TextEditor.HslColor.GenerateHighlightColors (widget.Style.Base (StateType.Normal),
widget.Style.Text (StateType.Normal), 3)[2];
result.Append (color.ToPangoString ());
result.Append ("\">");
result.Append (GLib.Markup.EscapeText (text[pos].ToString ()));
result.Append ("</span>");
lastPos = pos + 1;
}
if (lastPos < text.Length)
result.Append (GLib.Markup.EscapeText (text.Substring (lastPos, text.Length - lastPos)));
return result.ToString ();
}
return GLib.Markup.EscapeText (text);
}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:26,代码来源:SearchResult.cs
示例4: PhotoPopup
public PhotoPopup(Widget parent)
: base()
{
foreach (MenuNode node in AddinManager.GetExtensionNodes ("/FSpot/Menus/PhotoPopup"))
Append (node.GetMenuItem (parent));
ShowAll ();
}
开发者ID:nathansamson,项目名称:F-Spot-Album-Exporter,代码行数:7,代码来源:PhotoPopup.cs
示例5: Render
protected override void Render (Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
{
base.Render (window, widget, background_area, cell_area, expose_area, flags);
if (PackageSourceViewModel == null)
return;
using (var layout = new Pango.Layout (widget.PangoContext)) {
layout.Alignment = Pango.Alignment.Left;
layout.SetMarkup (GetPackageSourceNameMarkup ());
int packageSourceNameWidth = GetLayoutWidth (layout);
StateType state = GetState (widget, flags);
layout.SetMarkup (GetPackageSourceDescriptionMarkup ());
window.DrawLayout (widget.Style.TextGC (state), cell_area.X + textSpacing, cell_area.Y + textTopSpacing, layout);
if (!PackageSourceViewModel.IsValid) {
using (var ctx = Gdk.CairoHelper.Create (window)) {
ctx.DrawImage (widget, warningImage, cell_area.X + textSpacing + packageSourceNameWidth + imageSpacing, cell_area.Y + textTopSpacing);
}
layout.SetMarkup (GetPackageSourceErrorMarkup ());
int packageSourceErrorTextX = cell_area.X + textSpacing + packageSourceNameWidth + (int)warningImage.Width + (2 * imageSpacing);
window.DrawLayout (widget.Style.TextGC (state), packageSourceErrorTextX, cell_area.Y + textTopSpacing, layout);
}
}
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:28,代码来源:PackageSourceCellRenderer.cs
示例6: Construct
protected void Construct (Widget buttonWidget, Menu menu, bool showArrow)
{
WidgetFlags |= WidgetFlags.NoWindow;
button_widget = buttonWidget;
Menu = menu;
toggle_button.Parent = this;
toggle_button.FocusOnClick = false;
toggle_button.Relief = ReliefStyle.None;
toggle_button.Pressed += delegate { ShowMenu (); toggle_button.Active = true; };
toggle_button.Activated += delegate { ShowMenu (); };
box.Parent = this;
if (showArrow) {
box.PackStart (button_widget, true, true, 0);
alignment = new Alignment (0f, 0.5f, 0f, 0f);
arrow = new Arrow (ArrowType.Down, ShadowType.None);
alignment.Add (arrow);
box.PackStart (alignment, false, false, 5);
size_widget = box;
FocusChain = new Widget[] {toggle_button, box};
alignment.ShowAll ();
alignment.NoShowAll = true;
} else {
toggle_button.Add (button_widget);
size_widget = toggle_button;
}
ShowAll ();
}
开发者ID:Yetangitu,项目名称:f-spot,代码行数:32,代码来源:MenuButton.cs
示例7: MouseTracker
public MouseTracker (Gtk.Widget owner)
{
this.owner = owner;
Hovered = false;
MousePosition = new Gdk.Point(0, 0);
owner.Events = owner.Events | Gdk.EventMask.PointerMotionMask;
owner.MotionNotifyEvent += (object o, MotionNotifyEventArgs args) => {
MousePosition = new Gdk.Point ((int)args.Event.X, (int)args.Event.Y);
if (MouseMoved != null)
MouseMoved (this, EventArgs.Empty);
};
owner.EnterNotifyEvent += (o, args) => {
Hovered = true;
if (HoveredChanged != null)
HoveredChanged (this, EventArgs.Empty);
};
owner.LeaveNotifyEvent += (o, args) => {
Hovered = false;
if (HoveredChanged != null)
HoveredChanged (this, EventArgs.Empty);
};
}
开发者ID:msiyer,项目名称:Pinta,代码行数:26,代码来源:MouseTracker.cs
示例8: GetSize
public override void GetSize(Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int w, out int h)
{
x_offset = 0;
y_offset = 0;
w = width + ((int) Xpad) * 2;
h = height + ((int) Ypad) * 2;
}
开发者ID:GNOME,项目名称:mistelix,代码行数:7,代码来源:CairoImageCellRenderer.cs
示例9: GetSize
public override void GetSize (Widget widget, ref Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
base.GetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);
if (CategoryIcon != null) {
height = (int)CategoryIcon.Height + ((int)Ypad * 2) + topLevelTemplateHeadingTotalYPadding;
}
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:7,代码来源:GtkTemplateCategoryCellRenderer.cs
示例10: AttachAligned
protected void AttachAligned(int column, int row, string labelText,
double xalign, double yalign, Widget widget,
int colspan, bool leftAlign)
{
Table.AttachAligned(column, row, labelText, xalign, yalign, widget,
colspan, leftAlign);
}
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:7,代码来源:PicturePackageFrame.cs
示例11: Show
public void Show(Xwt.Popover.Position orientation, Xwt.Widget reference, Xwt.Rectangle positionRect, Widget child)
{
var parent = reference.ParentWindow;
popover = new PopoverWindow ((Gtk.Widget)((WidgetBackend)Toolkit.GetBackend (child)).NativeWidget, orientation);
popover.SetPadding (frontend.Padding);
popover.TransientFor = ((WindowFrameBackend)Toolkit.GetBackend (parent)).Window;
popover.DestroyWithParent = true;
popover.Hidden += (o, args) => {
popover.ReleaseInnerWidget ();
sink.OnClosed ();
popover.Destroy ();
};
var screenBounds = reference.ScreenBounds;
if (positionRect == Rectangle.Zero)
positionRect = new Rectangle (Point.Zero, screenBounds.Size);
positionRect = positionRect.Offset (screenBounds.Location);
var position = new Point (positionRect.Center.X, popover.ArrowPosition == Popover.Position.Top ? positionRect.Bottom : positionRect.Top);
popover.ShowAll ();
popover.GrabFocus ();
int w, h;
popover.GetSize (out w, out h);
popover.Move ((int)position.X - w / 2, (int)position.Y);
popover.SizeAllocated += (o, args) => { popover.Move ((int)position.X - args.Allocation.Width / 2, (int)position.Y); popover.GrabFocus (); };
}
开发者ID:shines77,项目名称:xwt,代码行数:25,代码来源:PopoverBackend.cs
示例12: AddWidget
private void AddWidget (PreferenceBase preference, Widget widget, Widget mnemonic_widget)
{
uint start_row = NRows;
uint start_col = 0;
Label label = null;
if (!(widget is CheckButton) && preference.ShowLabel) {
label = AttachLabel (preference.Name, start_row);
start_col++;
}
widget.Show ();
Attach (widget, start_col, 2, start_row, start_row + 1,
AttachOptions.Expand | AttachOptions.Fill,
AttachOptions.Expand | AttachOptions.Fill, 0, 0);
if (label != null) {
label.MnemonicWidget = mnemonic_widget ?? widget;
}
if (!String.IsNullOrEmpty (preference.Description)) {
if (tp_host == null) {
tp_host = TooltipSetter.CreateHost ();
}
TooltipSetter.Set (tp_host, widget, preference.Description);
if (label != null) {
TooltipSetter.Set (tp_host, label, preference.Description);
}
}
}
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:32,代码来源:SectionBox.cs
示例13: MphotoToplevel
public unsafe MphotoToplevel (IImageRepository _repo, string[] args, params object[] props)
: base ("Mphoto", "0.0", Modules.UI, args, props)
{
cwh = new Glade.XMLCustomWidgetHandler (GladeCustomWidgetHandler);
Glade.XML.SetCustomHandler (cwh);
gxml = new Glade.XML (null, "mphoto.glade", null, null);
Console.WriteLine ("Autoconnect");
gxml.Autoconnect (this);
// CreateCustomWidget ("browser_icon_list");
// CreateCustomWidget ("collections_tree_view");
// CreateCustomWidget ("imageinfo_tree_view");
// CreateCustomWidget ("eog_image_view");
// CreateCustomWidget ("keywords_widget");
this.leftside_notebook = (Gtk.Notebook) gxml["browser_left_notebook"];
this.top_level_notebook = (Gtk.Notebook) gxml["top_level_notebook"];
this.toplevel = gxml["mphoto_browser"];
this.label_zoom_value = (Gtk.Label) gxml["label_zoom_value"];
this.search_dialog = (Gtk.Window) gxml["search_dialog"];
this.Repository = _repo;
// initialize the tree views to the side
imageinfo_tree_view.IconList = icon_list;
keywords_widget.IconList = icon_list;
collections_tree_view.RowActivated += new RowActivatedHandler (CollectionsTreeViewActivateHandler);
icon_list.Activated += new EventHandler (IconlistActivated);
GlobalMphotoToplevel = this;
}
开发者ID:emtees,项目名称:old-code,代码行数:34,代码来源:MphotoToplevel.cs
示例14: AddListItem
public ClosableExpander AddListItem (string name, Widget widget, PObject obj)
{
if (noContentLabel != null) {
contentBox.Remove (noContentLabel);
noContentLabel.Destroy ();
noContentLabel = null;
}
var expander = new ClosableExpander ();
expanders++;
expander.ContentLabel = name;
expander.SetWidget (widget);
expander.BorderWidth = 4;
expander.Closed += delegate(object sender, EventArgs e) {
expanders--;
var expanderWidget = (ClosableExpander)sender;
obj.Remove ();
contentBox.Remove (expanderWidget);
expanderWidget.Destroy ();
if (expanders == 0)
Clear ();
};
contentBox.PackStart (expander, true, true, 0);
contentBox.Show ();
expander.Expanded = false;
return expander;
}
开发者ID:hduregger,项目名称:monodevelop,代码行数:27,代码来源:ExpanderList.cs
示例15: CreateCellRenderer
public static CellViewBackend CreateCellRenderer (ApplicationContext actx, Widget widget, ICellRendererTarget col, object target, ICellViewFrontend view)
{
CellViewBackend crd;
if (view is ITextCellViewFrontend) {
crd = new CustomCellRendererText ();
}
else if (view is ICheckBoxCellViewFrontend) {
crd = new CustomCellRendererToggle ();
}
else if (view is IImageCellViewFrontend) {
crd = new CustomCellRendererImage ();
}
else if (view is ICanvasCellViewFrontend) {
crd = new CustomCellRenderer ();
}
else
throw new NotSupportedException ("Unknown cell view type: " + view.GetType ());
crd.Initialize (view, col, target);
col.PackStart (target, crd.CellRenderer, false);
col.SetCellDataFunc (target, crd.CellRenderer, (cellLayout, cell, treeModel, iter) => crd.LoadData (treeModel, iter));
view.AttachBackend (widget, crd);
return crd;
}
开发者ID:m13253,项目名称:xwt,代码行数:25,代码来源:CellUtil.cs
示例16: MonospacedTextViewControl
/// <summary>
/// Constructs a new MonospacedTextViewControl wrapper.
/// </summary>
/// <param name="widget">
/// The TextView widget to be wrapped.
/// </param>
public MonospacedTextViewControl(Widget widget)
: base(widget)
{
TextTag tag = new TextTag("Monospaced");
tag.Family = "Monospace";
buffer.TagTable.Add(tag);
}
开发者ID:Ripper555,项目名称:DynamicPropertyManagement,代码行数:13,代码来源:MonospacedTextViewControl.cs
示例17: Render
public override void Render(Drawable window,
Widget widget,
Rectangle cell_area,
Rectangle expose_area,
StateType cell_state,
IPhoto photo)
{
string text = GetRenderText (photo);
var layout = new Pango.Layout (widget.PangoContext);
layout.SetText (text);
Rectangle layout_bounds;
layout.GetPixelSize (out layout_bounds.Width, out layout_bounds.Height);
layout_bounds.Y = cell_area.Y;
layout_bounds.X = cell_area.X + (cell_area.Width - layout_bounds.Width) / 2;
if (layout_bounds.IntersectsWith (expose_area)) {
Style.PaintLayout (widget.Style, window, cell_state,
true, expose_area, widget, "IconView",
layout_bounds.X, layout_bounds.Y,
layout);
}
}
开发者ID:Yetangitu,项目名称:f-spot,代码行数:25,代码来源:ThumbnailTextCaptionRenderer.cs
示例18: GetSize
public override void GetSize (Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
x_offset = 0;
y_offset = 0;
width = 0;
height = 0;
}
开发者ID:takoyaki-hunter,项目名称:niconama-feeder,代码行数:7,代码来源:Program.cs
示例19: OneWidgetDialog
public OneWidgetDialog(Widget widget)
{
this.Build ();
var att = widget.GetType ().GetCustomAttributes (typeof(WidgetWindowAttribute), false);
if (att.Length > 0)
this.SetDefaultSize ((att [0] as WidgetWindowAttribute).DefaultWidth,
(att [0] as WidgetWindowAttribute).DefaultHeight);
widget.Show ();
VBox.Add (widget);
att = widget.GetType ().GetCustomAttributes (typeof(DisplayNameAttribute), true);
if (att.Length > 0)
Title = (att [0] as DisplayNameAttribute).DisplayName;
tdiTab = widget as ITdiTab;
if(tdiTab != null)
{
if(!String.IsNullOrWhiteSpace (tdiTab.TabName))
Title = tdiTab.TabName;
tdiTab.TabParent = this;
tdiTab.TabNameChanged += TdiTab_TabNameChanged;
tdiTab.CloseTab += TdiTab_CloseTab;
}
this.ReshowWithInitialSize ();
}
开发者ID:QualitySolution,项目名称:QSProjects,代码行数:28,代码来源:OneWidgetDialog.cs
示例20: WelcomePageBarButton
public WelcomePageBarButton(string title, string href, string iconResource = null)
{
FontFamily = Platform.IsMac ? Styles.WelcomeScreen.FontFamilyMac : Styles.WelcomeScreen.FontFamilyWindows;
HoverColor = Styles.WelcomeScreen.Links.HoverColor;
Color = Styles.WelcomeScreen.Links.Color;
FontSize = Styles.WelcomeScreen.Links.FontSize;
VisibleWindow = false;
this.Text = GettextCatalog.GetString (title);
this.actionLink = href;
if (!string.IsNullOrEmpty (iconResource)) {
imageHover = Xwt.Drawing.Image.FromResource (iconResource);
imageNormal = imageHover.WithAlpha (0.7);
}
IconTextSpacing = Styles.WelcomeScreen.Links.IconTextSpacing;
image = new Xwt.ImageView ();
label = CreateLabel ();
imageWidget = image.ToGtkWidget ();
box.PackStart (imageWidget, false, false, 0);
if (imageNormal == null)
imageWidget.NoShowAll = true;
box.PackStart (label, false, false, 0);
box.ShowAll ();
Add (box);
Update ();
Events |= (Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.ButtonReleaseMask);
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:30,代码来源:WelcomePageBarButton.cs
注:本文中的Gtk.Widget类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论