Provides data for the GeckoCreateWindowEventHandler event.
Inheritance: System.EventArgs
            public nsIWebBrowserChrome CreateChromeWindow(nsIWebBrowserChrome parent, uint chromeFlags)
            {
                // for chrome windows, we can use the AppShellService to create the window using some built-in xulrunner code
                GeckoWindowFlags flags = (GeckoWindowFlags)chromeFlags;
                if ((flags & GeckoWindowFlags.OpenAsChrome) != 0)
                {
                      // obtain the services we need
                      nsIAppShellService appShellService = Xpcom.GetService<nsIAppShellService>("@mozilla.org/appshell/appShellService;1");
                      object appShell = Xpcom.GetService(new Guid("2d96b3df-c051-11d1-a827-0040959a28c9"));

                      // create the child window
                      nsIXULWindow xulChild = appShellService.CreateTopLevelWindow(null, null, chromeFlags, -1, -1, appShell);

                      // this little gem allows the GeckoWebBrowser to be properly activated when it gains the focus again
                      if (parent is GeckoWebBrowser && (flags & GeckoWindowFlags.OpenAsDialog) != 0)
                      {
                        EventHandler gotFocus = null;
                        gotFocus = delegate (object sender, EventArgs e)
                        {
                            (sender as GeckoWebBrowser).GotFocus -= gotFocus;
                            (sender as GeckoWebBrowser).WebBrowserFocus.Activate();
                        };
                        (parent as GeckoWebBrowser).GotFocus += gotFocus;
                      }

                      // return the chrome
                      return Xpcom.QueryInterface<nsIWebBrowserChrome>(xulChild);
                }

                GeckoWebBrowser browser = parent as GeckoWebBrowser;
                if (browser != null)
                {
                    GeckoCreateWindowEventArgs e = new GeckoCreateWindowEventArgs((GeckoWindowFlags)chromeFlags);
                    browser.OnCreateWindow(e);

                    if (e.WebBrowser != null)
                    {
                        // set flags
                        ((nsIWebBrowserChrome)e.WebBrowser).SetChromeFlags((int)chromeFlags);
                        return e.WebBrowser;
                    }

                    System.Media.SystemSounds.Beep.Play();

                    // prevents crash
                    return new GeckoWebBrowser();
                }
                return null;
            }
Example #2
0
			public nsIWebBrowserChrome CreateChromeWindow(nsIWebBrowserChrome parent, uint chromeFlags)
			{
				GeckoWebBrowser browser = parent as GeckoWebBrowser;
				if (browser != null)
				{
					GeckoCreateWindowEventArgs e = new GeckoCreateWindowEventArgs((GeckoWindowFlags)chromeFlags);
					browser.OnCreateWindow(e);
					
					if (e.WebBrowser != null)
					{
						// set flags
						((nsIWebBrowserChrome)e.WebBrowser).SetChromeFlags((int)chromeFlags);
						return e.WebBrowser;
					}
					
					System.Media.SystemSounds.Beep.Play();
					
					// prevents crash
					return new GeckoWebBrowser();
				}
				return null;
			}
 /// <summary>Raises the <see cref="CreateWindow"/> event.</summary>
 /// <param name="e">The data for the event.</param>
 protected virtual void OnCreateWindow(GeckoCreateWindowEventArgs e)
 {
     if (((GeckoCreateWindowEventHandler)this.Events[CreateWindowEvent]) != null)
         ((GeckoCreateWindowEventHandler)this.Events[CreateWindowEvent])(this, e);
 }
Example #4
0
 private void gex_CreateWindow(object sender, Skybound.Gecko.GeckoCreateWindowEventArgs e)
 {
     e.WebBrowser = (GeckoWebBrowser)this.wBrowser;
 }