GetStyle() protected method

protected GetStyle ( ControlStyles flag ) : bool
flag ControlStyles
return bool
Example #1
0
        private bool ValidateThisControl(Control c, ValidationConstraints constraints)
        {
            if (constraints == ValidationConstraints.None)
            {
                return(true);
            }

            if ((constraints & ValidationConstraints.Enabled) == ValidationConstraints.Enabled && !c.Enabled)
            {
                return(false);
            }

            if ((constraints & ValidationConstraints.Selectable) == ValidationConstraints.Selectable && !c.GetStyle(ControlStyles.Selectable))
            {
                return(false);
            }

            if ((constraints & ValidationConstraints.TabStop) == ValidationConstraints.TabStop && !c.TabStop)
            {
                return(false);
            }

            if ((constraints & ValidationConstraints.Visible) == ValidationConstraints.Visible && !c.Visible)
            {
                return(false);
            }

            return(true);
        }
Example #2
0
		private static Control FindControlForward(Control container, Control start) {
			Control found;

			found = null;

			if (start == null) {
				return FindFlatForward(container, start);
			}

			if (start.child_controls != null && start.child_controls.Count > 0 && 
				(start == container || !((start is IContainerControl) &&  start.GetStyle(ControlStyles.ContainerControl)))) {
				return FindControlForward(start, null);
			}
			else {
				while (start != container) {
					found = FindFlatForward(start.parent, start);
					if (found != null) {
						return found;
					}
					start = start.parent;
				}
			}
			return null;
		}
Example #3
0
		private bool ValidateThisControl (Control c, ValidationConstraints constraints)
		{
			if (constraints == ValidationConstraints.None)
				return true;

			if ((constraints & ValidationConstraints.Enabled) == ValidationConstraints.Enabled && !c.Enabled)
				return false;

			if ((constraints & ValidationConstraints.Selectable) == ValidationConstraints.Selectable && !c.GetStyle (ControlStyles.Selectable))
				return false;

			if ((constraints & ValidationConstraints.TabStop) == ValidationConstraints.TabStop && !c.TabStop)
				return false;

			if ((constraints & ValidationConstraints.Visible) == ValidationConstraints.Visible && !c.Visible)
				return false;

			return true;
		}
Example #4
0
	// Get the next or previous control in the tab order.
	public Control GetNextControl(Control ctl, bool forward)
			{
				if (!Contains(ctl))
				{
					ctl = this;
				}

				if (forward && ctl.children != null && ctl.numChildren > 0 && (ctl == this || !(ctl is IContainerControl) || !ctl.GetStyle(ControlStyles.ContainerControl)))
				{
					// Find the first control in the children.
					Control found = ctl.children[0];
					for (int i = 1; i < ctl.numChildren; i++)
					{
						if (found.tabIndex > ctl.children[i].tabIndex)
						{
							found = ctl.children[i];
						}
					}
					return found;
				}
				
				// Search through the childs hierarchy for the next control, until we've search "this" control.
				while (ctl != this)
				{
					Control found = null;
					if (ctl.parent.numChildren > 0)
					{
						bool passedStart = false;
						if (forward)
						{
							for (int i = 0; i < ctl.parent.numChildren; i++)
							{
								Control child = ctl.parent.children[i];
								if (child == ctl)
								{
									passedStart = true;
								}
								else if (child.tabIndex >= ctl.tabIndex && (child.tabIndex != ctl.tabIndex || passedStart))
								{
									if (found == null || found.tabIndex > child.tabIndex)
									{
										found = ctl.parent.children[i];
									}
								}
							}
							if (found != null)
							{
								return found;
							}
						}
						else // backwards
						{
							// Search up through the childs hierarchy for the previous control, until we've search in this control.
							for (int i = ctl.parent.numChildren - 1; i >= 0 ; i--)
							{
								Control child = ctl.parent.children[i];
								if (child == ctl)
								{
									passedStart = true;
								}
								else if (child.tabIndex <= ctl.tabIndex && (child.tabIndex != ctl.tabIndex || passedStart))
								{
									if (found == null || found.tabIndex < child.tabIndex)
									{
										found = ctl.parent.children[i];
									}
								}
							}
							if (found == null)
							{
								if (ctl.parent == this)
								{
									return null;
								}
								return ctl.parent;
							}
							else
							{
								ctl = found;
								break;
							}
						}

					}
					ctl = ctl.parent;
				}

				if (!forward)
				{
					// Find the container because there was no control found.
		#if CONFIG_COMPONENT_MODEL
					while (ctl.numChildren > 0 && (ctl ==this || !(ctl is IContainer) || !ctl.GetStyle(ControlStyles.ContainerControl)))
		#else
					while (ctl.numChildren > 0 && (ctl ==this || !ctl.GetStyle(ControlStyles.ContainerControl)))
		#endif
					{
						Control found = ctl.children[ctl.numChildren - 1];
						for (int i = ctl.numChildren - 2; i >= 0; i--)
						{
							Control c = ctl.children[i];
							if (found.tabIndex < c.tabIndex)
							{
								found = c;
							}
						}
						ctl = found;
					}
				}
			
				if (ctl != this)
				{
					return ctl;
				}
				return null;
			}