本文整理汇总了C#中Xwt类的典型用法代码示例。如果您正苦于以下问题:C# Xwt类的具体用法?C# Xwt怎么用?C# Xwt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Xwt类属于命名空间,在下文中一共展示了Xwt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDraw
protected override void OnDraw(Xwt.Drawing.Context ctx, Xwt.Rectangle dirtyRect)
{
base.OnDraw(ctx, dirtyRect);
if (pages == null)
{
return;
}
ctx.Font = this.Font;
ctx.Save();
int width = (int)(report.PageWidthPoints * Scale);
int height = (int)(report.PageHeightPoints * Scale);
//Xwt.Rectangle rep_r = new Xwt.Rectangle(1, 1, width - 1, height - 1);
//RenderXwt render = new RenderXwt(ctx, Scale);
//render.RunPage(pages);
//ctx.Stroke();
// Page Drawing using System.Drawing converted to Xwt Context
PageDrawing render = new PageDrawing(ctx, 1f);
render.RunPage(pages);
ctx.Stroke();
ctx.Save();
}
示例2: DragEventArgs
public DragEventArgs (Point position, Xwt.Backends.TransferDataStore dataStore, DragDropAction action)
{
Data = dataStore;
Position = position;
Action = action;
Success = false;
}
示例3: OnSetBackgroundColor
protected override void OnSetBackgroundColor (Xwt.Drawing.Color color)
{
base.OnSetBackgroundColor (color);
Widget.SetBackgroundColor (color);
Widget.SetChildBackgroundColor (color);
EventsRootWidget.SetBackgroundColor (color);
}
示例4: RequestPopup
internal async void RequestPopup (Xwt.Rectangle rect)
{
var token = popupSrc.Token;
diff = await Task.Run (async delegate {
try {
foreach (var op in await codeAction.GetPreviewOperationsAsync (token)) {
var ac = op as ApplyChangesOperation;
if (ac == null) {
continue;
}
var changedDocument = ac.ChangedSolution.GetDocument (documentContext.AnalysisDocument.Id);
changedTextDocument = TextEditorFactory.CreateNewDocument (new StringTextSource ((await changedDocument.GetTextAsync (token)).ToString ()), editor.FileName);
try {
var list = new List<DiffHunk> (editor.GetDiff (changedTextDocument, new DiffOptions (false, true)));
if (list.Count > 0)
return list;
} catch (Exception e) {
LoggingService.LogError ("Error while getting preview list diff.", e);
}
}
} catch (OperationCanceledException) {}
return new List<DiffHunk> ();
});
if (diff.Count > 0 && !token.IsCancellationRequested)
ShowPopup (rect, PopupPosition.Left);
}
示例5: ShowDialog
/// <summary>Shows dialog</summary>
/// <returns><value>True</value> if user want to proceed current operation, and <value>False</value> if user don't.</returns>
public bool ShowDialog(Xwt.WindowFrame parent = null)
{
Build();
Xwt.Command DialogResult = null;
if (parent == null){
DialogResult = this.Run();
}
else{
DialogResult = this.Run(parent);
}
//4beginners: xwtdialog.Run() == winform.ShowDialog() == vb6form.Show(vbModal);
if (DialogResult == null) return false;
switch (DialogResult.Id) //hack due to C# limitation (it's unable to do switch(){} on custon types)
{
case "Add":
case "Apply":
case "Clear":
case "Copy":
case "Cut":
case "Delete":
case "Ok":
case "Paste":
case "Remove":
case "Save":
case "SaveAs":
case "Yes":
return true;
}
return false;
}
示例6: SendKeyPressed
bool SendKeyPressed (Xwt.KeyEventArgs kargs)
{
if (KeyPressed != null)
KeyPressed (this, kargs);
return kargs.Handled;
}
示例7: MakePopover
public static NSPopover MakePopover(Xwt.Widget child, Color backgroundColor)
{
return new NSPopover {
Behavior = NSPopoverBehavior.Transient,
ContentViewController = new FactoryViewController (child) { BackgroundColor = backgroundColor.ToCGColor () }
};
}
示例8: InputBox
public InputBox(string AskText, string DefaultValue, Xwt.Command[] Buttons)
{
lblQuestion.Text = AskText;
txtAnwser.Text = DefaultValue;
this.Buttons.Add(Buttons);
}
示例9: NotifyClicked
internal void NotifyClicked (Xwt.PointerButton button)
{
if (Clicked != null)
Clicked (this, new StatusBarIconClickedEventArgs {
Button = button,
});
}
示例10: CreateTooltipWindow
public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState)
{
var result = new LanguageItemWindow (GetExtensibleTextEditor (editor), modifierState, null, (string)item.Item, null);
if (result.IsEmpty)
return null;
return result;
}
示例11: OnDraw
protected override void OnDraw(Xwt.Drawing.Context ctx, Rectangle dirtyRect)
{
if (!Sensitive)
{
ctx.GlobalAlpha = .5d;
}
if (image == null)
{
ctx.SetColor(bg);
ctx.Rectangle(dirtyRect);
ctx.Fill();
}
else
ctx.DrawImage(image, new Rectangle(0, 0, WidthRequest, HeightRequest));
if (mOver && Sensitive)
{
ctx.SetColor(mOverColor);
ctx.Rectangle(dirtyRect);
ctx.Fill();
}
if (mDown)
{
ctx.SetColor(mOverColor);
ctx.Rectangle(dirtyRect);
ctx.Fill();
}
//ctx.SetColor(Colors.Red);
//ctx.Rectangle(0, 0, WidthRequest, HeightRequest);
//ctx.Stroke();
}
示例12: OnDraw
protected override void OnDraw(Xwt.Drawing.Context ctx, Xwt.Rectangle dirtyRect)
{
ctx.Rectangle(dirtyRect);
ctx.SetColor(Colors.White);
ctx.Fill();
this.Buttons.ForEach(X => DrawGradientButton(ctx, X));
}
示例13: OnDraw
protected override void OnDraw(Xwt.Drawing.Context ctx, Xwt.Rectangle dirtyRect)
{
base.OnDraw(ctx, dirtyRect);
if (pages == null)
{
return;
}
ctx.Save();
//Xwt.Rectangle rep_r = new Xwt.Rectangle(1, 1, width - 1, height - 1);
//RenderXwt render = new RenderXwt(ctx, Scale);
//render.RunPage(pages);
//ctx.Stroke();
if (_defaultBackend == Backend.PureXwt)
{
RenderXwt render = new RenderXwt(ctx, this, 1f);
render.RunPage(pages);
}
else
{
// Page Drawing using System.Drawing converted to Xwt Context
PageDrawing render = new PageDrawing(ctx, 1f, Convert.ToInt32(this.MinWidth), Convert.ToInt32(this.MinHeight));
render.RunPage(pages);
}
ctx.Stroke();
ctx.Save();
}
示例14: 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 (); };
}
示例15: OnSetBackgroundColor
protected override void OnSetBackgroundColor (Xwt.Drawing.Color color)
{
// Gtk3 workaround (by rpc-scandinavia, see https://github.com/mono/xwt/pull/411)
var selectedColor = Widget.GetBackgroundColor(StateType.Selected);
Widget.SetBackgroundColor (StateType.Normal, Xwt.Drawing.Colors.Transparent);
Widget.SetBackgroundColor (StateType.Selected, selectedColor);
base.OnSetBackgroundColor (color);
}