/// <summary>Constructor.</summary>
        /// <param name="divHost">The control host DIV.</param>
        /// <param name="control">The logical IView control (null if not available).</param>
        /// <param name="htmlElement">The control content (supplied by the test class. This is the control that is under test).</param>
        /// <param name="displayMode">The sizing strategy to use for the control.</param>
        /// <param name="allViews">The Collection of all controls.</param>
        public ControlWrapperView(
            jQueryObject divHost, 
            IView control, 
            jQueryObject htmlElement, 
            ControlDisplayMode displayMode, 
            IEnumerable allViews) : base(divHost)
        {
            // Setup initial conditions.
            this.control = control;
            this.htmlElement = htmlElement;
            this.displayMode = displayMode;
            this.allViews = allViews;
            index = divHost.Children().Length; // Store the order position of the control in the host.
            events = Common.Events;

            // Create the wrapper DIV.
            divRoot = Html.CreateDiv();
            divRoot.CSS(Css.Position, Css.Absolute);
            divRoot.AppendTo(divHost);

            // Insert the content.
            htmlElement.CSS(Css.Position, Css.Absolute);
            htmlElement.AppendTo(divRoot);

            // Wire up events.
            events.ControlHostSizeChanged += OnHostResized;

            // Finish up.
            UpdateLayout();
        }
 private static MyCssView AddControl(ControlDisplayMode controlDisplayMode)
 {
     MyCssView view = new MyCssView(Html.CreateDiv(), controlDisplayMode);
     TestHarness.DisplayMode = controlDisplayMode;
     TestHarness.AddControl(view);
     return view;
 }
        public MyCssView(jQueryObject container, ControlDisplayMode controlDisplayMode) : base(container)
        {
            container.Append(string.Format("Control [sizeMode:{0}]", controlDisplayMode.ToString()));
            container.CSS(Css.Background, "#f0ebc5");
            container.CSS(Css.Width, "300px");
            container.CSS(Css.Height, "200px");

            container.CSS("-webkit-border-radius", "10px");
            container.CSS("-moz-border-radius", "10px");
            container.CSS("border-radius", "10px");
        }
Example #4
0
 public void SetDisplayMode(ControlDisplayMode mode) => DisplayMode = mode;
        private void AddView(IView control, jQueryObject htmlElement, ControlDisplayMode controlDisplayMode)
        {
            // Create and add the view.
            ControlWrapperView view = new ControlWrapperView(divControlHost, control, htmlElement, controlDisplayMode, views);
            views.Add(view);

            // Wire up events.
            if (control != null) control.SizeChanged += OnControlSizeChanged;

            // If there is more than one view, set all existing 'Fill' modes to 'FillWithMargin' (to avoid scrollbar issue).
            if (views.Count > 1)
            {
                foreach (ControlWrapperView item in views)
                {
                    if (item.DisplayMode == ControlDisplayMode.Fill) item.DisplayMode = ControlDisplayMode.FillWithMargin;
                }
            }

            // Finish up.
            UpdateLayout();
        }
 /// <summary>Clears the controls from the host canvas and resets to orginal state.</summary>
 public static void Reset()
 {
     displayMode = ControlDisplayMode.Center;
     Events.FireClearControls();
     CanScroll = true;
 }