protected FormControlForBase(IComponentCreator <MvcBootstrapHelper <TModel> > creator, bool editor, Expression <Func <TModel, TValue> > expression)
     : base(creator, "div", editor ? null : Css.FormControlStatic)
 {
     _editor             = editor;
     Expression          = expression;
     AddFormControlClass = true;
 }
Example #2
0
        private ComposerComponent AddComponentToPanel(IComponentCreator creator)
        {
            try
            {
                ComposerComponent component = creator.Instance;

                component.Configuration.Resolution      = panelBuilder.Size;
                component.Configuration.FinalResolution = finalResolution;
                component.Configuration.Size            = component.Size;

                component.ContextMenuStrip = contextMenuStripComponents;

                if (component is TVComposer)
                {
                    (component as TVComposer).SetOptionsWindowConnection(Connection);
                }

                component.DoubleClick += component_DoubleClick;

                panelBuilder.Controls.Add(component);

                return(component);
            }
            catch (Exception ex)
            {
#if DEBUG
                MessageBox.Show(ex.Message);
                return(null);
#endif
            }
        }
        /// <summary>
        /// Gets the member object that matches the field member.
        ///
        /// For a field:
        ///
        /// self._menuStrip.Items.AddRange()
        ///
        /// This method returns:
        ///
        /// Items
        /// </summary>
        public object GetMember(IComponentCreator componentCreator)
        {
            object obj = componentCreator.GetComponent(variableName);

            if (obj == null)
            {
                obj = componentCreator.GetInstance(variableName);
                if (obj == null)
                {
                    obj = GetInheritedObject(memberName, componentCreator.RootComponent);
                    if ((obj == null) && !IsSelfReference)
                    {
                        obj = componentCreator.GetInstance(fullMemberName);
                    }
                }
            }

            if (obj != null)
            {
                string[] memberNames = fullMemberName.Split('.');
                int      startIndex  = GetMembersStartIndex(memberNames);
                return(GetMember(obj, memberNames, startIndex, memberNames.Length - 1));
            }
            return(null);
        }
Example #4
0
 internal NavbarToggle(IComponentCreator <THelper> creator)
     : base(creator, "button", Css.NavbarToggle, "collapsed")
 {
     Hamburger = true;
     this.MergeAttribute("type", "button");
     this.MergeAttribute("data-toggle", "collapse");
 }
Example #5
0
        /// <summary>
        /// Creates a dialog based on the dialog XML element.
        /// </summary>
        /// <param name="componentCreator">The object that will be used to create
        /// all components. This can be used to link the dialog creation with
        /// a forms designer.</param>
        public Form CreateDialog(IComponentCreator componentCreator)
        {
            if (componentCreator == null)
            {
                throw new ArgumentNullException("componentCreator");
            }

            Form dialog = CreateForm(componentCreator);

            foreach (Control control in CreateControls(componentCreator))
            {
                dialog.Controls.Add(control);
            }

            // Add accept button.
            if (acceptButton != null)
            {
                dialog.AcceptButton = acceptButton;
            }

            // Add cancel button.
            if (cancelButton != null)
            {
                dialog.CancelButton = cancelButton;
            }

            // Make sure bitmaps appear behind all other controls.
            foreach (PictureBox pictureBox in pictureBoxesAdded)
            {
                pictureBox.SendToBack();
            }

            return(dialog);
        }
Example #6
0
        public void BeginLoad_PassedFakeDesignerLoaderHost_CallsCreatesComponentWalkerPassingNonNullComponentCreator()
        {
            BeginLoad();
            IComponentCreator componentCreator = loader.ComponentCreatorPassedToCreateComponentWalker;

            Assert.IsNotNull(componentCreator);
        }
        /// <summary>
        /// Sets the property value that is referenced by this field expression.
        /// </summary>
        /// <remarks>
        /// This method checks that the name expression matches a created instance before
        /// converting the name expression as a string and setting the property value.
        /// </remarks>
        public bool SetPropertyValue(IComponentCreator componentCreator, NameExpression nameExpression)
        {
            object             component = GetComponent(componentCreator);
            PropertyDescriptor property  = GetProperty(component, memberName);

            if (property != null)
            {
                string name = nameExpression.Name;
                if (property.PropertyType != typeof(bool))
                {
                    if ("self" == name)
                    {
                        return(SetPropertyValue(component, memberName, componentCreator.RootComponent));
                    }
                    else
                    {
                        object instance = componentCreator.GetInstance(name);
                        if (instance != null)
                        {
                            return(SetPropertyValue(component, memberName, instance));
                        }
                    }
                }
                return(SetPropertyValue(component, memberName, name));
            }
            return(false);
        }
Example #8
0
        /// <summary>
        /// Creates a horizontal line based on the Control xml element.
        /// </summary>
        Label CreateLine(XmlElement controlElement, IComponentCreator componentCreator)
        {
            Label label = (Label)CreateControl(typeof(Label), controlElement, componentCreator);

            label.BorderStyle = BorderStyle.Fixed3D;
            label.Height      = ConvertTemplateUnitsToPixels(lineHeight);
            return(label);
        }
Example #9
0
 internal ProgressBar(IComponentCreator <THelper> creator)
     : base(creator, "div", Css.ProgressBar)
 {
     this.MergeAttribute("role", "progressbar");
     Value = 50;
     Min   = 0;
     Max   = 100;
 }
Example #10
0
 internal PanelTitle(IComponentCreator <THelper> creator, string text, int headingLevel)
     : base(creator, "h" + headingLevel, Css.PanelTitle)
 {
     if (headingLevel < 1 || headingLevel > 6)
     {
         throw new ArgumentOutOfRangeException("headingLevel");
     }
     TextContent = text;
 }
        public void Test_register_with_mixed_null_parameters_returns_false(IComponentCreator creator, string fileName)
        {
            // Arrange.
            // Act.
            var actual = _componentRegister.RegisterComponent(creator, fileName);

            // Assert.
            actual.Should().BeFalse("if one of the components used is null (or empty), then we will return false.");
        }
Example #12
0
        /// <summary>
        /// Creates a picture box containing a bitmap.
        /// </summary>
        PictureBox CreatePictureBox(XmlElement controlElement, IComponentCreator componentCreator)
        {
            PictureBox pictureBox = (PictureBox)CreateControl(typeof(PictureBox), controlElement, componentCreator);

            pictureBox.Image    = GetBitmapFromId(controlElement.GetAttribute("Text"));
            pictureBox.SizeMode = PictureBoxSizeMode.CenterImage;
            pictureBoxesAdded.Add(pictureBox);
            return(pictureBox);
        }
Example #13
0
        /// <summary>
        /// Creates a list box.
        /// </summary>
        ListBox CreateListBox(XmlElement controlElement, IComponentCreator componentCreator)
        {
            // Create list box.
            ListBox listBox = (ListBox)CreateControl(typeof(ListBox), controlElement, componentCreator);

            // Add list box items.
            AddListItems(controlElement, listBox.Items);

            return(listBox);
        }
        /// <summary>
        /// Returns true if the variable has a property with the specified name.
        /// </summary>
        public bool HasPropertyValue(IComponentCreator componentCreator, string name)
        {
            object component = GetObject(componentCreator);

            if (component != null)
            {
                return(TypeDescriptor.GetProperties(component).Find(name, true) != null);
            }
            return(false);
        }
Example #15
0
        /// <summary>
        /// Creates a label.
        /// </summary>
        Label CreateLabel(XmlElement controlElement, IComponentCreator componentCreator)
        {
            Label label = (Label)CreateControl(typeof(Label), controlElement, componentCreator);

            if (IsYes(controlElement.GetAttribute("Transparent")))
            {
                // Setting the alpha to 0 does not work, the labels are not made transparent.
                label.BackColor = Color.FromArgb(0, label.BackColor);
            }
            return(label);
        }
 /// <summary>
 /// Gets the name of the instance. If the name matches a property of the current component being created
 /// then this method returns null.
 /// </summary>
 public string GetInstanceName(IComponentCreator componentCreator)
 {
     if (IsSelfReference)
     {
         if (!HasPropertyValue(componentCreator, memberName))
         {
             return(variableName);
         }
     }
     return(null);
 }
Example #17
0
        /// <summary>
        /// Creates a list view.
        /// </summary>
        ListView CreateListView(XmlElement controlElement, IComponentCreator componentCreator)
        {
            // Create list view.
            ListView listView = (ListView)CreateControl(typeof(ListView), controlElement, componentCreator);

            listView.View = View.List;

            // Add list view items.
            AddListItems(controlElement, listView.Items);

            return(listView);
        }
Example #18
0
        /// <summary>
        /// Creates a combo box.
        /// </summary>
        ComboBox CreateComboBox(XmlElement controlElement, IComponentCreator componentCreator)
        {
            // Create combo box.
            ComboBox comboBox = (ComboBox)CreateControl(typeof(ComboBox), controlElement, componentCreator);

            comboBox.Text = controlElement.GetAttribute("Property");

            // Add combo box items.
            AddListItems(controlElement, comboBox.Items);

            return(comboBox);
        }
Example #19
0
        }                                           // Can be used to set simple text content for the tag

        protected internal Tag(IComponentCreator <THelper> creator, string tagName, params string[] cssClasses)
            : base(creator)
        {
            _tagName     = tagName;
            CssClasses   = new HashSet <string>();
            Attributes   = new MergeableDictionary();
            InlineStyles = new MergeableDictionary();
            foreach (string cssClass in cssClasses.Where(x => !string.IsNullOrWhiteSpace(x)))
            {
                CssClasses.Add(cssClass);
            }
            _prettyPrint = Helper.PrettyPrint;
        }
 /// <summary>
 /// Gets the object that the field expression variable refers to.
 /// </summary>
 /// <remarks>
 /// This method will also check form's base class for any inherited objects that match
 /// the object being referenced.
 /// </remarks>
 public object GetObject(IComponentCreator componentCreator)
 {
     if (variableName.Length > 0)
     {
         object component = componentCreator.GetComponent(variableName);
         if (component != null)
         {
             return(component);
         }
         return(GetInheritedObject(variableName, componentCreator.RootComponent));
     }
     return(componentCreator.RootComponent);
 }
Example #21
0
        /// <summary>
        /// Creates a new button control based on the xml element and also sets the
        /// stores the accept button and cancel button if it is defined.
        /// </summary>
        Button CreateButton(XmlElement controlElement, IComponentCreator componentCreator)
        {
            Button button = (Button)CreateControl(typeof(Button), controlElement, componentCreator);

            if (IsAcceptButton(controlElement))
            {
                acceptButton = button;
            }
            else if (IsCancelButton(controlElement))
            {
                cancelButton = button;
            }
            return(button);
        }
        /// <summary>
        /// Gets the component that this field refers to.
        /// </summary>
        object GetComponent(IComponentCreator componentCreator)
        {
            object component = null;

            if (IsSelfReference)
            {
                component = GetObject(componentCreator);
                component = GetObjectForMemberName(component);
            }
            else
            {
                component = componentCreator.GetInstance(variableName);
            }
            return(component);
        }
Example #23
0
        /// <summary>
        /// Creates a form from the dialog element and sets its properties, but
        /// does not add any controls to it.
        /// </summary>
        /// <remarks>
        /// We set the ClientSize of the form rather than the Size since the Height
        /// and Width attributes seem to refer to the client area height and width.
        /// </remarks>
        Form CreateForm(IComponentCreator componentCreator)
        {
            string     dialogId      = dialogElement.GetAttribute("Id");
            IComponent formComponent = componentCreator.CreateComponent(typeof(Form), dialogId);
            Form       dialog        = (Form)formComponent;

            dialog.Name            = dialogId;
            dialog.Text            = dialogElement.GetAttribute("Title");
            dialog.FormBorderStyle = FormBorderStyle.FixedDialog;
            dialog.ClientSize      = GetControlSize(dialogElement);
            dialog.MaximizeBox     = false;
            dialog.MinimizeBox     = IsMinimizeButtonEnabled(dialogElement);

            return(dialog);
        }
Example #24
0
        /// <summary>
        /// Uses the creator to create a component, and then add that component to the list.
        /// </summary>
        /// <param name="creator"> The specific component creator. </param>
        /// <param name="fileName"> The filename (location) that the component uses to read from. </param>
        /// <returns></returns>
        public bool RegisterComponent(IComponentCreator creator, string fileName)
        {
            var response = false;

            // Contract requirements.
            if (creator != null && !string.IsNullOrWhiteSpace(fileName))
            {
                var component = creator.CreateComponent(Hub, fileName);
                Hub.Subscribe <string>(async(s) => await component.Processor.ProcessAsync(fileName).ConfigureAwait(false));
                Components.Add(component);
                response = true;
            }

            return(response);
        }
Example #25
0
        /// <summary>
        /// Creates a control of the given type. This is a common routine that creates
        /// and sets up various control properties that the Wix Control element defines and
        /// are common across control types.
        /// </summary>
        /// <param name="type">The type of control to create (e.g. Button)</param>
        /// <param name="controlElement">The Wix Control element.</param>
        /// <param name="componentCreator">The object to use to create the control.</param>
        /// <param name="name">The name of the component to create.</param>
        Control CreateControl(Type type, XmlElement controlElement, IComponentCreator componentCreator, string name)
        {
            Control control = (Control)componentCreator.CreateComponent(type, name);

            // Disabling controls does not seem to work. In the designer they are still
            // enabled. The XML forms designer has the same problem even back as far as
            // SharpDevelop 1.1
            control.Enabled  = !IsDisabled(controlElement);
            control.Name     = name;
            control.Text     = GetControlText(controlElement);
            control.Location = GetControlLocation(controlElement);
            control.Size     = GetControlSize(controlElement);
            control.Font     = GetFont(control.Text, control.Font);

            return(control);
        }
Example #26
0
        private ComposerComponent AddComponentToPanel(IComponentCreator creator, ItemConfiguration config)
        {
            try
            {
                ComposerComponent component = creator.FromConfiguration(config);

                Size  newSize     = new Size();
                Point newLocation = new Point();

                newSize.Width  = (config.Size.Width * panelBuilder.Width) / config.Resolution.Width;
                newSize.Height = (config.Size.Height * panelBuilder.Height) / config.Resolution.Height;

                newLocation.X = (config.Location.X * panelBuilder.Width) / config.Resolution.Width;
                newLocation.Y = (config.Location.Y * panelBuilder.Height) / config.Resolution.Height;

                component.Size     = newSize;
                component.Location = newLocation;

                component.Configuration.Resolution      = panelBuilder.Size;
                component.Configuration.FinalResolution = finalResolution;
                component.Configuration.Size            = component.Size;

                component.ContextMenuStrip = contextMenuStripComponents;

                if (component is TVComposer)
                {
                    (component as TVComposer).SetOptionsWindowConnection(Connection);
                }

                component.DoubleClick += component_DoubleClick;

                panelBuilder.Controls.Add(component);

                return(component);
            }
            catch (Exception ex)
            {
#if DEBUG
                MessageBox.Show(ex.Message);
                return(null);
#endif
            }
        }
Example #27
0
        /// <summary>
        /// Creates a radio button group.
        /// </summary>
        RadioButtonGroupBox CreateRadioButtonGroup(XmlElement controlElement, IComponentCreator componentCreator)
        {
            // Create radio button group box.
            RadioButtonGroupBox radioButtonGroup = (RadioButtonGroupBox)CreateControl(typeof(RadioButtonGroupBox), controlElement, componentCreator);
            string property = controlElement.GetAttribute("Property");

            radioButtonGroup.PropertyName = property;

            // Add radio buttons.
            int radioButtonCount = 0;

            foreach (XmlElement radioButtonElement in GetRadioButtonElements(property))
            {
                ++radioButtonCount;
                string radioButtonName = String.Concat(property, "RadioButton", radioButtonCount.ToString());
                radioButtonGroup.Controls.Add(CreateRadioButton(radioButtonElement, componentCreator, radioButtonName));
            }
            return(radioButtonGroup);
        }
		public static IComponentWalker CreateComponentWalker(IComponentCreator componentCreator)
		{
			return new RubyComponentWalker(componentCreator);
		}
Example #29
0
 internal Small(IComponentCreator <THelper> creator)
     : base(creator, "small")
 {
 }
		public PythonComponentWalker(IComponentCreator componentCreator)
		{
			this.componentCreator = componentCreator;
			deserializer = new PythonCodeDeserializer(componentCreator);
		}
Example #31
0
		public RubyCodeDeserializer(IComponentCreator componentCreator)
		{
			this.componentCreator = componentCreator;
		}
		/// <summary>
		/// Gets the name of the instance. If the name matches a property of the current component being created
		/// then this method returns null.
		/// </summary>
		public string GetInstanceName(IComponentCreator componentCreator)
		{
			if (IsSelfReference) {
				if (!HasPropertyValue(componentCreator, memberName)) {
					return variableName;
				}
			}
			return null;
		}
		public PythonCodeDeserializer(IComponentCreator componentCreator)
		{
			this.componentCreator = componentCreator;
		}
		/// <summary>
		/// Gets the object that the field expression variable refers to.
		/// </summary>
		/// <remarks>
		/// This method will also check form's base class for any inherited objects that match
		/// the object being referenced.
		/// </remarks>
		public object GetObject(IComponentCreator componentCreator)
		{
			if (variableName.Length > 0) {
				object component = componentCreator.GetComponent(variableName);
				if (component != null) {
					return component;
				}	
				return GetInheritedObject(variableName, componentCreator.RootComponent);
			}
			return componentCreator.RootComponent;		
		}
		public RubyComponentWalker(IComponentCreator componentCreator)
		{
			this.componentCreator = componentCreator;
			deserializer = new RubyCodeDeserializer(componentCreator);
		}
		protected override IComponentWalker CreateComponentWalker(IComponentCreator componentCreator)
		{
			ComponentCreatorPassedToCreateComponentWalker = componentCreator;
			return FakeComponentWalker;
		}
Example #37
0
		/// <summary>
		/// Creates a combo box.
		/// </summary>
		ComboBox CreateComboBox(XmlElement controlElement, IComponentCreator componentCreator)
		{
			// Create combo box.
			ComboBox comboBox = (ComboBox)CreateControl(typeof(ComboBox), controlElement, componentCreator);
			comboBox.Text = controlElement.GetAttribute("Property");

			// Add combo box items.
			AddListItems(controlElement, comboBox.Items);
			
			return comboBox;
		}
Example #38
0
		/// <summary>
		/// Creates a list view.
		/// </summary>
		ListView CreateListView(XmlElement controlElement, IComponentCreator componentCreator)
		{
			// Create list view.
			ListView listView = (ListView)CreateControl(typeof(ListView), controlElement, componentCreator);
			listView.View = View.List;
			
			// Add list view items.
			AddListItems(controlElement, listView.Items);
			
			return listView;
		}
Example #39
0
		/// <summary>
		/// Creates a horizontal line based on the Control xml element.
		/// </summary>
		Label CreateLine(XmlElement controlElement, IComponentCreator componentCreator)
		{
			Label label = (Label)CreateControl(typeof(Label), controlElement, componentCreator);
			label.BorderStyle = BorderStyle.Fixed3D;
			label.Height = ConvertTemplateUnitsToPixels(lineHeight);
			return label;
		}
Example #40
0
		/// <summary>
		/// Creates a radio button control.
		/// </summary>
		RadioButton CreateRadioButton(XmlElement radioButtonElement, IComponentCreator componentCreator, string name)
		{
			RadioButton radioButton = (RadioButton)CreateControl(typeof(RadioButton), radioButtonElement, componentCreator, name);
			return radioButton;
		}
Example #41
0
		/// <summary>
		/// Creates a radio button group.
		/// </summary>
		RadioButtonGroupBox CreateRadioButtonGroup(XmlElement controlElement, IComponentCreator componentCreator)
		{
			// Create radio button group box.
			RadioButtonGroupBox radioButtonGroup = (RadioButtonGroupBox)CreateControl(typeof(RadioButtonGroupBox), controlElement, componentCreator);
			string property = controlElement.GetAttribute("Property");
			radioButtonGroup.PropertyName = property;
			
			// Add radio buttons.
			int radioButtonCount = 0;
			foreach (XmlElement radioButtonElement in GetRadioButtonElements(property)) {
				++radioButtonCount;
				string radioButtonName = String.Concat(property, "RadioButton", radioButtonCount.ToString());
				radioButtonGroup.Controls.Add(CreateRadioButton(radioButtonElement, componentCreator, radioButtonName));
			}
			return radioButtonGroup;
		}
Example #42
0
 protected FormControl(IComponentCreator <THelper> creator, string tagName, params string[] cssClasses)
     : base(creator, tagName, cssClasses)
 {
     EnsureFormGroup = true;
 }
Example #43
0
		/// <summary>
		/// Creates a label.
		/// </summary>
		Label CreateLabel(XmlElement controlElement, IComponentCreator componentCreator)
		{
			Label label = (Label)CreateControl(typeof(Label), controlElement, componentCreator);
			
			if (IsYes(controlElement.GetAttribute("Transparent"))) {
				// Setting the alpha to 0 does not work, the labels are not made transparent.
				label.BackColor = Color.FromArgb(0, label.BackColor);
			}
			return label;
		}
Example #44
0
		/// <summary>
		/// Creates a new button control based on the xml element and also sets the
		/// stores the accept button and cancel button if it is defined.
		/// </summary>
		Button CreateButton(XmlElement controlElement, IComponentCreator componentCreator)
		{
			Button button = (Button)CreateControl(typeof(Button), controlElement, componentCreator);
			if (IsAcceptButton(controlElement)) {
				acceptButton = button;
			} else if (IsCancelButton(controlElement)) {
				cancelButton = button;
			}
			return button;
		}
Example #45
0
		/// <summary>
		/// Creates a control of the given type. This is a common routine that creates 
		/// and sets up various control properties that the Wix Control element defines and
		/// are common across control types.
		/// </summary>
		/// <param name="type">The type of control to create (e.g. Button)</param>
		/// <param name="controlElement">The Wix Control element.</param>
		/// <param name="componentCreator">The object to use to create the control.</param>
		/// <param name="name">The name of the component to create.</param>
		Control CreateControl(Type type, XmlElement controlElement, IComponentCreator componentCreator, string name)
		{
			Control control = (Control)componentCreator.CreateComponent(type, name);
			
			// Disabling controls does not seem to work. In the designer they are still
			// enabled. The XML forms designer has the same problem even back as far as
			// SharpDevelop 1.1
			control.Enabled = !IsDisabled(controlElement);
			control.Name = name;
			control.Text = GetControlText(controlElement);
			control.Location = GetControlLocation(controlElement);
			control.Size = GetControlSize(controlElement);
			control.Font = GetFont(control.Text, control.Font);
			
			return control;
		}
Example #46
0
		/// <summary>
		/// Creates a control of the given type. This is a common routine that creates 
		/// and sets up various control properties that the Wix Control element defines and
		/// are common across control types.
		/// </summary>
		/// <param name="type">The type of control to create (e.g. Button)</param>
		/// <param name="controlElement">The Wix Control element.</param>
		/// <param name="componentCreator">The object to use to create the control.</param>
		Control CreateControl(Type type, XmlElement controlElement, IComponentCreator componentCreator)
		{
			string name = controlElement.GetAttribute("Id");
			return CreateControl(type, controlElement, componentCreator, name);
		}
		/// <summary>
		/// Sets the property value that is referenced by this field expression.
		/// </summary>
		/// <remarks>
		/// This method checks that the name expression matches a created instance before
		/// converting the name expression as a string and setting the property value.
		/// </remarks>
		public bool SetPropertyValue(IComponentCreator componentCreator, NameExpression nameExpression)
		{
			object component = GetComponent(componentCreator);
			PropertyDescriptor property = GetProperty(component, memberName);
			if (property != null) {
				string name = nameExpression.Name;
				if (property.PropertyType != typeof(bool)) {
					if ("self" == name) {
						return SetPropertyValue(component, memberName, componentCreator.RootComponent);
					} else {
						object instance = componentCreator.GetInstance(name);
						if (instance != null) {
							return SetPropertyValue(component, memberName, instance);
						}
					}
				}
				return SetPropertyValue(component, memberName, name);
			}
			return false;
		}
Example #48
0
		/// <summary>
		/// Creates a list of controls that need to be added to the dialog.
		/// </summary>
		List<Control> CreateControls(IComponentCreator componentCreator)
		{
			List<Control> controls = new List<Control>();
			foreach (XmlElement controlElement in dialogElement.SelectNodes("w:Control", namespaceManager)) {
				switch (controlElement.GetAttribute("Type")) {
					case "PushButton":
						controls.Add(CreateButton(controlElement, componentCreator));
						break;
					case "Text":
						controls.Add(CreateLabel(controlElement, componentCreator));
						break;
					case "Line":
						controls.Add(CreateLine(controlElement, componentCreator));
						break;
					case "CheckBox":
						controls.Add(CreateControl(typeof(CheckBox), controlElement, componentCreator));
						break;
					case "ScrollableText":
						controls.Add(CreateControl(typeof(RichTextBox), controlElement, componentCreator));
						break;
					case "ComboBox":
						controls.Add(CreateComboBox(controlElement, componentCreator));
						break;
					case "Edit":
					case "PathEdit":
						controls.Add(CreateControl(typeof(TextBox), controlElement, componentCreator));
						break;
					case "GroupBox":
						controls.Add(CreateControl(typeof(GroupBox), controlElement, componentCreator));
						break;
					case "RadioButtonGroup":
						controls.Add(CreateRadioButtonGroup(controlElement, componentCreator));
						break;
					case "Bitmap":
						controls.Add(CreatePictureBox(controlElement, componentCreator));
						break;
					case "ListBox":
						controls.Add(CreateListBox(controlElement, componentCreator));
						break;
					case "DirectoryList":
						controls.Add(CreateControl(typeof(ListBox), controlElement, componentCreator));
						break;
					case "ListView":
						controls.Add(CreateListView(controlElement, componentCreator));
						break;
					case "ProgressBar":
						controls.Add(CreateControl(typeof(ProgressBar), controlElement, componentCreator));
						break;
					case "MaskedEdit":
						controls.Add(CreateControl(typeof(MaskedTextBox), controlElement, componentCreator));
						break;
					case "SelectionTree":
						controls.Add(CreateControl(typeof(TreeView), controlElement, componentCreator));
						break;
				}
			}
			return controls;
		}
		/// <summary>
		/// Returns true if the variable has a property with the specified name.
		/// </summary>
		public bool HasPropertyValue(IComponentCreator componentCreator, string name)
		{
			object component = GetObject(componentCreator);
			if (component != null) {
				return TypeDescriptor.GetProperties(component).Find(name, true) != null;
			}
			return false;
		}
Example #50
0
		/// <summary>
		/// Creates a form from the dialog element and sets its properties, but 
		/// does not add any controls to it.
		/// </summary>
		/// <remarks>
		/// We set the ClientSize of the form rather than the Size since the Height
		/// and Width attributes seem to refer to the client area height and width.
		/// </remarks>
		Form CreateForm(IComponentCreator componentCreator)
		{
			string dialogId = dialogElement.GetAttribute("Id");
			IComponent formComponent = componentCreator.CreateComponent(typeof(Form), dialogId);
			Form dialog = (Form)formComponent;
			dialog.Name = dialogId;
			dialog.Text = dialogElement.GetAttribute("Title");
			dialog.FormBorderStyle = FormBorderStyle.FixedDialog;
			dialog.ClientSize = GetControlSize(dialogElement);
			dialog.MaximizeBox = false;
			dialog.MinimizeBox = IsMinimizeButtonEnabled(dialogElement);
			
			return dialog;
		}
		protected virtual IComponentWalker CreateComponentWalker(IComponentCreator componentCreator)
		{
			return null;
		}
Example #52
0
		/// <summary>
		/// Creates a dialog based on the dialog XML element.
		/// </summary>
		/// <param name="componentCreator">The object that will be used to create
		/// all components. This can be used to link the dialog creation with
		/// a forms designer.</param>
		public Form CreateDialog(IComponentCreator componentCreator)
		{
			if (componentCreator == null) {
				throw new ArgumentException("Cannot be null.", "componentCreator");
			}
			
			Form dialog = CreateForm(componentCreator);
			
			foreach (Control control in CreateControls(componentCreator)) {
				dialog.Controls.Add(control);
			}
			
			// Add accept button.
			if (acceptButton != null) {
				dialog.AcceptButton = acceptButton;
			}
			
			// Add cancel button.
			if (cancelButton != null) {
				dialog.CancelButton = cancelButton;
			}
			
			// Make sure bitmaps appear behind all other controls.
			foreach (PictureBox pictureBox in pictureBoxesAdded) {
				pictureBox.SendToBack();
			}
			
			return dialog;
		}
		protected override IComponentWalker CreateComponentWalker(IComponentCreator componentCreator)
		{
			return PythonComponentWalkerHelper.CreateComponentWalker(componentCreator);
		}
		/// <summary>
		/// Gets the component that this field refers to.
		/// </summary>
		object GetComponent(IComponentCreator componentCreator)
		{
			object component = null;
			if (IsSelfReference) {
				component = GetObject(componentCreator);
				component = GetObjectForMemberName(component);
			} else {
				component = componentCreator.GetInstance(variableName);
			}
			return component;
		}
		protected override IComponentWalker CreateComponentWalker(IComponentCreator componentCreator)
		{
			return new RubyComponentWalker(componentCreator);
		}
		/// <summary>
		/// Gets the member object that matches the field member.
		/// 
		/// For a field: 
		/// 
		/// self._menuStrip.Items.AddRange() 
		/// 
		/// This method returns:
		/// 
		/// Items
		/// </summary>
		public object GetMember(IComponentCreator componentCreator)
		{
			object obj = componentCreator.GetComponent(variableName);
			if (obj == null) {
				obj = componentCreator.GetInstance(variableName);
				if (obj == null) {
					obj = GetInheritedObject(memberName, componentCreator.RootComponent);
					if ((obj == null) && !IsSelfReference) {
						obj = componentCreator.GetInstance(fullMemberName);
					}
				}
			}
			
			if (obj != null) {
				string[] memberNames = fullMemberName.Split('.');
				int startIndex = GetMembersStartIndex(memberNames);
				return GetMember(obj, memberNames, startIndex, memberNames.Length - 1);
			}
			return null;
		}
Example #57
0
 internal Tabs(IComponentCreator <THelper> creator)
     : base(creator, Css.Nav, Css.NavTabs)
 {
     this.MergeAttribute("role", "tablist");
 }
		/// <summary>
		/// Sets the property value that is referenced by this field expression.
		/// </summary>
		/// <remarks>
		/// Checks the field expression to see if it references an class instance variable (e.g. self._treeView1) 
		/// or a variable that is local to the InitializeComponent method (e.g. treeNode1.BackColor)
		/// </remarks>
		public bool SetPropertyValue(IComponentCreator componentCreator, object propertyValue)
		{
			object component = GetComponent(componentCreator);
			return SetPropertyValue(component, memberName, propertyValue);
		}
Example #59
0
		/// <summary>
		/// Creates a list box.
		/// </summary>
		ListBox CreateListBox(XmlElement controlElement, IComponentCreator componentCreator)
		{
			// Create list box.
			ListBox listBox = (ListBox)CreateControl(typeof(ListBox), controlElement, componentCreator);

			// Add list box items.
			AddListItems(controlElement, listBox.Items);
			
			return listBox;
		}
Example #60
0
		/// <summary>
		/// Creates a picture box containing a bitmap.
		/// </summary>
		PictureBox CreatePictureBox(XmlElement controlElement, IComponentCreator componentCreator)
		{
			PictureBox pictureBox = (PictureBox)CreateControl(typeof(PictureBox), controlElement, componentCreator);
			pictureBox.Image = GetBitmapFromId(controlElement.GetAttribute("Text"));
			pictureBox.SizeMode = PictureBoxSizeMode.CenterImage;
			pictureBoxesAdded.Add(pictureBox);
			return pictureBox;
		}