Esempio n. 1
0
        protected override void OnEnable()
        {
            base.OnEnable();

            //Disable the default touch -> mouse event conversion on mobile devices
            Input.simulateMouseWithTouches = false;

            this._displayMetrics = DisplayMetricsProvider.provider();
            this._displayMetrics.OnEnable();

            this._enteredPointers.Clear();

            if (_repaintEvent == null)
            {
                _repaintEvent = new Event {
                    type = EventType.Repaint
                };
            }

            D.assert(this._windowAdapter == null);
            this._windowAdapter = new UIWidgetWindowAdapter(this);

            this._windowAdapter.OnEnable();

            Widget root;

            using (this._windowAdapter.getScope()) {
                root = this.createWidget();
            }

            this._windowAdapter.attachRootWidget(root);
            this._lastMouseMove = Input.mousePosition;
        }
Esempio n. 2
0
        protected override void OnEnable()
        {
            base.OnEnable();

            if (_repaintEvent == null)
            {
                _repaintEvent = new Event {
                    type = EventType.Repaint
                };
            }

            D.assert(this._windowAdapter == null);
            this._windowAdapter = new UIWidgetWindowAdapter(this);

            this._windowAdapter.OnEnable();
            var root = new WidgetsApp(
                home: this.getWidget(),
                window: this._windowAdapter,
                routes: this.routes,
                textStyle: this.textStyle,
                pageRouteBuilder: this.pageRouteBuilder,
                onGenerateRoute: this.onGenerateRoute,
                onUnknownRoute: this.onUnknownRoute);


            this._windowAdapter.attachRootWidget(root);
            this._lastMouseMove = Input.mousePosition;
        }
Esempio n. 3
0
 void OnEnable()
 {
     this.windowAdapter = new EditorWindowAdapter(this);
     this.windowAdapter.OnEnable();
     this.root = new Container(
         width: 200,
         height: 200,
         margin: EdgeInsets.all(30.0),
         padding: EdgeInsets.all(15.0),
         color: Color.fromARGB(255, 244, 190, 85),
         child: new EditableText(
             maxLines: 100,
             selectionControls: MaterialUtils.materialTextSelectionControls,
             controller: new TextEditingController(this.txt),
             focusNode: new FocusNode(),
             style: new TextStyle(),
             selectionColor: Color.fromARGB(255, 255, 0, 0),
             cursorColor: Color.fromARGB(255, 0, 0, 0)
             )
         );
     this.windowAdapter.attachRootWidget(new WidgetsApp(window: this.windowAdapter, home: this.root,
                                                        pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) =>
                                                        new PageRouteBuilder(
                                                            settings: settings,
                                                            pageBuilder: (BuildContext context, Unity.UIWidgets.animation.Animation <double> animation,
                                                                          Unity.UIWidgets.animation.Animation <double> secondaryAnimation) => builder(context)
                                                            )));
     this.titleContent = new GUIContent("EditableTextWidget");
 }
Esempio n. 4
0
        void OnEnable()
        {
            this.windowAdapter = new EditorWindowAdapter(this);
            this.windowAdapter.OnEnable();

            FontManager.instance.addFont(Resources.Load <Font>("MaterialIcons-Regular"));
        }
Esempio n. 5
0
        protected override void OnEnable()
        {
            base.OnEnable();

            //Disable touch -> mouse event on mobile devices
            Input.simulateMouseWithTouches = false;

            this._displayMetrics = DisplayMetricsProvider.provider();

            if (_repaintEvent == null)
            {
                _repaintEvent = new Event {
                    type = EventType.Repaint
                };
            }

            D.assert(this._windowAdapter == null);
            this._windowAdapter = new UIWidgetWindowAdapter(this);

            this._windowAdapter.OnEnable();
            var root = new WidgetsApp(
                home: this.getWidget(),
                window: this._windowAdapter,
                routes: this.routes,
                textStyle: this.textStyle,
                pageRouteBuilder: this.pageRouteBuilder,
                onGenerateRoute: this.onGenerateRoute,
                onUnknownRoute: this.onUnknownRoute);


            this._windowAdapter.attachRootWidget(root);
            this._lastMouseMove = Input.mousePosition;
        }
Esempio n. 6
0
        protected virtual void InitWindowAdapter()
        {
            D.assert(this._windowAdapter == null);
            this._windowAdapter = new UIWidgetWindowAdapter(this);

            this._windowAdapter.OnEnable();
        }
Esempio n. 7
0
 protected override void OnDisable()
 {
     D.assert(this._windowAdapter != null);
     this._windowAdapter.OnDisable();
     this._windowAdapter = null;
     base.OnDisable();
 }
Esempio n. 8
0
        void OnEnable()
        {
            this._windowAdapter = new EditorWindowAdapter(this);
            this._windowAdapter.OnEnable();
            this._meshPool = new MeshPool();

            texture6 = Resources.Load <Texture2D>("6");
        }
    public virtual IWindow CreateChild(object viewModel)
    {
        var cw = new ContentWindow();

        cw.Owner       = this.wpfWindow;
        cw.DataContext = viewModel;
        WindowAdapter.ConfigureBehavior(cw);
        return(new WindowAdapter(cw));
    }
Esempio n. 10
0
        protected override void OnDisable()
        {
#endif
            D.assert(this._windowAdapter != null);
            this._windowAdapter.OnDisable();
            this._windowAdapter = null;
#if !UNITY_2019_2_OR_NEWER
            base.OnDisable();
#endif
        }
Esempio n. 11
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                this.appCompatDelegate = null;
                this.actionBarAdapter  = null;
                this.windowAdapter     = null;

                this.disposables.Dispose();
            }

            base.Dispose(disposing);
        }
Esempio n. 12
0
        void OnEnable()
        {
            this.windowAdapter = new EditorWindowAdapter(this);
            this.windowAdapter.OnEnable();

            this._tapRecognizer       = new TapGestureRecognizer();
            this._tapRecognizer.onTap = () => { Debug.Log("tap"); };

            this._panRecognizer          = new PanGestureRecognizer();
            this._panRecognizer.onUpdate = (details) => { Debug.Log("onUpdate " + details); };

            this._doubleTapGesture             = new DoubleTapGestureRecognizer();
            this._doubleTapGesture.onDoubleTap = (detail) => { Debug.Log("onDoubleTap"); };
        }
Esempio n. 13
0
        //private static string NativeGetTitle(ProdWindow baseControl)
        //{
        //    return ProdWindowNative.GetWindowTitleNative(baseControl.NativeHandle);
        //}

        /// <summary>
        /// Sets the specified windows title
        /// </summary>
        /// <param name="extension">The extended interface.</param>
        /// <param name="baseControl">The base control.</param>
        /// <param name="title">The title.</param>
        internal static void SetTitleBridge(this WindowAdapter extension, ProdWindow baseControl, string title)
        {
            //try
            //{
            //    NativeSetTitle(baseControl, title);
            //}
            //catch (ArgumentNullException err)
            //{
            //    throw new ProdOperationException(err);
            //}
            //catch (ElementNotAvailableException err)
            //{
            //    throw new ProdOperationException(err);
            //}
            //catch (InvalidOperationException err)
            //{
            //    throw new ProdOperationException(err);
            //}
        }
Esempio n. 14
0
 internal static void CloseWindowBridge(this WindowAdapter extension, ProdWindow baseControl)
 {
     try
     {
         UiaCloseWindow(baseControl);
     }
     catch (ArgumentNullException err)
     {
         throw new ProdOperationException(err);
     }
     catch (ElementNotAvailableException err)
     {
         throw new ProdOperationException(err);
     }
     //catch (InvalidOperationException)
     //{
     //    NativeCloseWindow(baseControl);
     //}
 }
Esempio n. 15
0
 /// <summary>
 /// Causes the calling code to block for the specified time or until the associated process enters an idle state, whichever completes first
 /// </summary>
 /// <param name="extension">The extended interface.</param>
 /// <param name="baseControl">The base control.</param>
 /// <param name="delay">Time, in milliseconds to wait for an idle state</param>
 /// <returns>
 ///   <c>true</c> if the window has entered the idle state. <c>false</c> if the timeout occurred
 /// </returns>
 internal static bool WaitForInputIdleBridge(this WindowAdapter extension, ProdWindow baseControl, int delay)
 {
     try
     {
         return(UiaWaitForInputIdle(baseControl, delay));
     }
     catch (ArgumentNullException err)
     {
         throw new ProdOperationException(err);
     }
     catch (ElementNotAvailableException err)
     {
         throw new ProdOperationException(err);
     }
     catch (InvalidOperationException err)
     {
         throw new ProdOperationException(err);
     }
 }
Esempio n. 16
0
 /// <summary>
 /// Resize the window
 /// </summary>
 /// <param name="extension">The extended interface.</param>
 /// <param name="baseControl">The base control.</param>
 /// <param name="width">The new width of the window, in pixels</param>
 /// <param name="height">The new height of the window, in pixels</param>
 internal static void ResizeWindowBridge(this WindowAdapter extension, ProdWindow baseControl, double width, double height)
 {
     try
     {
         UiaResizeWindow(baseControl, width, height);
     }
     catch (ArgumentNullException err)
     {
         throw new ProdOperationException(err);
     }
     catch (ElementNotAvailableException err)
     {
         throw new ProdOperationException(err);
     }
     catch (InvalidOperationException)
     {
         NativeResizeWindow(baseControl, width, height);
     }
 }
Esempio n. 17
0
 /// <summary>
 /// Moves the window to the specified location
 /// </summary>
 /// <param name="extension">The extended interface.</param>
 /// <param name="baseControl">The base control.</param>
 /// <param name="x">Absolute screen coordinates of the left side of the window</param>
 /// <param name="y">Absolute screen coordinates of the top of the window</param>
 internal static void MoveWindowBridge(this WindowAdapter extension, ProdWindow baseControl, double x, double y)
 {
     try
     {
         UiaMoveWindow(baseControl, x, y);
     }
     catch (ArgumentNullException err)
     {
         throw new ProdOperationException(err);
     }
     catch (ElementNotAvailableException err)
     {
         throw new ProdOperationException(err);
     }
     catch (InvalidOperationException)
     {
         NativeMoveWindow(baseControl, x, y);
     }
 }
Esempio n. 18
0
 /// <summary>
 /// Rotates the window
 /// </summary>
 /// <param name="extension">The extended interface.</param>
 /// <param name="baseControl">The base control.</param>
 /// <param name="degrees">The number of degrees to rotate the element. A positive number rotates clockwise;
 /// a negative number rotates counterclockwise</param>
 internal static void RotateWindowBridge(this WindowAdapter extension, ProdWindow baseControl, double degrees)
 {
     try
     {
         UiaRotateWindow(baseControl, degrees);
     }
     catch (ArgumentNullException err)
     {
         throw new ProdOperationException(err);
     }
     catch (ElementNotAvailableException err)
     {
         throw new ProdOperationException(err);
     }
     catch (InvalidOperationException err)
     {
         throw new ProdOperationException(err);
     }
 }
Esempio n. 19
0
        void inspect(WindowAdapter window)
        {
            if (this.m_InspectorService != null) // stop previous inspect
            {
                this.closeInspect();
            }

            this.m_InspectorService = new InspectorService(window);
            this.m_PanelIndex       = 0;

            var state = this.m_PanelStates.Find((s) => s.treeType == WidgetTreeType.Widget);

            this.m_Panels.Add(new InspectorPanel(this, WidgetTreeType.Widget, this.m_InspectorService,
                                                 state == null ? (float?)null : state.splitOffset));

            state = this.m_PanelStates.Find((s) => s.treeType == WidgetTreeType.Render);
            this.m_Panels.Add(new InspectorPanel(this, WidgetTreeType.Render, this.m_InspectorService,
                                                 state == null ? (float?)null : state.splitOffset));
        }
Esempio n. 20
0
        //private static WindowVisualState NativeGetWindowVisualState(ProdWindow control)
        //{
        //    return ProdWindowNative.GetVisualStateNative(control.NativeHandle);
        //}

        /// <summary>
        /// Gets whether the current window is modal or not
        /// </summary>
        /// <param name="extension">The extended interface.</param>
        /// <param name="baseControl">The ProdWindow.</param>
        /// <returns>
        ///   <c>true</c> if this instance is modal; otherwise, <c>false</c>.
        /// </returns>
        internal static bool GetIsModalBridge(this WindowAdapter extension, ProdWindow baseControl)
        {
            try
            {
                return(UiaGetIsModal(baseControl));
            }
            catch (ArgumentNullException err)
            {
                throw new ProdOperationException(err);
            }
            catch (ElementNotAvailableException err)
            {
                throw new ProdOperationException(err);
            }
            catch (InvalidOperationException err)
            {
                throw new ProdOperationException(err);
            }
        }
Esempio n. 21
0
 /// <summary>
 /// Gets a value whether a window is set to be topmost in the z-order
 /// </summary>
 /// <param name="extension">The extended interface.</param>
 /// <param name="baseControl">The ProdWindow.</param>
 /// <returns>
 ///   <c>true</c> if topmost; otherwise, <c>false</c>.
 /// </returns>
 internal static bool GetIsTopmostBridge(this WindowAdapter extension, ProdWindow baseControl)
 {
     try
     {
         return(UiaGetIsTopmost(baseControl));
     }
     catch (ArgumentNullException err)
     {
         throw new ProdOperationException(err);
     }
     catch (ElementNotAvailableException err)
     {
         throw new ProdOperationException(err);
     }
     //catch (InvalidOperationException)
     //{
     //    return NativeGetIsTopmost(baseControl);
     //}
 }
Esempio n. 22
0
 /// <summary>
 /// Register to make a window the active window.
 /// </summary>
 /// <param name="extension">The extended interface.</param>
 /// <param name="baseControl">The base control.</param>
 internal static void ActivateWindowBridge(this WindowAdapter extension, ProdWindow baseControl)
 {
     //try
     //{
     //    NativeMethods.ShowWindowAsync(baseControl.NativeHandle, (int)ShowWindowCommand.SW_SHOWDEFAULT);
     //    NativeMethods.ShowWindowAsync(baseControl.NativeHandle, (int)ShowWindowCommand.SW_SHOW);
     //    NativeMethods.SetForegroundWindow(baseControl.NativeHandle);
     //}
     //catch (ArgumentNullException err)
     //{
     //    throw new ProdOperationException(err);
     //}
     //catch (ElementNotAvailableException err)
     //{
     //    throw new ProdOperationException(err);
     //}
     //catch (InvalidOperationException err)
     //{
     //    throw new ProdOperationException(err);
     //}
 }
Esempio n. 23
0
 void OnDisable()
 {
     this.windowAdapter.OnDisable();
     this.windowAdapter = null;
 }
Esempio n. 24
0
 void OnEnable()
 {
     this.windowAdapter = new EditorWindowAdapter(this);
     this.windowAdapter.OnEnable();
 }
Esempio n. 25
0
 public InspectorService(WindowAdapter window)
 {
     this.window = window;
     this._widgetInspectorService = window.widgetInspectorService;
     this._widgetInspectorService.developerInspect += this.developerInspect; // todo dispose
 }