﻿using System.Collections.Generic;
using SFML.Graphics;
using SFML.Window;

namespace GuiTestingCon
{
    public abstract class GuiObject
    {
        //Normal Object
        private System.Drawing.Rectangle _RectPosition = new System.Drawing.Rectangle();
        private Vector2 _VectPosition = new Vector2();
        private ScreenObject _Screen;
        private ScreenManager _ScreenManager;
        private Dictionary<string, Image> Images = new Dictionary<string, Image>();
        private Sprite _Sprite;
        private bool _IsVisisble = true;
        private bool _CanUse;
        private bool _drag = false;
        private string name = null;

        public virtual void Draw() { }

        public ScreenObject Screen
        {
            get { return _Screen; }
            set
            {
                _Screen = value;
                _ScreenManager = _Screen.Screen;
            }
        }

        public Sprite _sprite
        {
            get { return _Sprite; }
            set
            {
                _Sprite = value;
            }
        }

        public Dictionary<string, Image> _Images
        {
            get { return Images; }
        }

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public ScreenManager Manager
        {
            get { return _ScreenManager; }
        }

        public System.Drawing.Rectangle ScreenRect
        {
            get
            {
                if (_Screen != null)
                {
                    System.Drawing.Rectangle r = _RectPosition;
                    r.X = (int)Position.X + (int)_Screen.Position.X;
                    r.Y = (int)Position.Y + (int)_Screen.Position.Y;
                    return r;
                }
                else
                {
                    return _RectPosition;
                }
            }
            set
            {
                _RectPosition = value;
                _VectPosition.X = value.X;
                _VectPosition.Y = value.Y;
            }
        }

        public Vector2 Position
        {
            get { return _VectPosition; }
            set
            {
                _VectPosition = value;
                _RectPosition.X = (int)value.X;
                _RectPosition.Y = (int)value.Y;
            }
        }

        public float PositionY
        {
            get { return _VectPosition.Y; }
            set
            {
                _VectPosition.Y = value;
                _RectPosition.Y = (int)value;
            }
        }

        public float PositionX
        {
            get { return _VectPosition.X; }
            set
            {
                _VectPosition.X = value;
                _RectPosition.X = (int)value;
            }
        }

        public bool Visible
        {
            get { return _IsVisisble; }
            set { _IsVisisble = value; }
        }

        public bool Drag
        {
            get { return _drag; }
            set { _drag = value; }
        }

        public bool CanUse
        {
            get { return _CanUse; }
            set { _CanUse = value; }
        }

        public virtual void KeyReleased(object sender, KeyEventArgs e) { }

        public virtual void KeyPressed(object sender, KeyEventArgs e) { }

        public virtual void MouseButtonReleased(object sender, MouseButtonEventArgs e) { }

        public virtual void MouseButtonPressed(object sender, MouseButtonEventArgs e) { }

        public virtual void MouseButtonPressedOther(object sender, MouseButtonEventArgs e) { }

        public virtual void TextEntered(object sender, TextEventArgs e) { }

        public virtual void MouseWheelMoved(object sender, MouseWheelEventArgs e) { }
    }
}