Exemple #1
0
        /// <inheritdoc cref="GLOFC.GL4.Controls.GLBaseControl.RemoveControl(GLBaseControl, bool, bool)"/>
        protected override void RemoveControl(GLBaseControl child, bool dispose, bool removechildren)
        {
            bool ourchild = ControlsZ.Contains(child);          // record before removecontrol updates controlz list

            base.RemoveControl(child, dispose, removechildren); // remove

            if (ourchild)                                       // if its our child
            {
                items.Dispose(textures[child]);                 // and delete textures and remove from item list
                textures.Remove(child);
                visible.Remove(child);
                size.Remove(child);
                UpdateVertexPositionsTextures(true);        // make sure the list is right, controls list has changed
            }
        }
 /// <inheritdoc cref="GLOFC.GL4.Controls.GLBaseControl.OnFocusChanged(FocusEvent, GLBaseControl)"/>
 protected override void OnFocusChanged(FocusEvent evt, GLBaseControl fromto) // called if we get focus (focused=true) or if child gets focused (focused=false)
 {
     if (evt == FocusEvent.ChildFocused)                                      // need to take a note
     {
         if (ControlsZ.Contains(fromto))
         {
             //System.Diagnostics.Debug.WriteLine("Form saw child focused {0} '{1}'", evt, fromto?.Name);
             lastchildfocus = fromto;
         }
     }
     else if (evt == FocusEvent.Focused)     // we got focus, hand off to child
     {
         if (lastchildfocus != null)
         {
             lastchildfocus.SetFocus();
             //System.Diagnostics.Debug.WriteLine("Form focus, focus on child");
         }
     }
 }
Exemple #3
0
        // override base control invalidate, and call it, and also pass the invalidate to the gl window control
        // override this, so that we see all invalidations layouts to us and what child required it.
        // then we just layout and size the child only, so the rest of them, unaffected by the way displaycontrol handles textures, do not get invalidated
        // unless we see there is compound docking on, in which case we need to use a full PerformLayout
        // may be called with null child, meaning its a remove/detach
        // it may be called due to a property in displaycontrol changing (Font),
        // and we check the vertex/positions/sizes to make sure everything is okay
        private protected override void InvalidateLayout(GLBaseControl dueto)
        {
            //System.Diagnostics.Debug.WriteLine($"Display control invalidate layout due to {dueto?.Name} {suspendLayoutCount}");

            glwin.Invalidate();

            int docked = ControlsZ.Where(x => x.Dock >= DockingType.Left).Count(); // how many have a compound docking type

            if (dueto == this || docked > 0)                                       // if change due to display control property, or we have a docking sitation
            {
                PerformLayout();                                                   // full layout on all children
            }
            else
            {
                if (dueto != null)  // if not a remove, layout and size on child only
                {
                    dueto.PerformLayoutAndSize();
                }
            }

            UpdateVertexPositionsTextures();        // need to at least update vertexes, maybe textures
        }