本文整理汇总了C#中Xwt.Backends.ApplicationContext类的典型用法代码示例。如果您正苦于以下问题:C# ApplicationContext类的具体用法?C# ApplicationContext怎么用?C# ApplicationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ApplicationContext类属于Xwt.Backends命名空间,在下文中一共展示了ApplicationContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: CustomImage
public CustomImage(ApplicationContext actx, ImageDrawCallback drawCallback)
{
this.actx = actx;
this.drawCallback = drawCallback;
imgRep = new NSCustomImageRep (new Selector ("drawIt:"), this);
AddRepresentation (imgRep);
}
示例3: CreateBoundColumnTemplate
internal static FrameworkElementFactory CreateBoundColumnTemplate (ApplicationContext ctx, Widget parent, CellViewCollection views, string dataPath = ".")
{
if (views.Count == 1)
return CreateBoundCellRenderer(ctx, parent, views[0], dataPath);
FrameworkElementFactory container = new FrameworkElementFactory (typeof (StackPanel));
container.SetValue (StackPanel.OrientationProperty, System.Windows.Controls.Orientation.Horizontal);
foreach (CellView view in views) {
var factory = CreateBoundCellRenderer(ctx, parent, view, dataPath);
factory.SetValue(FrameworkElement.MarginProperty, CellMargins);
if (view.VisibleField != null)
{
var binding = new Binding(dataPath + "[" + view.VisibleField.Index + "]");
binding.Converter = new BooleanToVisibilityConverter();
factory.SetBinding(UIElement.VisibilityProperty, binding);
}
else if (!view.Visible)
factory.SetValue(UIElement.VisibilityProperty, Visibility.Collapsed);
container.AppendChild(factory);
}
return container;
}
示例4: CreateCellRenderer
public static Gtk.CellRenderer CreateCellRenderer(ApplicationContext actx, ICellRendererTarget col, object target, ICellViewFrontend view, Gtk.TreeModel model)
{
if (view is ITextCellViewFrontend) {
var cr = new CustomCellRendererText ((ITextCellViewFrontend)view);
col.PackStart (target, cr, false);
col.SetCellDataFunc (target, cr, (cell_layout, cell, treeModel, iter) => cr.LoadData (treeModel, iter));
return cr;
}
else if (view is ICheckBoxCellViewFrontend) {
CustomCellRendererToggle cr = new CustomCellRendererToggle ((ICheckBoxCellViewFrontend)view);
col.PackStart (target, cr, false);
col.SetCellDataFunc (target, cr, (cellLayout, cell, treeModel, iter) => cr.LoadData (treeModel, iter));
return cr;
}
else if (view is IImageCellViewFrontend) {
CustomCellRendererImage cr = new CustomCellRendererImage (actx, (IImageCellViewFrontend)view);
col.PackStart (target, cr, false);
col.SetCellDataFunc (target, cr, (cellLayout, cell, treeModel, iter) => cr.LoadData (treeModel, iter));
return cr;
}
else if (view is ICanvasCellViewFrontend) {
var cr = new CustomCellRenderer ((ICanvasCellViewFrontend) view);
col.PackStart (target, cr, false);
col.SetCellDataFunc (target, cr, (cellLayout, cell, treeModel, iter) => cr.LoadData (treeModel, iter));
return cr;
}
throw new NotSupportedException ("Unknown cell view type: " + view.GetType ());
}
示例5: CreateCell
public static NSCell CreateCell (ApplicationContext context, NSTableView table, ICellSource source, ICollection<CellView> cells, int column)
{
CompositeCell c = new CompositeCell (context, Orientation.Horizontal, source);
foreach (var cell in cells)
c.AddCell ((ICellRenderer) CreateCell (table, c, cell, column));
return c;
}
示例6: ScrollControlBackend
public ScrollControlBackend (ApplicationContext appContext, NSScrollView scrollView, bool vertical)
{
this.vertical = vertical;
this.scrollView = scrollView;
this.appContext = appContext;
lastValue = Value;
}
示例7: CompositeCell
public CompositeCell (ApplicationContext context, Orientation dir, ICellSource source)
{
if (source == null)
throw new ArgumentNullException ("source");
direction = dir;
this.context = context;
this.source = source;
}
示例8: InitializeBackend
public override void InitializeBackend (object frontend, ApplicationContext context)
{
base.InitializeBackend (frontend, context);
buttonBox = new HBox () {
Spacing = 0,
Margin = 0
};
buttonBoxView = ((ViewBackend)buttonBox.GetBackend ()).Widget;
ContentView.AddSubview (buttonBoxView);
}
示例9: CreateBoundColumnTemplate
internal static FrameworkElementFactory CreateBoundColumnTemplate (ApplicationContext ctx, Widget parent, CellViewCollection views, string dataPath = ".")
{
if (views.Count == 1)
return CreateBoundCellRenderer(ctx, parent, views[0], dataPath);
FrameworkElementFactory container = new FrameworkElementFactory (typeof (StackPanel));
container.SetValue (StackPanel.OrientationProperty, System.Windows.Controls.Orientation.Horizontal);
foreach (CellView view in views) {
container.AppendChild(CreateBoundCellRenderer(ctx, parent, view, dataPath));
}
return container;
}
示例10: InitializeBackend
public override void InitializeBackend(object frontend, ApplicationContext context)
{
base.InitializeBackend (frontend, context);
mainBox = new VBox () {
Spacing = 0,
Margin = 0
};
buttonBox = new HBox () {
Spacing = 0,
Margin = 0
};
mainBox.PackEnd (buttonBox);
base.SetChild ((IWidgetBackend) Toolkit.GetBackend (mainBox));
}
示例11: MacMenuButton
public MacMenuButton (IMenuButtonEventSink eventSink, ApplicationContext context)
{
this.eventSink = eventSink;
this.context = context;
PullsDown = true;
Activated += delegate {
context.InvokeUserCode (delegate {
eventSink.OnClicked ();
});
};
NSNotificationCenter.DefaultCenter.AddObserver ("NSPopUpButtonWillPopUpNotification", CreateMenu, this);
AddItem ("");
}
示例12: GetSelectionData
public static bool GetSelectionData (ApplicationContext context, Gtk.SelectionData data, TransferDataStore target)
{
TransferDataType type = Util.AtomToType (data.Target.Name);
if (type == null || data.Length <= 0)
return false;
if (type == TransferDataType.Text)
target.AddText (data.Text);
else if (data.TargetsIncludeImage (false))
target.AddImage (context.Toolkit.WrapImage (data.Pixbuf));
else if (type == TransferDataType.Uri) {
var uris = System.Text.Encoding.UTF8.GetString (data.Data).Split ('\n').Where (u => !string.IsNullOrEmpty(u)).Select (u => new Uri (u)).ToArray ();
target.AddUris (uris);
}
else
target.AddValue (type, data.Data);
return true;
}
示例13: GetPattern
public Cairo.Pattern GetPattern(ApplicationContext actx, double scaleFactor)
{
if (pattern == null || currentScaleFactor != scaleFactor) {
if (pattern != null)
pattern.Dispose ();
Gdk.Pixbuf pb = ((GtkImage)Image.Backend).GetBestFrame (actx, scaleFactor, Image.Size.Width, Image.Size.Height, false);
var imgs = new Cairo.ImageSurface (Cairo.Format.ARGB32, (int)(Image.Size.Width * scaleFactor), (int)(Image.Size.Height * scaleFactor));
var ic = new Cairo.Context (imgs);
ic.Scale ((double)imgs.Width / (double)pb.Width, (double)imgs.Height / (double)pb.Height);
Gdk.CairoHelper.SetSourcePixbuf (ic, pb, 0, 0);
ic.Paint ();
imgs.Flush ();
((IDisposable)ic).Dispose ();
pattern = new Cairo.SurfacePattern (imgs);
pattern.Extend = Cairo.Extend.Repeat;
var cm = new Cairo.Matrix ();
cm.Scale (scaleFactor, scaleFactor);
pattern.Matrix = cm;
currentScaleFactor = scaleFactor;
}
return pattern;
}
示例14: ImageBox
public ImageBox()
{
this.actx = ToolkitEngineBackend.GetToolkitBackend<WPFEngine> ().ApplicationContext;
}
示例15: GetBestFrame
public ImageSource GetBestFrame(ApplicationContext actx, double scaleFactor, double width, double height, bool forceExactSize)
{
var f = FindFrame (width, height, scaleFactor);
if (f == null || (forceExactSize && (Math.Abs (f.Width - width * scaleFactor) > 0.01 || Math.Abs (f.Height - height * scaleFactor) > 0.01)))
return RenderFrame (actx, scaleFactor, width, height);
else
return f;
}