Beispiel #1
0
        public static void Init(GraphicsDevice Device)
        {
            Batch = new SpriteBatch(Device);
            RenderBuffer = new Texture2D(Device,
                Device.Viewport.Width,
                Device.Viewport.Height);

            ConfigureWebCore();

            ScreenRect = new Rectangle()
            {
                X = 0,
                Y = 0,
                Width = Device.Viewport.Width,
                Height = Device.Viewport.Height
            };

            UILayer = WebCore.CreateWebView(Device.Viewport.Width,
                Device.Viewport.Height, false);
            UILayer.SetTransparent(true);
            UILayer.LoadFile("UIHolder.html");
            UILayer.LoadCompleted += new EventHandler(UILayer_LoadCompleted);
            UILayer.JSConsoleMessageAdded +=new JSConsoleMessageAddedEventHandler(UILayer_JSConsoleMessageAdded);
            UILayer.FlushAlpha = false;
            UILayer.Focus();
            ConfigureAPILayer();

            EventInput.CharEntered += new CharEnteredHandler(EventInput_CharEntered);
            EventInput.KeyDown += new KeyEventHandler(EventInput_KeyDown);
            EventInput.KeyUp += new KeyEventHandler(EventInput_KeyUp);
        }
Beispiel #2
0
        public WebForm()
        {
            InitializeComponent();

            Resize += WebForm_Resize;
            webViewBitmap.MouseMove += WebForm_MouseMove;
            webViewBitmap.MouseDown += WebForm_MouseDown;
            webViewBitmap.MouseUp += WebForm_MouseUp;
            MouseWheel += WebForm_MouseWheel;
            KeyDown += WebForm_KeyDown;
            KeyUp += WebForm_KeyUp;
            KeyPress += WebForm_KeyPress;
            FormClosed += WebForm_FormClosed;
            Activated += WebForm_Activated;
            Deactivate += WebForm_Deactivate;

            WebCore.Config config = new WebCore.Config();
            config.enablePlugins = true;
            WebCore.Initialize(config);

            webView = WebCore.CreateWebview(webViewBitmap.Width, webViewBitmap.Height);
            webView.LoadURL("http://www.google.com");
            webView.Focus();

            timer = new Timer();
            timer.Interval = 30;
            timer.Tick += new EventHandler(timer_Tick);
            timer.Start();
        }
Beispiel #3
0
        public WebForm()
        {
            // Notice that Control.DoubleBuffered has been set to true
            // in the designer, to prevent flickering.

            InitializeComponent();

            WebCoreConfig config = new WebCoreConfig { EnablePlugins = true };
            WebCore.Initialize( config );

            webView = WebCore.CreateWebView( this.ClientSize.Width, this.ClientSize.Height );
            webView.IsDirtyChanged += OnIsDirtyChanged;
            webView.SelectLocalFiles += OnSelectLocalFiles;
            webView.CursorChanged += OnCursorChanged;
            webView.LoadURL( "http://www.google.com" );
            webView.Focus();
        }
Beispiel #4
0
        public TabView( TabControl tabControl )
        {
            this.tabControl = tabControl;
            this.url = "";
            this.title = "New Tab";

            tab = new TabItem();
            img = new Image();

            img.Focusable = true;
            tab.Content = img;
            tab.Header = title;
            tabControl.Items.Add( tab );
            tab.Height = 25;
            img.Width = tabControl.Width;
            img.Height = tabControl.Height - (int)tab.Height - 2;
            tip = new ToolTip();
            tip.IsOpen = false;
            tab.ToolTip = tip;
            ToolTipService.SetIsEnabled( tab, false );

            src = new WriteableBitmap( (int)tabControl.Width, (int)tabControl.Height - (int)tab.Height - 2, 96, 96, PixelFormats.Bgra32, BitmapPalettes.WebPaletteTransparent );
            img.Source = src;
            tab.Content = img;
            myRect = new Int32Rect( 0, 0, (int)tabControl.Width, (int)tabControl.Height - (int)tab.Height - 2 );
            webView = WebCore.CreateWebview( (int)tabControl.Width, (int)tabControl.Height - (int)tab.Height - 2 );
            webView.IsDirtyChanged += OnIsDirtyChanged;
            webView.Focus();

            img.MouseWheel += mainWindowMouseWheel;
            img.MouseMove += browserImageMouseMove;
            img.MouseDown += browserImageMouseDown;
            img.MouseUp += browserImageMouseUp;

            // Setup Callbacks
            webView.BeginNavigation += onBeginNavigation;
            webView.BeginLoading += onBeginLoading;
            webView.CursorChanged += onChangeCursor;
            webView.TooltipChanged += onChangeTooltip;
            webView.LoadCompleted += onFinishLoading;
            webView.OpenExternalLink += onOpenExternalLink;
            webView.TitleReceived += onReceiveTitle;
            webView.Crashed += onWebviewCrashed;
        }
Beispiel #5
0
        public WebForm()
        {
            InitializeComponent();

            Resize += WebForm_Resize;
            webViewBitmap.MouseMove += WebForm_MouseMove;
            webViewBitmap.MouseDown += WebForm_MouseDown;
            webViewBitmap.MouseUp += WebForm_MouseUp;
            MouseWheel += WebForm_MouseWheel;
            KeyDown += WebForm_KeyDown;
            KeyUp += WebForm_KeyUp;
            KeyPress += WebForm_KeyPress;
            FormClosed += WebForm_FormClosed;
            Activated += WebForm_Activated;
            Deactivate += WebForm_Deactivate;

            WebCoreConfig config = new WebCoreConfig { EnablePlugins = true };
            WebCore.Initialize( config );

            webView = WebCore.CreateWebview( webViewBitmap.Width, webViewBitmap.Height );
            webView.IsDirtyChanged += OnIsDirtyChanged;
            webView.LoadURL( "http://www.google.com" );
            webView.Focus();
        }
 private void LoadWebView(int width, int height)
 {
     _webview = WebCore.CreateWebview(width, height);
     _webview.LoadURL(Source);
     _webview.Focus();
     _webview.LoadCompleted += OnFinishLoading;
     _webview.OpenExternalLink += OpenExternalLink;
     _webview.Crashed += OnWebviewCrashed;
     _webview.CursorChanged += OnChangeCursor;
 }