Exemplo n.º 1
0
        /// <summary>
        /// Returns appropriate Fore-Item from this set, for specified (state).
        /// </summary>
        /// <param name="state"></param>
        /// <returns></returns>
        public PaletteItem GetForeItemForState(GInteractiveState state)
        {
            switch (state)
            {
            case GInteractiveState.None: return(this.ForeEnable);

            case GInteractiveState.MouseOver: return(this.ForeHot);

            case GInteractiveState.LeftDown:
            case GInteractiveState.RightDown:
            case GInteractiveState.LeftFrame:
            case GInteractiveState.RightFrame:
            case GInteractiveState.LeftDrag:
            case GInteractiveState.RightDrag: return(this.ForeDown);
            }
            return(this.ForeDisable);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Vykreslí zdejší ikonu pro daný interaktivní stav
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="absoluteBounds"></param>
        /// <param name="interactiveState"></param>
        /// <param name="drawAsShadow"></param>
        public void DrawIcon(Graphics graphics, Rectangle absoluteBounds, GInteractiveState interactiveState = GInteractiveState.Enabled, bool drawAsShadow = false)
        {
            Image image = GetImage(interactiveState, absoluteBounds.Height);

            if (image == null)
            {
                return;
            }
            if (drawAsShadow)
            {
                Painter.DrawImage(graphics, absoluteBounds, image, 0.45f);
            }
            else
            {
                Painter.DrawImage(graphics, absoluteBounds, image, interactiveState);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Vrátí standardní ikonu = podle typu vrátí aktuálně platnou ikonu ze skinu, kde může být kdykoliv změněna a přitom se nemusí měnit obsah instance <see cref="InteractiveIcon"/>
        /// </summary>
        /// <param name="interactiveState"></param>
        /// <param name="size"></param>
        /// <returns></returns>
        private Image _GetStandardImage(GInteractiveState interactiveState, int size)
        {
            if (_IconType.HasValue)
            {
                switch (_IconType.Value)
                {
                case StandardIconType.RelationRecord: return(StandardIcons.RelationRecordForSize(size));               // Skin.TextBox.IconRelationRecord;

                case StandardIconType.RelationDocument: return(StandardIcons.RelationDocumentForSize(size));           // Skin.TextBox.IconRelationDocument;

                case StandardIconType.OpenFolder: return(StandardIcons.OpenFolderForSize(size));                       // Skin.TextBox.IconOpenFolder;

                case StandardIconType.Calculator: return(StandardIcons.CalculatorForSize(size));                       // Skin.TextBox.IconCalculator;

                case StandardIconType.Calendar: return(StandardIcons.CalendarForSize(size));                           // Skin.TextBox.IconCalendar;

                case StandardIconType.DropDown: return(StandardIcons.DropDownForSize(size));                           // Skin.TextBox.IconDropDown;
                }
            }
            return(null);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Vrací Image pro daný interaktivní stav objektu a velikost
        /// </summary>
        /// <param name="interactiveState"></param>
        /// <param name="size"></param>
        /// <returns></returns>
        public Image GetImage(GInteractiveState interactiveState, int size)
        {
            Image image = _GetStandardImage(interactiveState, size);

            if (image == null)
            {
                ImageDynamic?.Invoke(interactiveState, size);
            }
            if (image == null)
            {
                image = (interactiveState.HasFlag(GInteractiveState.Disabled) ? ImageDisabled :
                         (interactiveState.HasFlag(GInteractiveState.ReadOnly) ? ImageDisabled :
                          (interactiveState.HasFlag(GInteractiveState.FlagOver) ? ImageMouseOver :
                           (interactiveState.HasFlag(GInteractiveState.FlagDown) ? ImageMouseDown : null))));
            }
            if (image == null)
            {
                image = ImageStandard;
            }

            return(image);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Returns CurrentColor from this set, from Fore-Item for specified (state).
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public Color GetForeColorForState(GInteractiveState state)
 {
     return(this.GetForeItemForState(state).CurrentColor);
 }