Example #1
0
 public Form1(PixelFarm.Drawing.GraphicsPlatform p)
 {
     InitializeComponent();
     this.uiPlatformWinForm = new LayoutFarm.UI.UIPlatformWinForm();
     LayoutFarm.UI.UIPlatform.CurrentUIPlatform = uiPlatformWinForm;
     this.gfxPlatform = p;
 }
Example #2
0
        public MyRootGraphic(
            UIPlatform uiPlatform,
            IFonts ifonts,
            int width, int height)
            : base(width, height)
        {
            this.uiPlatform          = uiPlatform;
            this._ifonts             = ifonts;
            this.graphicTimerTaskMan = new GraphicsTimerTaskManager(this, uiPlatform);
            _defaultTextEditFont     = new RequestFont("tahoma", 10);

#if DEBUG
            dbugCurrentGlobalVRoot = this;
            dbug_Init(null, null, null);
#endif

            //create default render box***
            this.topWindowRenderBox = new TopWindowRenderBox(this, width, height);
            this.topWindowEventRoot = new TopWindowEventRoot(this.topWindowRenderBox);
            this.SubscribeGraphicsIntervalTask(normalUpdateTask,
                                               TaskIntervalPlan.Animation,
                                               20,
                                               (s, e) =>
            {
                this.PrepareRender();
                this.FlushAccumGraphics();
            });
        }
Example #3
0
        public MyRootGraphic(UIPlatform uiPlatform, 
            int width, int height)
            : base(width, height)
        {
            this.uiPlatform = uiPlatform;
            
            this.graphicTimerTaskMan = new GraphicsTimerTaskManager(this, uiPlatform);
            _defaultTextEditFont = new RequestFont("tahoma", 10);

#if DEBUG
            dbugCurrentGlobalVRoot = this;
            dbug_Init(null, null, null);
#endif

            //create default render box***
            this.topWindowRenderBox = new TopWindowRenderBox(this, width, height);
            this.topWindowEventRoot = new TopWindowEventRoot(this.topWindowRenderBox);
            this.SubscribeGraphicsIntervalTask(normalUpdateTask,
                TaskIntervalPlan.Animation,
                20,
                (s, e) =>
                {
                    this.PrepareRender();
                    this.FlushAccumGraphics();
                });
        }
Example #4
0
 public GraphicsTimerTaskManager(RootGraphic rootgfx, UIPlatform platform)
 {
     this.rootgfx  = rootgfx;
     this.uiTimer1 = platform.CreateUITimer();
     //--------------------------------------
     uiTimer1.Interval = fastPlanInterval; //fast task plan
     uiTimer1.Tick    += new EventHandler(graphicTimer1_Tick);
     uiTimer1.Enabled  = true;
     //--------------------------------------
 }
        public GraphicsTimerTaskManager(RootGraphic rootgfx)
        {
            _rootgfx = rootgfx;

            //register timer task
            _uiTimerTask          = new UITimerTask(graphicTimer1_Tick);
            _uiTimerTask.Interval = _fastPlanInterval; //fast task plan
            UIPlatform.RegisterTimerTask(_uiTimerTask);
            _uiTimerTask.Enabled = true;
        }
 public GraphicsTimerTaskManager(RootGraphic rootgfx, UIPlatform platform)
 {
     this.rootgfx = rootgfx;
     this.uiTimer1 = platform.CreateUITimer();
     //--------------------------------------
     uiTimer1.Interval = fastPlanInterval; //fast task plan
     uiTimer1.Tick += new EventHandler(graphicTimer1_Tick);
     uiTimer1.Enabled = true;
     //--------------------------------------
 }
        public GraphicsTimerTaskManager(RootGraphic rootgfx)
        {
            this.rootgfx = rootgfx;

            //register timer task
            uiTimerTask = new UITimerTask(graphicTimer1_Tick);
            uiTimerTask.IntervalInMillisec = fastPlanInterval; //fast task plan
            UIPlatform.RegisterTimerTask(uiTimerTask);
            uiTimerTask.Enabled = true;
        }
Example #8
0
        public FormDemoList()
        {
            InitializeComponent();
            this.Load += new EventHandler(Form1_Load);
            //------
            this.cmbPlatformSelector.Items.Add(InnerViewportKind.GdiPlus);
            this.cmbPlatformSelector.Items.Add(InnerViewportKind.Skia);
            this.cmbPlatformSelector.Items.Add(InnerViewportKind.GL);            
            this.cmbPlatformSelector.SelectedIndex = 0;//set default
            //------
            //default
            this.uiPlatformWinForm = new LayoutFarm.UI.UIPlatformWinForm();
            UI.UIPlatform.CurrentUIPlatform = uiPlatformWinForm;

        }
Example #9
0
        public UIPlatformWinForm()
        {
            //--------------------------------------------------------------------
            //TODO: review here again
            //NOTE: this class load native dll images (GLES2)
            //since GLES2 that we use is x86,
            //so we must specific the file type to x86 ***
            //else this will error on TypeInitializer ( from BadImageFormatException);
            //--------------------------------------------------------------------

            if (s_platform == null)
            {
                s_platform = this;
                SetAsDefaultPlatform();
                UIMsgQueue.RegisterRunOnceImpl(runOnceDelegate =>
                {
                    UIPlatform.RegisterRunOnceTask(tt => runOnceDelegate());
                });
            }

            //var installedTypefaces = new Typography.FontManagement.InstalledTypefaceCollection();
            //installedTypefaces.LoadSystemFonts();

            try
            {
                //set up winform platform
                ////gdi+
                //PixelFarm.Drawing.WinGdi.WinGdiPlusPlatform.SetInstalledTypefaceProvider(installedTypefaces);
                LayoutFarm.UI.Clipboard.SetUIPlatform(this);
            }
            catch (System.Exception ex)
            {
            }
            ////gles2
            //OpenTK.Toolkit.Init();
            //PixelFarm.Drawing.GLES2.GLES2Platform.SetFontLoader(YourImplementation.BootStrapOpenGLES2.myFontLoader);
            ////skia
            //if (!YourImplementation.BootStrapSkia.IsNativeLibAvailable())
            //{
            //    //handle  when native dll is not ready
            //}
            //else
            //{
            //    //when ready
            //    PixelFarm.Drawing.Skia.SkiaGraphicsPlatform.SetFontLoader(YourImplementation.BootStrapSkia.myFontLoader);
            //}
            //_gdiPlusIFonts = new PixelFarm.Drawing.WinGdi.Gdi32IFonts();
        }
Example #10
0
        //-----------------------------------------

        public static void StartGraphicsHost()
        {
            lock (startLock)
            {
                if (isStarted) return;

                var startParams = new LayoutFarm.UI.GdiPlus.MyWinGdiPortalSetupParameters();
                startParams.IcuDataFile = IcuDataFile;
                gdiPlatform = LayoutFarm.UI.GdiPlus.MyWinGdiPortal.Start(startParams);
                uiPlatformWinForm = new LayoutFarm.UI.UIPlatformWinForm();
                UI.UIPlatform.CurrentUIPlatform = uiPlatformWinForm;
                //--------------------
                isStarted = true;
                //--------------------
            }
        }
            public MousePressMonitorHelper(int intervalMs)
            {
                _intervalMs           = intervalMs;
                _mousePressCount      = 0;
                _currentMonitoredElem = null;
                _mousePressEventArgs  = new UIMousePressEventArgs();

                _mousePressMonitor = new UITimerTask(t =>
                {
                    if (_currentMonitoredElem != null)
                    {
                        //invoke mouse press event
                        if (_mousePressCount > 0)
                        {
                            _currentMonitoredElem.ListenMousePress(_mousePressEventArgs);
                        }
                        _mousePressCount++;
                    }
                });
                _mousePressMonitor.Enabled  = true;
                _mousePressMonitor.Interval = intervalMs; //interval for mouse press monitor
                UIPlatform.RegisterTimerTask(_mousePressMonitor);
            }
Example #12
0
 public static void SetUIPlatform(UIPlatform uiPlatform) => s_currentUIPlatform = uiPlatform;
Example #13
0
 public static void SetUIPlatform(UIPlatform uiPlatform)
 {
     currentUIPlatform = uiPlatform;
 }