/// ****************************************************************************
/// @file   
/// @author Dr.Neeton
/// @date   200X/X/X - 2014/03/10
/// 
/// @brief  Win32 テキストボックスコンポーネント。
/// 
/// ****************************************************************************

#pragma once

#include "CPL_WIN_Component.h"


namespace CPL {
namespace WIN {


// _____________________________________________________________________________
/// @brief テキストボックスクラス
///
// *****************************************************************************
class TextBox
  : protected Core::List::LingList<TextBox>
  , public Component
{
private:
  friend class Core::List::LingList<TextBox>;
  CPL_WIN_COMPONENT_GET_CLASS_NAME( "EDIT" );
  static HINSTANCE& zzf_RichLib(){ static HINSTANCE h = nullptr; return h; }

protected:
  static LRESULT CALLBACK
    zzf_StaticProcTextBox
      ( HWND   in_hdl_window
      , UINT   in_message
      , WPARAM in_wparam
      , LPARAM in_lparam
      );
  CPL_SINGLETON_INIT( WNDPROC, zzf_TEXTBOX_PROC, nullptr )
  int     zzf_StaticInitilize();

public:
  virtual void  SetTabNext( TextBox* in_ptr_comp )
  {
    AddNodeNext( in_ptr_comp );
  }
  virtual void  SetTabPrev( TextBox* in_ptr_comp )
  {
    AddNodePrev( in_ptr_comp );
  }
  virtual void  SetTabLink( TextBox* in_ptr_prev, TextBox* in_ptr_next )
  {
    AddNodePrev( in_ptr_prev );
    AddNodeNext( in_ptr_next );
  }
  virtual void
    GetText( str_ptr in_text, int in_size ) const
    {
      ::GetWindowText( m_hdl_window, in_text, in_size );
    }

  TextBox
  ( _in<HWND     > in_hdl_win_parent
  , _in<td_Coord2> in_pos
  , _in<td_Coord2> in_size
  , _in<LONG_PTR > in_win_style =
                WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | ES_AUTOHSCROLL
  );

  virtual ~TextBox();
};



} // namespace WIN
} // namespace CPL
