public CefWebBrowserControl() { SetStyle( ControlStyles.ContainerControl | ControlStyles.ResizeRedraw | ControlStyles.FixedWidth | ControlStyles.FixedHeight | ControlStyles.StandardClick | ControlStyles.UserMouse | ControlStyles.SupportsTransparentBackColor | ControlStyles.StandardDoubleClick | ControlStyles.OptimizedDoubleBuffer | ControlStyles.CacheText | ControlStyles.EnableNotifyMessage | ControlStyles.DoubleBuffer | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UseTextForAccessibility | ControlStyles.Opaque, false); SetStyle( ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.Selectable, true); thisWindowControl = MyWindowControl.TryGetWindowControlOrRegisterIfNotExists(this); }
IWindowControl IWindowControl.GetTopLevelControl() { //TODO: review here again Form form1 = control.FindForm(); Control realTopLevelWindowControl = control.TopLevelControl; realTopLevelWindowControl = form1; ///MoonTrip version ///for use in extensions custom tool ///Form in ToolWindow is can not top level ///create some fake Form to TopLevelControl if (realTopLevelWindowControl == null) { realTopLevelWindowControl = new Form(); } if (topLevelWindowControl == null || topLevelWindowControl.control != realTopLevelWindowControl) { return(topLevelWindowControl = (realTopLevelWindowControl is Form) ? (MyWindowControl)MyWindowForm.TryGetWindowControlOrRegisterIfNotExists((Form)realTopLevelWindowControl) : MyWindowControl.TryGetWindowControlOrRegisterIfNotExists(realTopLevelWindowControl)); } return(topLevelWindowControl); }
IWindowControl IWindowControl.GetParent() { //TODO: review here again Control realParentControl = control.Parent; if (parentControl == null || parentControl.control != realParentControl) { //create new parentControl = new MyWindowControl(realParentControl); } return(parentControl); }
IWindowControl IWindowControl.GetTopLevelControl() { //TODO: review here again Control realTopLevelWindowControl = control.TopLevelControl; if (topLevelWindowControl == null || topLevelWindowControl.control != realTopLevelWindowControl) { return(topLevelWindowControl = (realTopLevelWindowControl is Form) ? (MyWindowControl)MyWindowForm.TryGetWindowControlOrRegisterIfNotExists((Form)realTopLevelWindowControl) : MyWindowControl.TryGetWindowControlOrRegisterIfNotExists(realTopLevelWindowControl)); } return(topLevelWindowControl); }