Exemple #1
0
        /// <summary>
        /// Sets a style for the specified GUI element type.
        /// </summary>
        /// <param name="name">Name of the style to add/modify.</param>
        /// <param name="style">Style object containing style options.</param>
        public void SetStyle(string name, GUIElementStyle style)
        {
            IntPtr stylePtr = IntPtr.Zero;

            if (style != null)
            {
                stylePtr = style.GetCachedPtr();
            }

            Internal_SetStyle(mCachedPtr, name, stylePtr);
        }
Exemple #2
0
 private static extern void Internal_CreateInstance(GUIElementStyle instance);
            /// <summary>
            /// Updates all GUI elements from the style if style changes.
            /// </summary>
            /// <param name="style">Style to display in the GUI.</param>
            /// <returns>State representing was anything modified between two last calls to <see cref="Refresh"/>.</returns>
            public InspectableState Refresh(GUIElementStyle style)
            {
                this.style = style;

                InspectableState oldModifiedState = modifiedState;
                if (modifiedState.HasFlag(InspectableState.Modified))
                    modifiedState = InspectableState.NotModified;

                if (style == null)
                    return oldModifiedState;

                fontField.Value = style.Font;
                fontSizeField.Value = style.FontSize;
                horzAlignField.Value = (ulong)style.TextHorzAlign;
                vertAlignField.Value = (ulong)style.TextVertAlign;
                imagePositionField.Value = (ulong)style.ImagePosition;
                wordWrapField.Value = style.WordWrap;

                normalGUI.Refresh(style.Normal);
                hoverGUI.Refresh(style.Hover);
                activeGUI.Refresh(style.Active);
                focusedGUI.Refresh(style.Focused);
                normalOnGUI.Refresh(style.NormalOn);
                hoverOnGUI.Refresh(style.HoverOn);
                activeOnGUI.Refresh(style.ActiveOn);
                focusedOnGUI.Refresh(style.FocusedOn);

                borderGUI.Refresh(style.Border);
                marginsGUI.Refresh(style.Margins);
                contentOffsetGUI.Refresh(style.ContentOffset);

                fixedWidthField.Value = style.FixedWidth;
                widthField.Value = style.Width;
                minWidthField.Value = style.MinWidth;
                maxWidthField.Value = style.MaxWidth;
                fixedHeightField.Value = style.FixedHeight;
                heightField.Value = style.Height;
                minHeightField.Value = style.MinHeight;
                maxHeightField.Value = style.MaxHeight;

                widthField.Active = style.FixedWidth;
                minWidthField.Active = !style.FixedWidth;
                maxWidthField.Active = !style.FixedWidth;

                heightField.Active = style.FixedHeight;
                minHeightField.Active = !style.FixedHeight;
                maxHeightField.Active = !style.FixedHeight;

                return oldModifiedState;
            }
Exemple #4
0
 private static extern void Internal_CreateInstance(GUIElementStyle instance);