private void IContainerControlContainerChanged(IContainerControl source, object container)
        {
            if (this.ApplicationContext.SelectedDataSource == null || this.ApplicationContext.SelectedDataSource.ImageControl == null)
            {
                return;
            }

            this.ApplicationContext.SelectedDataSource.ImageControl.Clear();

            // Get the container label, whatever it is
            string containerLabel = String.Empty;

            if (container is ContainerComboItem)
            {
                containerLabel = (container as ContainerComboItem).ToString();
            }

            if (!String.IsNullOrEmpty(containerLabel))
            {
                this.StatusBarCollection.Text = containerLabel;
            }

            // Catch whatever we need for the current image.
            this.ForceClassificationUpdate();

            // Move to the first un-tagged item
            this.ApplicationContext.SelectedDataSource.ImageControl.FastForward();
        }
Пример #2
0
        protected bool ValidateActiveControl()
        {
            IContainerControl c = GetContainerControl();

            if (c == null)
            {
                return(true);
            }

            ContainerControl container = c as ContainerControl;

            if (container == null)
            {
                return(true);
            }

            while (container.ActiveControl == null)
            {
                Control parent = container.Parent;
                if (parent == null)
                {
                    break;
                }

                ContainerControl cc = parent.GetContainerControl() as ContainerControl;
                if (cc == null)
                {
                    break;
                }

                container = cc;
            }

            return(container.Validate(true));
        }
Пример #3
0
 protected override void Select(bool directed, bool forward)
 {
     if (!this.ProcessKeyboard)
     {
         base.Select(directed, forward);
     }
     else
     {
         bool flag = true;
         if (this.Parent != null)
         {
             IContainerControl containerControl = this.Parent.GetContainerControl();
             if (containerControl != null)
             {
                 containerControl.ActiveControl = (Control)this;
                 flag = containerControl.ActiveControl == this;
             }
         }
         if (!directed || !flag)
         {
             return;
         }
         this.SelectNextToolStripItem((RadItem)null, forward);
     }
 }
Пример #4
0
 public static Control FindFocusedControl(Control control)
 {
     for (IContainerControl containerControl = control as IContainerControl; containerControl != null; containerControl = (control as IContainerControl))
     {
         control = containerControl.ActiveControl;
     }
     return(control);
 }
Пример #5
0
        internal void Remove(IContainerControl requestor, IControlVM ctrl)
        {
            if (requestor == null || ctrl == null)
            {
                return;
            }

            if (_descriptionable.ContainsKey(ctrl.ControlId))
            {
                _descriptionable.Remove(ctrl.ControlId);
            }
            if (_menuSeparators.ContainsKey(ctrl.ControlId))
            {
                _menuSeparators.Remove(ctrl.ControlId);
            }
            if (_gallerySizes.ContainsKey(ctrl.ControlId))
            {
                _gallerySizes.Remove(ctrl.ControlId);
            }
            if (_dynamicMenus.ContainsKey(ctrl.ControlId))
            {
                _dynamicMenus.Remove(ctrl.ControlId);
            }
            if (_selectables.ContainsKey(ctrl.ControlId))
            {
                _selectables.Remove(ctrl.ControlId);
            }
            if (_selectItems.ContainsKey(ctrl.ControlId))
            {
                _selectItems.Remove(ctrl.ControlId);
            }
            if (_toggleables.ContainsKey(ctrl.ControlId))
            {
                _toggleables.Remove(ctrl.ControlId);
            }
            if (_clickables.ContainsKey(ctrl.ControlId))
            {
                _clickables.Remove(ctrl.ControlId);
            }
            if (_imageables.ContainsKey(ctrl.ControlId))
            {
                _imageables.Remove(ctrl.ControlId);
            }
            if (_sizeables.ContainsKey(ctrl.ControlId))
            {
                _sizeables.Remove(ctrl.ControlId);
            }
            if (_editables.ContainsKey(ctrl.ControlId))
            {
                _editables.Remove(ctrl.ControlId);
            }
            if (_controls.ContainsKey(ctrl.ControlId))
            {
                _controls.Remove(ctrl.ControlId);
            }

            ctrl.OnPurged(requestor);
        }
        /// <devdoc>
        ///     WM_SETFOCUS handler
        /// </devdoc>
        /// <internalonly/>
        private void WmSetFocus(ref Message m)
        {
            if (!HostedInWin32DialogManager)
            {
                if (ActiveControl != null)
                {
                    ImeSetFocus();
                    // REGISB: Do not raise GotFocus event since the focus
                    //         is given to the visible ActiveControl
                    if (!ActiveControl.Visible)
                    {
                        OnGotFocus(EventArgs.Empty);
                    }
                    FocusActiveControlInternal();
                }
                else
                {
                    if (ParentInternal != null)
                    {
                        IContainerControl c = ParentInternal.GetContainerControlInternal();
                        if (c != null)
                        {
                            bool succeeded = false;

                            ContainerControl knowncontainer = c as ContainerControl;
                            if (knowncontainer != null)
                            {
                                succeeded = knowncontainer.ActivateControlInternal(this);
                            }
                            else
                            {
                                // SECREVIEW : Taking focus and activating a control is response
                                //           : to a user gesture (WM_SETFOCUS) is OK.
                                //
                                IntSecurity.ModifyFocus.Assert();
                                try {
                                    succeeded = c.ActivateControl(this);
                                }
                                finally {
                                    CodeAccessPermission.RevertAssert();
                                }
                            }
                            if (!succeeded)
                            {
                                return;
                            }
                        }
                    }
                    base.WndProc(ref m);
                }
            }
            else
            {
                base.WndProc(ref m);
            }
        }
Пример #7
0
        /// <summary>
        /// Method to find the current Active or Focused Control.
        /// </summary>
        /// <see cref="Https://stackoverflow.com/questions/435433/what-is-the-preferred-way-to-find-focused-control-in-winforms-app"/>
        /// <param name="control">Control object</param>
        /// <returns></returns>
        private static Control FindFocusedControl(Control control)
        {
            IContainerControl container = control as IContainerControl;

            while (container != null)
            {
                control   = container.ActiveControl;
                container = control as IContainerControl; //null if control wasn't container
            }
            return(control);
        }
Пример #8
0
        /// <summary>
        ///     Unfocuses the currently focused control.
        /// </summary>
        private void Unfocus()
        {
            IContainerControl container = this;

            while (container != null)
            {
                Control control = container.ActiveControl;
                container.ActiveControl = null;
                container = control as IContainerControl;
            }
        }
Пример #9
0
        public static Control FindFocusedControl(this IContainerControl container)
        {
            Control control = null;

            while (container != null)
            {
                control   = container.ActiveControl;
                container = control as IContainerControl;
            }
            return(control);
        }
Пример #10
0
 protected void ReferenceLauncher_Enter(object sender, EventArgs e)
 {
     if (m_mainControl != null)
     {
         m_mainControl.Focus();
     }
     if (Parent is IContainerControl)
     {
         IContainerControl uc = (IContainerControl)Parent;
         uc.ActiveControl = this;
     }
 }
Пример #11
0
        private void rotate_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem tsmi = sender as ToolStripMenuItem;
            IContainerControl icc  = tsmi.Owner.GetContainerControl();
            PictureBox        pb   = tsmi.Owner.GetContainerControl() as PictureBox;
            pbInfo            pbi  = (pb.Parent as MyPictureBox).pbInfo;

            pbi.Rotate = float.Parse(tsmi.Text);
            Graphics g = Graphics.FromImage(pb.Image);

            g.RotateTransform(pbi.Rotate);
            pb.Refresh();
        }
Пример #12
0
        private static Control getYoungestChildAtDesktopPoint(Control topControl, System.Drawing.Point desktopPoint)
        {
            Control foundControl = topControl.GetChildAtPoint(topControl.PointToClient(desktopPoint));

            if ((foundControl != null) && (foundControl.HasChildren) && (foundControl.Visible))
            {
                Control           con            = getYoungestChildAtDesktopPoint(foundControl, desktopPoint);
                IContainerControl foundControler = topControl.GetContainerControl();
                return(con);
            }
            else
            {
                return(foundControl);
            }
        }
Пример #13
0
        protected override void Select(bool directed, bool forward)
        {
            if (Parent != null)
            {
                IContainerControl parent = Parent.GetContainerControl();
                if (parent != null)
                {
                    parent.ActiveControl = this;
                }
            }

            if (directed && auto_select_child)
            {
                SelectNextControl(null, forward, true, true, false);
            }
        }
Пример #14
0
    static public System.ComponentModel.IContainer GetParentContainerComponents(this Control p)
    {
        IContainerControl c = p.GetContainerControl(); // get container control (UserControl or Form)

        if (c != null)                                 // paranoia in case control is not connected
        {
            // find all fields, incl private of them
            var memcc = c.GetType().GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic);

            var icontainers = (from f in memcc      // pick out a list of IContainers (should be only 1)
                               where f.FieldType.FullName == "System.ComponentModel.IContainer"
                               select f);
            return(icontainers?.FirstOrDefault()?.GetValue(c) as System.ComponentModel.IContainer);  // But IT may be null if no containers are on the form
        }

        return(null);
    }
Пример #15
0
 /// <include file='doc\Button.uex' path='docs/doc[@for="Button.PerformClick"]/*' />
 /// <devdoc>
 ///    <para>
 ///       Generates a <see cref='System.Windows.Forms.Control.Click'/> event for a
 ///       button.
 ///    </para>
 /// </devdoc>
 public void PerformClick()
 {
     if (CanSelect)
     {
         bool fireOnClick = true;
         // Fix 139438
         // Determine the common container between this button and the focused control
         IContainerControl c = GetContainerControlInternal();
         if (c != null)
         {
             ContainerControl container = c as ContainerControl;
             if (container != null)
             {
                 while (container.ActiveControl == null)
                 {
                     ContainerControl cc;
                     Control          parent = container.ParentInternal;
                     if (parent != null)
                     {
                         cc = parent.GetContainerControlInternal() as ContainerControl;
                         if (cc != null)
                         {
                             container = cc;
                         }
                         else
                         {
                             break;
                         }
                     }
                     else
                     {
                         break;
                     }
                 }
                 fireOnClick = container.Validate();
             }
         }
         if (fireOnClick && !ValidationCancelled)
         {
             //Paint in raised state...
             //
             ResetFlagsandPaint();
             OnClick(EventArgs.Empty);
         }
     }
 }
Пример #16
0
 /*
  * usage: MessageBox.Show("MAIN->" + Global.FindActiveControl(GlobalApp.F_MAIN));
  */
 public static string FindActiveControl(IContainerControl cc)
 {
     if (cc.ActiveControl == null)
     {
         return("[NULL]");
     }
     else
     {
         if (cc.ActiveControl is IContainerControl)
         {
             return(cc.ActiveControl.GetType().Name + ":" + cc.ActiveControl.Name + "->" + FindActiveControl(cc.ActiveControl as IContainerControl));
         }
         else
         {
             return(cc.ActiveControl.GetType().Name + ":" + cc.ActiveControl.Name);
         }
     }
 }
Пример #17
0
        /// <include file='doc\ContainerControl.uex' path='docs/doc[@for="ContainerControl.Select"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        protected override void Select(bool directed, bool forward)
        {
            bool correctParentActiveControl = true;

            if (ParentInternal != null)
            {
                IContainerControl c = ParentInternal.GetContainerControlInternal();
                if (c != null)
                {
                    c.ActiveControl            = this;
                    correctParentActiveControl = (c.ActiveControl == this);
                }
            }
            if (directed && correctParentActiveControl)
            {
                SelectNextControl(null, forward, true, true, false);
            }
        }
Пример #18
0
 protected override void Select(bool directed, bool forward)
 {
     if (Parent != null)
     {
         IContainerControl container = Parent.GetContainerControl();
         if (container != null)
         {
             container.ActiveControl = this;
             if (directed && container.ActiveControl == this)
             {
                 SelectNextControl(null, forward, true, true, false);
             }
         }
     }
     if (directed)
     {
         SelectNextControl(null, forward, true, true, false);
     }
 }
Пример #19
0
        // This returns the active child control
        private Control FindActiveControl()
        {
            Control c = this.ActiveControl;

            while (c is IContainerControl)
            {
                IContainerControl cc = (c as IContainerControl);
                if (cc.ActiveControl != null)
                {
                    c = cc.ActiveControl;
                }
                else
                {
                    break;
                }
            }

            return(c);
        }
Пример #20
0
        // This returns the active child control in the specified container
        public static Control FindActiveControl(IContainerControl container)
        {
            Control c = container.ActiveControl;

            while (c is IContainerControl)
            {
                IContainerControl cc = (c as IContainerControl);
                if (cc.ActiveControl != null)
                {
                    c = cc.ActiveControl;
                }
                else
                {
                    break;
                }
            }

            return(c);
        }
Пример #21
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// When we get focus, start filtering messages to catch characters
 /// </summary>
 /// <param name="e"></param>
 /// ------------------------------------------------------------------------------------
 protected override void OnGotFocus(EventArgs e)
 {
     if (Parent is IContainerControl)
     {
         IContainerControl uc = (IContainerControl)Parent;
         uc.ActiveControl = this;
     }
     base.OnGotFocus(e);
     try
     {
         if (m_rootb.Selection == null)
         {
             //!!!!!!!!!!!!! if you stop here on an exception, it's
             //just because you have the "break into debugger" set in the Debug:exceptions menu.
             //!!!!!!!!!!!!!!!
             m_rootb.MakeSimpleSel(true, true, false, true);                     // Add IP.
         }
     }
     catch
     { /* Do nothing, if there isn't a selection. */ }
 }
Пример #22
0
        protected virtual void OnDomDocumentCompleted(object sender, GeckoDocumentCompletedEventArgs e)
        {
            _browserDocumentLoaded = true;              // Document loaded once
            AdjustHeight();
            if (_entered)
            {
                this.Focus();

                IContainerControl containerControl = GetContainerControl();

                if ((containerControl != null) && (containerControl != this) && (containerControl.ActiveControl != this))
                {
                    containerControl.ActiveControl = this;
                }

                _browser.WebBrowserFocus.Activate();
                var element = (GeckoHtmlElement)_browser.Document.GetElementById("main");
                element.Focus();

                EnsureFocusedGeckoControlHasInputFocus();
            }
        }
Пример #23
0
        private void InsertVariable(string Name)
        {
            IContainerControl Container = this;

            if (Container != null)
            {
                for (;;)
                {
                    IContainerControl NextContainer = Container.ActiveControl as IContainerControl;
                    if (NextContainer == null)
                    {
                        break;
                    }
                    Container = NextContainer;
                }

                TextBox FocusTextBox = Container.ActiveControl as TextBox;
                if (FocusTextBox != null)
                {
                    FocusTextBox.SelectedText = Name;
                }
            }
        }
Пример #24
0
        protected override void Select(bool directed, bool forward)
        {
            if (!this.ProcessKeyboard)
            {
                base.Select(directed, forward);
                return;
            }
            bool flag1 = true;

            if (this.Parent != null)
            {
                IContainerControl control1 = this.Parent.GetContainerControl();
                if (control1 != null)
                {
                    control1.ActiveControl = this;
                    flag1 = control1.ActiveControl == this;
                }
            }
            if (directed && flag1)
            {
                this.SelectNextToolStripItem(null, forward);
            }
        }
Пример #25
0
 protected override void OnGotFocus(EventArgs e)
 {
     if (ActiveControl != null)
     {
         if (!ActiveControl.Visible)
         {
             base.OnGotFocus(EventArgs.Empty);
         }
         SetFocus(activeControl);
         return;
     }
     if (Parent != null)
     {
         IContainerControl container = Parent.GetContainerControl();
         if (container != null)
         {
             if (!container.ActivateControl(this))
             {
                 return;
             }
         }
     }
     base.OnGotFocus(e);
 }
Пример #26
0
 public SkinControlLoader(IContainerControl container, SkinConfig skin)
 {
     Container = container;
     Skin      = skin;
 }
Пример #27
0
        internal static void xa7513d57b4844d46(Control x43bec302f92080b9)
        {
            if (x43bec302f92080b9.Parent != null)
            {
                goto label_26;
            }
            else
            {
                goto label_29;
            }
label_1:
            ((DockControl)x43bec302f92080b9).xadad18dc04073a00 = true;
            goto label_3;
label_2:
            if (x43bec302f92080b9 is DockControl)
            {
                goto label_1;
            }
label_3:
            try
            {
                IContainerControl containerControl = x43bec302f92080b9.Parent.GetContainerControl();
                if (true)
                {
                    goto label_16;
                }
                else
                {
                    goto label_10;
                }
label_4:
                if (true)
                {
                    goto label_6;
                }
label_5:
                if (containerControl != null)
                {
                    goto label_18;
                }
label_6:
                x43bec302f92080b9.Parent.Controls.Remove(x43bec302f92080b9);
                return;

label_7:
                if (containerControl.ActiveControl == x43bec302f92080b9)
                {
                    if (true)
                    {
                        containerControl.ActiveControl = (Control)null;
                        goto label_4;
                    }
                    else
                    {
                        goto label_4;
                    }
                }
                else
                {
                    goto label_6;
                }
label_10:
                DockContainer xd3311d815ca25f02;
                if (xd3311d815ca25f02.Manager.OwnerForm != null)
                {
                    while (xd3311d815ca25f02.Manager.OwnerForm.IsMdiContainer)
                    {
                        LayoutUtilities.xf96eb78473d85a37(xd3311d815ca25f02, xd3311d815ca25f02.LayoutSystem);
                        if (true)
                        {
                            goto label_6;
                        }
                    }
                    goto label_7;
                }
                else
                {
                    goto label_7;
                }
label_14:
                if (xd3311d815ca25f02 != null && xd3311d815ca25f02.Manager != null)
                {
                    if (false)
                    {
                        return;
                    }
                    goto label_10;
                }
                else
                {
                    goto label_7;
                }
label_16:
                if (false)
                {
                    if (false)
                    {
                        if (true)
                        {
                            if (true)
                            {
                                goto label_7;
                            }
                            else
                            {
                                goto label_4;
                            }
                        }
                        else
                        {
                            goto label_14;
                        }
                    }
                }
                else
                {
                    goto label_5;
                }
label_18:
                xd3311d815ca25f02 = containerControl as DockContainer;
                goto label_14;
            }
            finally
            {
                if (x43bec302f92080b9 is DockControl)
                {
                    ((DockControl)x43bec302f92080b9).xadad18dc04073a00 = false;
                }
            }
label_26:
            if (x43bec302f92080b9.ContainsFocus)
            {
                x43bec302f92080b9.Parent.Focus();
                goto label_2;
            }
label_27:
            if (false)
            {
                if (false)
                {
                    return;
                }
                goto label_1;
            }
            else
            {
                goto label_2;
            }
label_29:
            if (false)
            {
                goto label_27;
            }
        }
Пример #28
0
 public void AddContainer(IContainerControl container)
 {
     _containers.Add(container);
 }
Пример #29
0
        public void OnDeserialization(IContainerControl container)
        {
            EnsureContainer(container);

            this.container = container;
        }
Пример #30
0
 public SkinControlLoader(IContainerControl container, SkinConfig skin)
 {
     Container = container;
     Skin = skin;
 }
Пример #31
0
        public ManualsTab(IXappFormsTabHandler aHandler, IManualsManager aManager, AdvancedModule aAdvancedModule)
        {
            iHandler = aHandler;
            iManager = aManager;
            iAdvancedModule = aAdvancedModule;

            iMain = iHandler.CreateContainer();
            //var home = "<span id=\"xx\">Hello World!</span>";
            iMain.Add(iAdvancedModule.CreateBrowser(iHandler, iManager.GetPage, "/index.md").WithClass("md"));
            iHandler.SetRoot(iMain);
        }
		/// <summary>
		/// Inicjalizuje kontener.
		/// </summary>
		/// <param name="gameInfo">Informacje o grze.</param>
		public Container(IGameInfo gameInfo)
		{
			this.GameInfo = gameInfo;
			this.Root = new Controls.Panel() { Id = "Root", Size = gameInfo.MainWindow.Size };
			this.Root.Data = new Internals.UIData(gameInfo.MainWindow.Input, gameInfo.Renderer);
		}
Пример #33
0
        internal AdvancedBrowser(IModuleControl aModuleControl, IXappFormsTabHandler aTabHandler, Func<string, string> aHtmlProvider, string aPath)
            : base(aModuleControl, "<div id='{0}' class='browser' />", aModuleControl.Id)
        {
            iTabHandler = aTabHandler;
            iHtmlProvider = aHtmlProvider;
            iHomePath = aPath;

            iPath = aPath;

            iHistory = new Stack<string>();
            iFuture = new Stack<string>();

            iToolbar = iTabHandler.CreateContainer().WithClass("browser-toolbar");
            iWindow = iTabHandler.CreateContainer().WithClass("browser-window");

            iBack = iTabHandler.CreateButton("Back").WithClass("browser-back");
            iForward = iTabHandler.CreateButton("Forward").WithClass("browser-forward");
            iRefresh = iTabHandler.CreateButton("Refresh").WithClass("browser-refresh");
            iHome = iTabHandler.CreateButton("Home").WithClass("browser-home");
            iSearch = iTabHandler.CreateTextbox().WithClass("browser-search");
            iGo = iTabHandler.CreateButton("Go").WithClass("browser-go");

            iBack.Disabled = true;
            iForward.Disabled = true;
            iGo.Disabled = true;

            iBack.Click += (obj, args) =>
            {
                if (iHistory.Count > 0)
                {
                    iFuture.Push(iPath);
                    iForward.Disabled = false;
                    iPath = iHistory.Pop();

                    if (iHistory.Count == 0)
                    {
                        iBack.Disabled = true;
                    }

                    Refresh();
                }
            };

            iForward.Click += (obj, args) =>
            {
                if (iFuture.Count > 0)
                {
                    iHistory.Push(iPath);
                    iBack.Disabled = false;
                    iPath = iFuture.Pop();

                    if (iFuture.Count == 0)
                    {
                        iForward.Disabled = true;
                    }

                    Refresh();
                }
            };

            iRefresh.Click += (obj, args) =>
            {
                Refresh();
            };

            iHome.Click += (obj, args) =>
            {
                if (iPath != iHomePath)
                {
                    iPath = iHomePath;
                    iHistory.Clear();
                    iFuture.Clear();
                    iBack.Disabled = true;
                    iForward.Disabled = true;
                    Refresh();
                }
            };

            iSearch.Change += (obj, args) =>
            {
                iGo.Disabled = iSearch.Text.Length == 0;
            };

            iSearch.Enter += (obj, args) =>
            {
                Search();
            };

            iGo.Click += (obj, args) =>
            {
                Search();
            };

            iToolbar.Add(iBack);
            iToolbar.Add(iForward);
            iToolbar.Add(iRefresh);
            iToolbar.Add(iHome);
            iToolbar.Add(iSearch);
            iToolbar.Add(iGo);

            ControlEval(string.Format("{0}.append({1})", iSelector, iToolbar.Id.JquerySelector()));
            ControlEval(string.Format("{0}.append({1})", iSelector, iWindow.Id.JquerySelector()));

            ControlRegisterEventHandler("link", OnLink);

            Refresh();
        }