Exemple #1
0
        public virtual DesignElement GetDesignTypeForComponent(Component component)
        {
            var de  = DesignElement.None;
            var ctl = component as Control;

            if (ctl != null)
            {
                if (ctl.GetType().DeclaringType != null && ctl.GetType().DeclaringType != GetType())
                {
                    return(de);
                }
                if (TranslationToolHelperWinClient.IsSelectableControl(ctl))
                {
                    if (ctl is XtraTabControl)
                    {
                        de = de | DesignElement.Moving;
                    }
                    else
                    {
                        de = de | DesignElement.Sizing | DesignElement.Moving;
                    }
                }
                if (TranslationToolHelperWinClient.IsEditableControl(ctl))
                {
                    de = de | DesignElement.Caption;
                }
            }
            else if (component is GridColumn || component is GridBand || component is TreeListColumn || component is NavBarGroup || component is LayoutControlItem)
            {
                de = de | DesignElement.Caption;
            }
            return(de);
        }
Exemple #2
0
        public void RefreshPropertiesGrid(ControlDesigner sourceControl)
        {
            SourceControl = sourceControl;
            var control = SourceControl.RealControl;

            Model = new ControlModel
            {
                X                = control.Location.X,
                Y                = control.Location.Y,
                Width            = control.Size.Width,
                Height           = control.Size.Height,
                CanCaptionChange = TranslationToolHelperWinClient.IsEditableControl(control)
            };

            if (Model.CanCaptionChange)
            {
                Model.OldCaption  =
                    Model.Caption =
                        TranslationToolHelperWinClient.GetComponentText(control);
            }
            else
            {
                rowCaption.Visible = false;
            }

            if (SourceControl.MovingEnabled)
            {
                Model.OldLocation = control.Location;
            }
            else
            {
                categoryLocation.Visible = false;
            }

            if (SourceControl.SizingEnabled)
            {
                Model.OldSize = control.Size;
            }
            else
            {
                categorySize.Visible = false;
            }

            //we create a list with all menu items
            if (control is PopUpButton)
            {
                var pb = (PopUpButton)control;
                foreach (BarButtonItemLink action in pb.PopupActions.ItemLinks)
                {
                    Model.MenuItems.Add(action.Item.Caption);
                }
                categoryMenuItems.Visible = true;
            }
            else
            {
                categoryMenuItems.Visible = false;
            }

            propGrid.SelectedObject = Model;
        }