#include "btn_down_cdt.h"

#include <afxwin.h>

namespace roy {

    namespace ih {

        btn_down_cdt::btn_down_cdt(void)
        {
            _mk = -1;
            _init_down = false;
        }

        btn_down_cdt::btn_down_cdt(UINT mk, bool init_down)
        {
            _mk = mk;
            _init_down = init_down;
        }

        void btn_down_cdt::OnEntering(void)
        {
            _down = _init_down;
        }

		bool btn_down_cdt::OnLButtonDown(UINT nFlags, CPoint point)
		{
			_down = ((nFlags & _mk) != 0);

			return false;
		}

        bool btn_down_cdt::OnLButtonUp(UINT nFlags, CPoint point)
        {
            _down = ((nFlags & _mk) != 0);

            return false;
        }

        bool btn_down_cdt::OnLButtonDblClk(UINT nFlags, CPoint point)
        {
            _down = ((nFlags & _mk) != 0);

            return false;
        }

        bool btn_down_cdt::OnRButtonDown(UINT nFlags, CPoint point)
        {
            _down = ((nFlags & _mk) != 0);

            return false;
        }

        bool btn_down_cdt::OnRButtonUp(UINT nFlags, CPoint point)
        {
            _down = ((nFlags & _mk) != 0);

            return false;
        }

        bool btn_down_cdt::OnRButtonDblClk(UINT nFlags, CPoint point)
        {
            _down = ((nFlags & _mk) != 0);

            return false;
        }

        bool btn_down_cdt::OnMButtonDown(UINT nFlags, CPoint point)
        {
            _down = ((nFlags & _mk) != 0);

            return false;
        }

        bool btn_down_cdt::OnMButtonUp(UINT nFlags, CPoint point)
        {
            _down = ((nFlags & _mk) != 0);

            return false;
        }

        bool btn_down_cdt::OnMButtonDblClk(UINT nFlags, CPoint point)
        {
            _down = ((nFlags & _mk) != 0);

            return false;
        }

        bool btn_down_cdt::OnMouseMove(UINT nFlags, CPoint point)
        {
            _down = ((nFlags & _mk) != 0);

            return false;
        }

        bool btn_down_cdt::is_valid(void)
        {
            return _down;
        }
   }

}