//********************************** Banshee Engine (www.banshee3d.com) **************************************************// //**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************// using System; using System.Runtime.InteropServices; namespace BansheeEngine { /** @addtogroup GUI_Engine * @{ */ /// /// Controls GUI element layout options, possibly by overriding the default options specified in GUI element style. /// These options control GUI element placement and size in a GUI layout. /// [StructLayout(LayoutKind.Sequential)] public struct GUIOption // Note: Structure of this type must match C++ class GUIOption { /// /// Type of GUI element option. /// internal enum Type { FixedWidth, FlexibleWidth, FixedHeight, FlexibleHeight, Position } internal int min, max; internal Type type; /// /// Constructs a GUI option notifying the GUI layout that this element should be positioned at this offset from the /// parent GUI panel. This option is ignored if element is part of a layout since it controls its placement. /// /// Horizontal offset from the parent GUI panel origin, in pixels. /// Vertical offset from the parent GUI panel origin, in pixels. /// New option object that can be used for initializing a GUI element. public static GUIOption Position(int x, int y) { GUIOption option = new GUIOption(); option.min = x; option.max = y; option.type = Type.Position; return option; } /// /// Constructs a GUI option notifying the GUI layout that this element has a fixed width. This will override the width /// property set in element style. /// /// Width in pixels. /// New option object that can be used for initializing a GUI element. public static GUIOption FixedWidth(int width) { GUIOption option = new GUIOption(); option.min = option.max = width; option.type = Type.FixedWidth; return option; } /// /// Constructs a GUI option notifying the GUI layout that this element has a fixed height. This will override the height /// property set in element style. /// /// Height in pixels. /// New option object that can be used for initializing a GUI element. public static GUIOption FixedHeight(int height) { GUIOption option = new GUIOption(); option.min = option.max = height; option.type = Type.FixedHeight; return option; } /// /// Constructs a GUI option notifying the GUI layout that this element has a flexible width with optional min/max /// constraints. Element will be resized according to its contents and parent layout but will always stay within the /// provided range. /// /// Minimum width in pixels. Element will never be smaller than this width. /// Maximum width in pixels. Element will never be larger than this width. Specify zero for /// unlimited width. /// New option object that can be used for initializing a GUI element. public static GUIOption FlexibleWidth(int minWidth = 0, int maxWidth = 0) { GUIOption option = new GUIOption(); option.min = minWidth; option.max = maxWidth; option.type = Type.FlexibleWidth; return option; } /// /// Constructs a GUI option notifying the GUI layout that this element has a flexible height with optional min/max /// constraints. Element will be resized according to its contents and parent layout but will always stay within the /// provided range. /// /// Minimum height in pixels. Element will never be smaller than this height. /// Maximum height in pixels. Element will never be larger than this height. Specify zero for /// unlimited height. /// New option object that can be used for initializing a GUI element. public static GUIOption FlexibleHeight(int minHeight = 0, int maxHeight = 0) { GUIOption option = new GUIOption(); option.min = minHeight; option.max = maxHeight; option.type = Type.FlexibleHeight; return option; } } /** @} */ }