Base control class.
Inheritance: IDisposable
Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CheckBox"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public CheckBox(Control parent)
     : base(parent)
 {
     SetSize(15, 15);
     //m_Checked = true; // [omeg] why?!
     //Toggle();
 }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MenuStrip"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public MenuStrip(Control parent)
     : base(parent)
 {
     SetBounds(0, 0, 200, 22);
     Dock = Pos.Top;
     m_InnerPanel.Padding = new Padding(5, 0, 0, 0);
 }
Esempio n. 3
0
 //private bool m_DrawCheckers;
 /// <summary>
 /// Initializes a new instance of the <see cref="ColorDisplay"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public ColorDisplay(Control parent)
     : base(parent)
 {
     SetSize(32, 32);
     m_Color = new Color(255, 0, 0, 255);
     //m_DrawCheckers = true;
 }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NumericUpDown"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public NumericUpDown(Control parent)
            : base(parent)
        {
            SetSize(100, 20);

            m_Splitter = new Splitter(this);
            m_Splitter.Dock = Pos.Right;
            m_Splitter.SetSize(13, 13);

            m_Up = new UpDownButton_Up(m_Splitter);
            m_Up.Clicked += OnButtonUp;
            m_Up.IsTabable = false;
            m_Splitter.SetPanel(0, m_Up, false);

            m_Down = new UpDownButton_Down(m_Splitter);
            m_Down.Clicked += OnButtonDown;
            m_Down.IsTabable = false;
            m_Down.Padding = new Padding(0, 1, 1, 0);
            m_Splitter.SetPanel(1, m_Down, false);

            m_Max = 100;
            m_Min = 0;
            m_Value = 0f;
            Text = "0";
        }
Esempio n. 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Control"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public Control(Control parent)
        {
            m_Children = new List<Control>();
            m_Accelerators = new Dictionary<string, GwenEventHandler>();

            Parent = parent;

            m_Hidden = false;
            m_Bounds = new Rectangle(0, 0, 10, 10);
            m_Padding = Padding.Zero;
            m_Margin = Margin.Zero;

            RestrictToParent = false;

            MouseInputEnabled = true;
            KeyboardInputEnabled = false;

            Invalidate();
            Cursor = Cursors.Default;
            //ToolTip = null;
            IsTabable = false;
            ShouldDrawBackground = true;
            m_Disabled = false;
            m_CacheTextureDirty = true;
            m_CacheToTexture = false;

            BoundsOutlineColor = Color.Red;
            MarginOutlineColor = Color.Green;
            PaddingOutlineColor = Color.Blue;
        }
Esempio n. 6
0
 /// <summary>
 /// Disables tooltip display for the specified control.
 /// </summary>
 /// <param name="control">Target control.</param>
 public static void Disable(Control control)
 {
     if (g_ToolTip == control)
     {
         g_ToolTip = null;
     }
 }
Esempio n. 7
0
        /// <summary>
        /// Enables tooltip display for the specified control.
        /// </summary>
        /// <param name="control">Target control.</param>
        public static void Enable(Control control)
        {
            if (null == control.ToolTip)
                return;

            g_ToolTip = control;
        }
Esempio n. 8
0
 //private bool m_DrawCheckers;
 /// <summary>
 /// Initializes a new instance of the <see cref="ColorDisplay"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public ColorDisplay(Control parent)
     : base(parent)
 {
     SetSize(32, 32);
     m_Color = Color.FromArgb(255, 255, 0, 0);
     //m_DrawCheckers = true;
 }
Esempio n. 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ColorSlider"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public ColorSlider(Control parent)
     : base(parent)
 {
     SetSize(32, 128);
     MouseInputEnabled = true;
     m_Depressed = false;
 }
Esempio n. 10
0
        private int m_ZoomedSection; // 0-3

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="CrossSplitter"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public CrossSplitter(Control parent)
            : base(parent)
        {
            m_Sections = new Control[4];

            m_VSplitter = new SplitterBar(this);
            m_VSplitter.SetPosition(0, 128);
            m_VSplitter.Dragged += OnVerticalMoved;
            m_VSplitter.Cursor = Cursors.SizeNS;

            m_HSplitter = new SplitterBar(this);
            m_HSplitter.SetPosition(128, 0);
            m_HSplitter.Dragged += OnHorizontalMoved;
            m_HSplitter.Cursor = Cursors.SizeWE;

            m_CSplitter = new SplitterBar(this);
            m_CSplitter.SetPosition(128, 128);
            m_CSplitter.Dragged += OnCenterMoved;
            m_CSplitter.Cursor = Cursors.SizeAll;

            m_HVal = 0.5f;
            m_VVal = 0.5f;

            SetPanel(0, null);
            SetPanel(1, null);
            SetPanel(2, null);
            SetPanel(3, null);

            SplitterSize = 5;
            SplittersVisible = false;

            m_ZoomedSection = -1;
        }
Esempio n. 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TabControl"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public TabControl(Control parent)
            : base(parent)
        {
            m_Scroll = new ScrollBarButton[2];
            m_ScrollOffset = 0;

            m_TabStrip = new TabStrip(this);
            m_TabStrip.StripPosition = Pos.Top;

            // Make this some special control?
            m_Scroll[0] = new ScrollBarButton(this);
            m_Scroll[0].SetDirectionLeft();
            m_Scroll[0].Clicked += ScrollPressedLeft;
            m_Scroll[0].SetSize(14, 16);

            m_Scroll[1] = new ScrollBarButton(this);
            m_Scroll[1].SetDirectionRight();
            m_Scroll[1].Clicked += ScrollPressedRight;
            m_Scroll[1].SetSize(14, 16);

            m_InnerPanel = new TabControlInner(this);
            m_InnerPanel.Dock = Pos.Fill;
            m_InnerPanel.SendToBack();

            IsTabable = false;
        }
Esempio n. 12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScrollControl"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public ScrollControl(Control parent)
            : base(parent)
        {
            MouseInputEnabled = false;

            m_VerticalScrollBar = new VerticalScrollBar(this);
            m_VerticalScrollBar.Dock = Pos.Right;
            m_VerticalScrollBar.BarMoved += VBarMoved;
            m_CanScrollV = true;
            m_VerticalScrollBar.NudgeAmount = 30;

            m_HorizontalScrollBar = new HorizontalScrollBar(this);
            m_HorizontalScrollBar.Dock = Pos.Bottom;
            m_HorizontalScrollBar.BarMoved += HBarMoved;
            m_CanScrollH = true;
            m_HorizontalScrollBar.NudgeAmount = 30;

            m_InnerPanel = new Control(this);
            m_InnerPanel.SetPosition(0, 0);
            m_InnerPanel.Margin = Margin.Five;
            m_InnerPanel.SendToBack();
            m_InnerPanel.MouseInputEnabled = false;

            m_AutoHideBars = false;
        }
Esempio n. 13
0
 public TextView(Control parent, TextDocument textDocument)
     : base(parent)
 {
     Dock = Pos.Fill;
     TextLayer = new TextLayer(this, textDocument);
     CarretLayer = new CarretLayer(this);
 }
Esempio n. 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RadioButton"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public RadioButton(Control parent)
     : base(parent)
 {
     SetSize(15, 15);
     MouseInputEnabled = true;
     IsTabable = false;
 }
Esempio n. 15
0
 public static void Add(Control control, Animation animation)
 {
     animation.m_Control = control;
     if (!m_Animations.ContainsKey(control))
         m_Animations[control] = new List<Animation>();
     m_Animations[control].Add(animation);
 }
Esempio n. 16
0
        /// <summary>
        /// Moves the control to the right of its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void AlignRight(Control control)
        {
            Control parent = control.Parent;
            if (null == parent) return;

            control.SetPosition(parent.Width - control.Width - parent.Padding.Right, control.Y);
        }
Esempio n. 17
0
        /// <summary>
        /// Centers the control horizontally inside its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void CenterHorizontally(Control control)
        {
            Control parent = control.Parent;
            if (null == parent) return;

            control.SetPosition(parent.Padding.Left + (((parent.Width - parent.Padding.Left - parent.Padding.Right) - control.Width) / 2), control.Y);
        }
Esempio n. 18
0
        /// <summary>
        /// Moves the control to the left of its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void AlignLeft(Control control)
        {
            Control parent = control.Parent;
            if (null == parent) return;

            control.SetPosition(parent.Padding.Left, control.Y);
        }
Esempio n. 19
0
        /// <summary>
        /// Moves the control to the bottom of its parent.
        /// </summary>
        /// <param name="control"></param>
        public static void AlignBottom(Control control)
        {
            Control parent = control.Parent;
            if (null == parent) return;

            control.SetPosition(control.X, parent.Height - control.Height);
        }
Esempio n. 20
0
 /// <summary>
 /// Control constructor.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public Button(Control parent)
     : base(parent)
 {
     SetSize(100, 20);
     MouseInputEnabled = true;
     Alignment = Pos.Center;
     TextPadding = new Padding(3, 3, 3, 3);
 }
Esempio n. 21
0
        public PaneGroup(Control parent)
            : base(parent)
        {
            if(PaneManager.FocusedPaneGroup==null)
                PaneManager.FocusedPaneGroup = this;

            AllowReorder = true;
        }
Esempio n. 22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TreeNodeLabel"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public TreeNodeLabel(Control parent)
     : base(parent)
 {
     Alignment = Pos.Left | Pos.CenterV;
     ShouldDrawBackground = false;
     Height = 16;
     TextPadding = new Padding(3, 0, 3, 0);
 }
Esempio n. 23
0
        internal bool m_Alt; // for alternate coloring

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="CategoryButton"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public CategoryButton(Control parent)
            : base(parent)
        {
            Alignment = Pos.Left | Pos.CenterV;
            m_Alt = false;
            IsToggle = true;
            TextPadding = new Padding(3, 0, 3, 0);
        }
Esempio n. 24
0
 public static void Cancel(Control control)
 {
     if (m_Animations.ContainsKey(control))
     {
         m_Animations[control].Clear();
         m_Animations.Remove(control);
     }
 }
Esempio n. 25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CheckBox"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public CheckBox(Control parent)
     : base(parent)
 {
     AutoSizeToContents = false;
     SetSize(15, 15);
     //m_Checked = true; // [omeg] why?!
     //Toggle();
 }
Esempio n. 26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CategoryHeaderButton"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public CategoryHeaderButton(Control parent)
     : base(parent)
 {
     ShouldDrawBackground = false;
     IsToggle = true;
     Alignment = Pos.Center;
     TextPadding = new Padding(3, 0, 3, 0);
 }
Esempio n. 27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RadioButtonGroup"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 /// <param name="label">Label for the outlining GroupBox.</param>
 public RadioButtonGroup(Control parent, String label)
     : base(parent)
 {
     IsTabable = false;
     KeyboardInputEnabled = true;
     Text = label;
     AutoSizeToContents = true;
 }
Esempio n. 28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Modal"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public Modal(Control parent)
     : base(parent)
 {
     KeyboardInputEnabled = true;
     MouseInputEnabled = true;
     ShouldDrawBackground = true;
     SetBounds(0, 0, GetCanvas().Width, GetCanvas().Height);
 }
Esempio n. 29
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ColorPicker"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public ColorPicker(Control parent)
            : base(parent)
        {
            MouseInputEnabled = true;

            SetSize(256, 150);
            CreateControls();
            SelectedColor = Color.FromArgb(255, 50, 60, 70);
        }
Esempio n. 30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImagePanel"/> class.
 /// </summary>
 /// <param name="parent">Parent control.</param>
 public ImagePanel(Control parent)
     : base(parent)
 {
     m_uv = new float[4];
     m_Texture = new Texture(Skin.Renderer);
     SetUV(0, 0, 1, 1);
     MouseInputEnabled = false;
     m_DrawColor = Color.White;
 }