public FREObject SetPositionAndSize(FREContext ctx, uint argc, FREObject[] argv) { var tmpX = Convert.ToInt32(new FreObjectSharp(argv[0]).Value); var tmpY = Convert.ToInt32(new FreObjectSharp(argv[1]).Value); var tmpWidth = Convert.ToInt32(new FreObjectSharp(argv[2]).Value); var tmpHeight = Convert.ToInt32(new FreObjectSharp(argv[3]).Value); var updateWidth = false; var updateHeight = false; var updateX = false; var updateY = false; if (tmpWidth != _view.ViewWidth) { _view.ViewWidth = tmpWidth; updateWidth = true; } if (tmpHeight != _view.ViewHeight) { _view.ViewHeight = tmpHeight; updateHeight = true; } if (tmpX != _view.X) { _view.X = tmpX; updateX = true; } if (tmpY != _view.Y) { _view.Y = tmpY; updateY = true; } if (!updateX && !updateY && !updateWidth && !updateHeight) { return(FREObject.Zero); } var flgs = (WindowPositionFlags)0; if (!updateWidth && !updateHeight) { flgs |= WindowPositionFlags.SWP_NOSIZE; } if (!updateX && !updateY) { flgs |= WindowPositionFlags.SWP_NOMOVE; } WinApi.SetWindowPos(_cefWindow, new IntPtr(0), _view.X, _view.Y, _view.ViewWidth, _view.ViewHeight, flgs); WinApi.UpdateWindow(_cefWindow); return(FREObject.Zero); }
public FREObject SetVisible(FREContext ctx, uint argc, FREObject[] argv) { try { var visible = argv[0].AsBool(); WinApi.ShowWindow(_cefWindow, visible ? ShowWindowCommands.SW_SHOWNORMAL : ShowWindowCommands.SW_HIDE); WinApi.UpdateWindow(_cefWindow); } catch (Exception e) { return(new FreException(e).RawValue); } return(FREObject.Zero); }
public FREObject SetViewPort(FREContext ctx, uint argc, FREObject[] argv) { System.Windows.Rect viewPort; try { viewPort = argv[0].AsRect(); } catch (Exception e) { return(new FreException(e).RawValue); } var tmpX = Convert.ToInt32(viewPort.X * _scaleFactor); var tmpY = Convert.ToInt32(viewPort.Y * _scaleFactor); var tmpWidth = Convert.ToInt32(viewPort.Width * _scaleFactor); var tmpHeight = Convert.ToInt32(viewPort.Height * _scaleFactor); var updateWidth = false; var updateHeight = false; var updateX = false; var updateY = false; if (tmpWidth != _view.ViewWidth) { _view.ViewWidth = tmpWidth; updateWidth = true; } if (tmpHeight != _view.ViewHeight) { _view.ViewHeight = tmpHeight; updateHeight = true; } if (tmpX != _view.X) { _view.X = tmpX; updateX = true; } if (tmpY != _view.Y) { _view.Y = tmpY; updateY = true; } if (!updateX && !updateY && !updateWidth && !updateHeight) { return(FREObject.Zero); } var flgs = (WindowPositionFlags)0; if (!updateWidth && !updateHeight) { flgs |= WindowPositionFlags.SWP_NOSIZE; } if (!updateX && !updateY) { flgs |= WindowPositionFlags.SWP_NOMOVE; } WinApi.SetWindowPos(_cefWindow, new Hwnd(0), _view.X, _view.Y, _view.ViewWidth, _view.ViewHeight, flgs); WinApi.UpdateWindow(_cefWindow); return(FREObject.Zero); }
public FREObject RemoveFromStage(FREContext ctx, uint argc, FREObject[] argv) { WinApi.ShowWindow(_cefWindow, ShowWindowCommands.SW_HIDE); WinApi.UpdateWindow(_cefWindow); return(FREObject.Zero); }
public FREObject AddToStage(FREContext ctx, uint argc, FREObject[] argv) { WinApi.ShowWindow(_cefWindow, ShowWindowCommands.SW_SHOWNORMAL); WinApi.UpdateWindow(_cefWindow); return(FREObject.Zero); }