using System;
using System.Text;
using System.Drawing;
using System.Runtime.InteropServices;

namespace ryControls.Win32API
{
    internal partial class User32
    {
        #region Struct        
        #region Tab Control Notification Structures

        //[StructLayout(LayoutKind.Sequential)]
        //internal struct NMHDR
        //{
        //    public IntPtr HWND;
        //    public uint idFrom;
        //    public int code;
            
        //    public override string ToString()
        //    {
        //        return String.Format("Hwnd: {0}, ControlID: {1}, Code: {2}", HWND, idFrom, code);
        //    }
        //}

        ///// <summary>
        ///// From MSDN, Contains information about a key press in a tab control. It is used with the TCN_KEYDOWN notification message. This structure supersedes the TC_KEYDOWN structure.
        ///// </summary>
        //[StructLayout(LayoutKind.Sequential)]
        //internal struct NMTCKEYDOWN
        //{
        //    /// <summary>
        //    /// NMHDR structure that contains information about the notification message. 
        //    /// </summary>
        //    public NMHDR hdr;
            
        //    /// <summary>
        //    /// Virtual key code.
        //    /// </summary>
        //    public VirtualKeys wVKey;
            
        //    /// <summary>
        //    /// Value that is identical to the lParam parameter of the WM_KEYDOWN message.
        //    /// </summary>
        //    public uint flags;

        //    public override string ToString()
        //    {
        //        return String.Format("NMHDR: [{0}], Key codes: [{1}], the lParam parameter of the WM_KEYDOWN: [{2}]", hdr, wVKey, flags);
        //    }
        //}

        #endregion

        [StructLayout(LayoutKind.Sequential)]
        internal struct TCHITTESTINFO
        {
            public Point pt;
            public TabControlHitTest flags;

            public TCHITTESTINFO(TabControlHitTest hitTest)
                : this()
            {
                flags = hitTest;
            }

            public TCHITTESTINFO(Point point, TabControlHitTest hitTest)
                : this(hitTest)
            {
                pt = point;
            }

            public TCHITTESTINFO(int x, int y, TabControlHitTest hitTest)
                : this(hitTest)
            {
                pt = new Point(x, y);
            }
        }
        
        #endregion

        #region UnmanagedMethods
        [DllImport("user32", CharSet = CharSet.Auto)]
        internal static extern int SendMessage(
            IntPtr hwnd,
            int tMsg,
            IntPtr wParam,
            ref TCHITTESTINFO lParam);
        #endregion
    }
}