Ejemplo n.º 1
0
        public MyGuiControlTable() :
            base(canHaveFocus: true)
        {
            m_scrollBar = new MyVScrollbar(this);
            m_scrollBar.ValueChanged += verticalScrollBar_ValueChanged;
            m_rows            = new List <Row>();
            m_columnsMetaData = new List <ColumnMetaData>();
            VisualStyle       = MyGuiControlTableStyleEnum.Default;

            base.Name = "Table";
        }
Ejemplo n.º 2
0
        public MyTreeView(MyGuiControlTreeView control, Vector2 position, Vector2 size)
        {
            m_control = control;

            m_position = position;
            m_size     = size;

            m_body          = new MyTreeViewBody(this, position, size);
            m_vScrollbar    = new MyVScrollbar(control);
            m_hScrollbar    = new MyHScrollbar(control);
            m_scrollbarSize = new Vector2(MyGuiConstants.TREEVIEW_VSCROLLBAR_SIZE.X, MyGuiConstants.TREEVIEW_HSCROLLBAR_SIZE.Y);
        }
Ejemplo n.º 3
0
        public MyTreeView(MyGuiControlTreeView control, Vector2 position, Vector2 size)
        {
            m_control = control;

            m_position = position;
            m_size = size;

            m_body = new MyTreeViewBody(this, position, size);
            m_vScrollbar = new MyVScrollbar(control);
            m_hScrollbar = new MyHScrollbar(control);
            m_scrollbarSize = new Vector2(MyGuiConstants.TREEVIEW_VSCROLLBAR_SIZE.X, MyGuiConstants.TREEVIEW_HSCROLLBAR_SIZE.Y);
        }
Ejemplo n.º 4
0
        public MyGuiControlMultilineText(
            Vector2?position                = null,
            Vector2?size                    = null,
            Vector4?backgroundColor         = null,
            MyFontEnum font                 = MyFontEnum.Blue,
            float textScale                 = MyGuiConstants.DEFAULT_TEXT_SCALE,
            MyGuiDrawAlignEnum textAlign    = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
            StringBuilder contents          = null,
            bool drawScrollbar              = true,
            MyGuiDrawAlignEnum textBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            bool selectable                 = false)
            : base(position: position,
                   size: size,
                   colorMask: backgroundColor,
                   toolTip: null)
        {
            Font            = font;
            TextScale       = textScale;
            m_drawScrollbar = drawScrollbar;
            TextColor       = new Color(Vector4.One);
            TextBoxAlign    = textBoxAlign;
            m_selectable    = selectable;

            m_scrollbar     = new MyVScrollbar(this);
            m_scrollbarSize = new Vector2(0.0334f, MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE.Y);
            m_scrollbarSize = MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE;
            float minLineHeight = MyGuiManager.MeasureString(Font, m_lineHeightMeasure, TextScaleWithLanguage).Y;

            m_label           = new MyRichLabel(ComputeRichLabelWidth(), minLineHeight);
            m_label.TextAlign = textAlign;
            m_text            = new StringBuilder();
            m_selection       = new MyGuiControlMultilineSelection();

            if (contents != null && contents.Length > 0)
            {
                Text = contents;
            }

            m_keys = new MyMultilineKeyTimeController[11];
            m_keys[(int)MyMultilineTextKeys.UP]    = new MyMultilineKeyTimeController(Keys.Up);
            m_keys[(int)MyMultilineTextKeys.DOWN]  = new MyMultilineKeyTimeController(Keys.Down);
            m_keys[(int)MyMultilineTextKeys.LEFT]  = new MyMultilineKeyTimeController(Keys.Left);
            m_keys[(int)MyMultilineTextKeys.RIGHT] = new MyMultilineKeyTimeController(Keys.Right);

            m_keys[(int)MyMultilineTextKeys.C]      = new MyMultilineKeyTimeController(Keys.C);
            m_keys[(int)MyMultilineTextKeys.A]      = new MyMultilineKeyTimeController(Keys.A);
            m_keys[(int)MyMultilineTextKeys.V]      = new MyMultilineKeyTimeController(Keys.V);
            m_keys[(int)MyMultilineTextKeys.X]      = new MyMultilineKeyTimeController(Keys.X);
            m_keys[(int)MyMultilineTextKeys.HOME]   = new MyMultilineKeyTimeController(Keys.Home);
            m_keys[(int)MyMultilineTextKeys.END]    = new MyMultilineKeyTimeController(Keys.End);
            m_keys[(int)MyMultilineTextKeys.DELETE] = new MyMultilineKeyTimeController(Keys.Delete);
        }
Ejemplo n.º 5
0
        public MyGuiControlMultilineText(
            Vector2?position                        = null,
            Vector2?size                            = null,
            Vector4?backgroundColor                 = null,
            MyFontEnum font                         = MyFontEnum.Blue,
            float textScale                         = MyGuiConstants.DEFAULT_TEXT_SCALE,
            MyGuiDrawAlignEnum textAlign            = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
            StringBuilder contents                  = null,
            bool drawScrollbar                      = true,
            MyGuiDrawAlignEnum textBoxAlign         = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            int?visibleLinesCount                   = null,
            bool selectable                         = false,
            bool showTextShadow                     = false,
            MyGuiCompositeTexture backgroundTexture = null,
            MyGuiBorderThickness?textPadding        = null
            )
            : base(position: position,
                   size: size,
                   colorMask: backgroundColor,
                   toolTip: null,
                   backgroundTexture: backgroundTexture)
        {
            Font            = font;
            TextScale       = textScale;
            m_drawScrollbar = drawScrollbar;
            TextColor       = new Color(Vector4.One);
            TextBoxAlign    = textBoxAlign;
            m_selectable    = selectable;

            m_textPadding   = textPadding ?? new MyGuiBorderThickness(0, 0, 0, 0);
            m_scrollbar     = new MyVScrollbar(this);
            m_scrollbarSize = new Vector2(0.0334f, MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE.Y);
            m_scrollbarSize = MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE;
            float minLineHeight = MyGuiManager.MeasureString(Font, m_lineHeightMeasure, TextScaleWithLanguage).Y;

            m_label = new MyRichLabel(this, ComputeRichLabelWidth(), minLineHeight, visibleLinesCount)
            {
                ShowTextShadow = showTextShadow
            };
            m_label.AdjustingScissorRectangle += AdjustScissorRectangleLabel;
            m_label.TextAlign = textAlign;
            m_text            = new StringBuilder();
            m_selection       = new MyGuiControlMultilineSelection();

            if (contents != null && contents.Length > 0)
            {
                Text = contents;
            }

            m_keyThrottler = new MyKeyThrottler();
        }
Ejemplo n.º 6
0
        public MyGuiControlListbox(
            Vector2?position = null,
            MyGuiControlListboxStyleEnum visualStyle = MyGuiControlListboxStyleEnum.Default)
            : base(position : position,
                   isActiveControl : true,
                   canHaveFocus : true)
        {
            SetupStyles();
            m_scrollBar = new MyVScrollbar(this);
            m_scrollBar.ValueChanged += verticalScrollBar_ValueChanged;

            Items = new ObservableCollection <Item>();
            Items.CollectionChanged += Items_CollectionChanged;

            VisualStyle = visualStyle;

            Name = "Listbox";

            MultiSelect = true;
        }
        public MyGuiControlTable():
            base(canHaveFocus: true)
        {
            m_scrollBar = new MyVScrollbar(this);
            m_scrollBar.ValueChanged += verticalScrollBar_ValueChanged;
            m_rows = new List<Row>();
            m_columnsMetaData = new List<ColumnMetaData>();
            VisualStyle = MyGuiControlTableStyleEnum.Default;

            base.Name = "Table";
        }
        public MyGuiControlMultilineText(
            Vector2? position = null,
            Vector2? size = null,
            Vector4? backgroundColor = null,
            MyFontEnum font = MyFontEnum.Blue,
            float textScale = MyGuiConstants.DEFAULT_TEXT_SCALE,
            MyGuiDrawAlignEnum textAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
            StringBuilder contents = null,
            bool drawScrollbar = true,
            MyGuiDrawAlignEnum textBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            bool selectable = false)
            : base( position: position,
                    size: size,
                    colorMask: backgroundColor,
                    toolTip: null)
        {
            Font = font;
            TextScale = textScale;
            m_drawScrollbar = drawScrollbar;
            TextColor = new Color(Vector4.One);
            TextBoxAlign = textBoxAlign;
            m_selectable = selectable;

            m_scrollbar = new MyVScrollbar(this);
            m_scrollbarSize = new Vector2(0.0334f, MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE.Y);
            m_scrollbarSize = MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE;
            float minLineHeight = MyGuiManager.MeasureString(Font, m_lineHeightMeasure, TextScaleWithLanguage).Y;
            m_label = new MyRichLabel(ComputeRichLabelWidth(), minLineHeight);
            m_label.TextAlign = textAlign;
            m_text = new StringBuilder();
            m_selection = new MyGuiControlMultilineSelection();

            if (contents != null && contents.Length > 0)
                Text = contents;

            m_keys = new MyMultilineKeyTimeController[11];
            m_keys[(int)MyMultilineTextKeys.UP] = new MyMultilineKeyTimeController(Keys.Up);
            m_keys[(int)MyMultilineTextKeys.DOWN] = new MyMultilineKeyTimeController(Keys.Down);
            m_keys[(int)MyMultilineTextKeys.LEFT] = new MyMultilineKeyTimeController(Keys.Left);
            m_keys[(int)MyMultilineTextKeys.RIGHT] = new MyMultilineKeyTimeController(Keys.Right);
            
            m_keys[(int)MyMultilineTextKeys.C] = new MyMultilineKeyTimeController(Keys.C);
            m_keys[(int)MyMultilineTextKeys.A] = new MyMultilineKeyTimeController(Keys.A);
            m_keys[(int)MyMultilineTextKeys.V] = new MyMultilineKeyTimeController(Keys.V);
            m_keys[(int)MyMultilineTextKeys.X] = new MyMultilineKeyTimeController(Keys.X);
            m_keys[(int)MyMultilineTextKeys.HOME] = new MyMultilineKeyTimeController(Keys.Home);
            m_keys[(int)MyMultilineTextKeys.END] = new MyMultilineKeyTimeController(Keys.End);
            m_keys[(int)MyMultilineTextKeys.DELETE] = new MyMultilineKeyTimeController(Keys.Delete);
        }
        public MyGuiControlMultilineText(
            Vector2? position = null,
            Vector2? size = null,
            Vector4? backgroundColor = null,
            MyFontEnum font = MyFontEnum.Blue,
            float textScale = MyGuiConstants.DEFAULT_TEXT_SCALE,
            MyGuiDrawAlignEnum textAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
            StringBuilder contents = null,
            bool drawScrollbar = true,
            MyGuiDrawAlignEnum textBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            int? visibleLinesCount = null,
            bool selectable = false,
            bool showTextShadow = false
        )
            : base(position: position,
                    size: size,
                    colorMask: backgroundColor,
                    toolTip: null)
        {
            Font = font;
            TextScale = textScale;
            m_drawScrollbar = drawScrollbar;
            TextColor = new Color(Vector4.One);
            TextBoxAlign = textBoxAlign;
            m_selectable = selectable;

            m_scrollbar = new MyVScrollbar(this);
            m_scrollbarSize = new Vector2(0.0334f, MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE.Y);
            m_scrollbarSize = MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE;
            float minLineHeight = MyGuiManager.MeasureString(Font, m_lineHeightMeasure, TextScaleWithLanguage).Y;
            m_label = new MyRichLabel(this, ComputeRichLabelWidth(), minLineHeight, visibleLinesCount) { ShowTextShadow = showTextShadow };
            m_label.AdjustingScissorRectangle += AdjustScissorRectangleLabel;
            m_label.TextAlign = textAlign;
            m_text = new StringBuilder();
            m_selection = new MyGuiControlMultilineSelection();

            if (contents != null && contents.Length > 0)
                Text = contents;

            m_keyThrottler = new MyKeyThrottler();
        }
        public MyGuiControlListbox(
            Vector2? position = null,
            MyGuiControlListboxStyleEnum visualStyle = MyGuiControlListboxStyleEnum.Default)
            : base( position: position,
                    isActiveControl: true,
                    canHaveFocus: true)
        {
            SetupStyles();
            m_scrollBar = new MyVScrollbar(this);
            m_scrollBar.ValueChanged += verticalScrollBar_ValueChanged;

            Items = new ObservableCollection<Item>();
            Items.CollectionChanged += Items_CollectionChanged;

            VisualStyle = visualStyle;

            Name = "Listbox";

            MultiSelect = true;
        }