public ListItem(string text, int index) { Text = text; Index = index; TouchEvent += OnTouchEvent; Size2D = new Tizen.NUI.Size2D(720, 100); }
public static PixelBuffer LoadImageFromFile(Uri uri, Size2D size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection) { if (null == size) { throw new ArgumentNullException(nameof(size)); } if (uri == null) { throw new ArgumentNullException(nameof(uri)); } PixelBuffer ret; using (var uSize = new Uint16Pair((uint)size.Width, (uint)size.Height)) { ret = new PixelBuffer(Interop.ImageLoading.LoadImageFromFile(uri.AbsoluteUri, Uint16Pair.getCPtr(uSize), (int)fittingMode, (int)samplingMode, orientationCorrection), true); } if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
// Starts of the actual measuring and layouting from the given root node. // Can be called from multiple starting roots but in series. void MeasureAndLayout(View root) { if (root !=null) { // Get parent MeasureSpecification, this could be the Window or View with an exact size. Container parentNode = root.GetParent(); Size2D rootSize; Position2D rootPosition = root.Position2D; View parentView = parentNode as View; if (parentView) { // Get parent View's Size. If using Legacy size negotiation then should have been set already. rootSize = new Size2D(parentView.Size2D.Width, parentView.Size2D.Height); } else { // Parent not a View so assume it's a Layer which is the size of the window. rootSize = new Size2D(_window.Size.Width, _window.Size.Height); } // Determine measure specification for root. // The root layout policy could be an exact size, be match parent or wrap children. // If wrap children then at most it can be the root parent size. // If match parent then should be root parent size. // If exact then should be that size limited by the root parent size. LayoutLength width = new LayoutLength(rootSize.Width); LayoutLength height = new LayoutLength(rootSize.Height); MeasureSpecification.ModeType widthMode = MeasureSpecification.ModeType.AtMost; MeasureSpecification.ModeType heightMode = MeasureSpecification.ModeType.AtMost; if (root.WidthSpecification >= 0 ) { // exact size provided so match width exactly width = new LayoutLength(root.WidthSpecification); widthMode = MeasureSpecification.ModeType.Exactly; } else if (root.WidthSpecification == LayoutParamPolicies.MatchParent) { widthMode = MeasureSpecification.ModeType.Exactly; } if (root.HeightSpecification >= 0 ) { // exact size provided so match height exactly height = new LayoutLength(root.HeightSpecification); heightMode = MeasureSpecification.ModeType.Exactly; } else if (root.HeightSpecification == LayoutParamPolicies.MatchParent) { heightMode = MeasureSpecification.ModeType.Exactly; } MeasureSpecification parentWidthSpecification = new MeasureSpecification( width, widthMode); MeasureSpecification parentHeightSpecification = new MeasureSpecification( height, heightMode); // Start at root with it's parent's widthSpecification and heightSpecification MeasureHierarchy(root, parentWidthSpecification, parentHeightSpecification); // Start at root which was just measured. PerformLayout( root, new LayoutLength(rootPosition.X), new LayoutLength(rootPosition.Y), new LayoutLength(rootPosition.X) + root.Layout.MeasuredWidth.Size, new LayoutLength(rootPosition.Y) + root.Layout.MeasuredHeight.Size ); } }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Size2D obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr); }
/// <summary> /// The constructor with stylesheet, window mode, window size and window position. /// </summary> public NUICoreBackend(string stylesheet, NUIApplication.WindowMode windowMode, Size2D windowSize, Position2D windowPosition) { this.stylesheet = stylesheet; this.windowMode = windowMode; if (windowSize != null && windowPosition != null) { this.windowRectangle = new Rectangle(windowPosition.X, windowPosition.Y, windowSize.Width, windowSize.Height); } }
public NUIApplication(Size2D windowSize, Position2D windowPosition) : base(new NUICoreBackend("", NUIApplication.WindowMode.Opaque, windowSize, windowPosition)) { ExternalThemeManager.Initialize(); }
public NUIApplication(Size2D windowSize, Position2D windowPosition) : base(new NUICoreBackend("", NUIApplication.WindowMode.Opaque, windowSize, windowPosition)) { }
public NUIApplication(Graphics.BackendType backend, WindowMode windowMode = WindowMode.Opaque, Size2D windowSize = null, Position2D windowPosition = null, string styleSheet = "") : base(new NUICoreBackend(styleSheet, windowMode, windowSize, windowPosition)) { //windowMode and styleSheet will be added later. currently it's not working as expected. Graphics.Backend = backend; Tizen.Log.Error("NUI", "Plaese DO NOT set graphical backend type with this constructor! This will give no effect!"); }
private global::System.IntPtr DirectorGetNaturalSize() { return(Size2D.getCPtr(GetNaturalSize()).Handle); }
/// <summary> /// Creates a Size2D property value. /// </summary> /// <param name="vectorValue">Size2D values.</param> /// <since_tizen> 3 </since_tizen> public PropertyValue(Size2D vectorValue) : this(Interop.PropertyValue.NewPropertyValueVector2(Size2D.getCPtr(vectorValue)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } }
public NUIApplication(string styleSheet, WindowMode windowMode, Size2D windowSize, Position2D windowPosition, WindowType type) : base(new NUICoreBackend(styleSheet, windowMode, windowSize, windowPosition, type)) { ExternalThemeManager.Initialize(); }
/// <summary> /// Internal constructor with Graphics Backend Type /// </summary> /// <param name="backend"></param> /// <param name="windowMode"></param> /// <param name="windowSize"></param> /// <param name="windowPosition"></param> /// <param name="styleSheet"></param> internal NUIApplication(Graphics.BackendType backend, WindowMode windowMode = WindowMode.Opaque, Size2D windowSize = null, Position2D windowPosition = null, string styleSheet = "") : base(new NUICoreBackend(styleSheet, windowMode)) { //windowMode and styleSheet will be added later. currenlty it's not working as expected. Graphics.Backend = backend; if (windowSize != null) { _windowSize2D = windowSize; } if (windowPosition != null) { _windowPosition2D = windowPosition; } Registry.Instance.SavedApplicationThread = Thread.CurrentThread; }
// Called when the window size has changed. private void OnBorderWindowResized(object sender, Window.ResizedEventArgs e) { Tizen.Log.Info("NUI", $"OnBorderWindowResized {e.WindowSize.Width},{e.WindowSize.Height}\n"); int resizeWidth = e.WindowSize.Width; int resizeHeight = e.WindowSize.Height; if (borderInterface.MinSize != null) { resizeWidth = borderInterface.MinSize.Width > resizeWidth ? (int)borderInterface.MinSize.Width : resizeWidth; resizeHeight = borderInterface.MinSize.Height > resizeHeight ? (int)borderInterface.MinSize.Height : resizeHeight; } if (borderInterface.MaxSize != null) { resizeWidth = borderInterface.MaxSize.Width < resizeWidth ? (int)borderInterface.MaxSize.Width : resizeWidth; resizeHeight = borderInterface.MaxSize.Height < resizeHeight ? (int)borderInterface.MaxSize.Height : resizeHeight; } if (resizeWidth != e.WindowSize.Width || resizeHeight != e.WindowSize.Height) { WindowSize = new Size2D(resizeWidth, resizeHeight); } borderInterface.OnResized(resizeWidth, resizeHeight); // reset borderHeight borderHeight = 0; if (isTop) { borderHeight += topView.SizeHeight; } if (isBottom) { borderHeight += bottomView.SizeHeight; } if (borderInterface.OverlayMode == true && IsMaximized() == true) { Interop.ActorInternal.SetSize(GetBorderWindowRootLayer().SwigCPtr, resizeWidth, resizeHeight); Interop.ActorInternal.SetSize(GetBorderWindowBottomLayer().SwigCPtr, resizeWidth, resizeHeight); Interop.ActorInternal.SetPosition(GetBorderWindowRootLayer().SwigCPtr, 0, 0); if (contentsView != null) { contentsView.SizeHeight = resizeHeight - borderHeight - borderInterface.BorderLineThickness * 2; } OverlayMode(true); } else { float height = (isTop == true) ? topView.SizeHeight : 0; Interop.ActorInternal.SetSize(GetBorderWindowRootLayer().SwigCPtr, resizeWidth, resizeHeight); Interop.ActorInternal.SetSize(GetBorderWindowBottomLayer().SwigCPtr, resizeWidth + borderInterface.BorderLineThickness * 2, resizeHeight + borderHeight + borderInterface.BorderLineThickness * 2); Interop.ActorInternal.SetPosition(GetBorderWindowRootLayer().SwigCPtr, 0, height + borderInterface.BorderLineThickness); if (contentsView != null) { contentsView.SizeHeight = resizeHeight; } OverlayMode(false); } if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } }
/// <summary> /// Enable the border window with IBorderInterface. /// This adds a border area to the Window. /// The border's UI is configured using IBorderInterface. /// Users can reisze and move by touching the border area. /// </summary> /// <param name="borderInterface">The IBorderInterface.</param> /// <param name="borderCloseDelegate">The BorderCloseDelegate. When close, this delegate is called.</param> /// <returns>Whether the border window is enabled</returns> internal bool EnableBorder(IBorderInterface borderInterface, BorderCloseDelegate borderCloseDelegate = null) { if (isBorderWindow == true) { Tizen.Log.Error("NUI", $"Already EnableBorderWindow\n"); return(false); } try { Information.TryGetValue <int>("http://tizen.org/feature/screen.width", out screenWidth); Information.TryGetValue <int>("http://tizen.org/feature/screen.height", out screenHeight); } catch (DllNotFoundException e) { Tizen.Log.Fatal("NUI", $"{e}\n"); } if (borderInterface == null) { borderInterface = new DefaultBorder(); } this.borderInterface = borderInterface; this.borderCloseDelegate = borderCloseDelegate; GetDefaultLayer().Name = "OriginalRootLayer"; SetTransparency(true); BackgroundColor = Color.Transparent; borderInterface.BorderWindow = this; if (CreateBorder() == true) { using var realWindowSize = new Size2D(WindowSize.Width, WindowSize.Height); isBorderWindow = true; Resized += OnBorderWindowResized; borderInterface.OnCreated(borderView); // Increase the window size as much as the border area. borderHeight = 0; if (isTop) { borderHeight += topView.SizeHeight; } if (isBottom) { borderHeight += bottomView.SizeHeight; } // When running the app for the first time, if it runs in full size, do Maximize(true). if (screenWidth != 0 && screenHeight != 0 && realWindowSize.Width >= screenWidth && realWindowSize.Height >= screenHeight && IsMaximized() == false) { Maximize(true); borderInterface.OnMaximize(true); ResizedEventArgs e = new ResizedEventArgs(); e.WindowSize = WindowSize; OnBorderWindowResized(this, e); } else { WindowSize += new Size2D((int)borderInterface.BorderLineThickness * 2, (int)(borderHeight + borderInterface.BorderLineThickness * 2)); } // If it is BorderResizePolicyType.KeepRatio type, it will be resized according to the ratio. if (borderInterface.ResizePolicy == BorderResizePolicyType.KeepRatio) { AddAuxiliaryHint("wm.policy.win.resize_aspect_ratio", "1"); } // Add a view to the border layer. GetBorderWindowBottomLayer().Add(rootView); InterceptTouchEvent += (s, e) => { if (e.Touch.GetState(0) == PointStateType.Down && IsMaximized() == false) { Raise(); } return(false); }; return(true); } else { this.borderInterface.Dispose(); return(false); } }
public NUIApplication(string styleSheet, Size2D windowSize, Position2D windowPosition, IBorderInterface borderInterface, WindowMode windowMode = WindowMode.Opaque) : base(new NUICoreBackend(styleSheet, windowMode, windowSize, windowPosition)) { borderEnabled = true; this.borderInterface = borderInterface; }
public NUIApplication(Graphics.BackendType backend, WindowMode windowMode = WindowMode.Opaque, Size2D windowSize = null, Position2D windowPosition = null, string styleSheet = "") : base(new NUICoreBackend(styleSheet, windowMode)) { //windowMode and styleSheet will be added later. currenlty it's not working as expected. Graphics.Backend = backend; Tizen.Log.Error("NUI", "Plaese DO NOT set graphical backend type with this constructor! This will give no effect!"); if (windowSize != null) { _windowSize2D = windowSize; } if (windowPosition != null) { _windowPosition2D = windowPosition; } Registry.Instance.SavedApplicationThread = Thread.CurrentThread; }
public NUIApplication(string styleSheet, Size2D windowSize, Position2D windowPosition) : base(new NUICoreBackend(styleSheet)) { Registry.Instance.SavedApplicationThread = Thread.CurrentThread; _windowSize2D = windowSize; _windowPosition2D = windowPosition; }
/// <summary> /// The constructor with stylesheet, window mode, window size and window position. /// </summary> public NUICoreBackend(string stylesheet, NUIApplication.WindowMode windowMode, Size2D windowSize, Position2D windowPosition) { _stylesheet = stylesheet; _windowMode = windowMode; _windowSize = windowSize; _windowPosition = windowPosition; }
public NUIApplication(Size2D windowSize, Position2D windowPosition, ThemeOptions option) : base(new NUICoreBackend("", NUIApplication.WindowMode.Opaque, windowSize, windowPosition)) { ApplyThemeOption(option); }
private Size2D Multiply(Size2D rhs) { Size2D ret = new Size2D(Interop.Vector2.Vector2_Multiply__SWIG_0(swigCPtr, Size2D.getCPtr(rhs)), true); if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public NUIApplication(string styleSheet, Size2D windowSize, Position2D windowPosition) : base(new NUICoreBackend(styleSheet, WindowMode.Opaque, windowSize, windowPosition)) { }
public NUIApplication(Size2D windowSize, Position2D windowPosition) : base(new NUICoreBackend("", WindowMode.Opaque, windowSize, windowPosition)) { Registry.Instance.SavedApplicationThread = Thread.CurrentThread; _windowSize2D = windowSize; _windowPosition2D = windowPosition; }