/// ****************************************************************************
/// @file   
/// @author Dr.Neeton
/// @date   2010/X/X - 2017/02/03
/// 
/// @brief  オーナーコンテナクラス。
/// 
/// ****************************************************************************

#include "CPL_GUC_Owner.h"


namespace CPL {
namespace GUC {


// _____________________________________________________________________________
/// @brief コンストラクタ（継承用）
/// 
/// @copydoc doxycomment::arg_in_sp_component_for_parent
/// @copydoc doxycomment::arg_in_position_for_component
/// @copydoc doxycomment::arg_in_size_for_component
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Owner::Owner
( _in<sdptr<Component>> in_sp_component_for_parent
, _in<float2          > in_position_for_component
, _in<float2          > in_size_for_component
) : Container
    ( in_sp_component_for_parent
    , in_position_for_component
    , in_size_for_component
    )
{
  m_sp_client_layer  = Factory<Layer>::Create( GetLinkMyself() );
  //m_sp_arrange_layer = Factory<Layer>::Create( GetLinkMyself() );

  zzf_setupDrawState( false, true, false ); // 描画ステートのデフォルト設定。  
  zzf_SetInitializedLevel( zzf_GetClassLevel() );

  SetBelongComponent( in_sp_component_for_parent, eParentType::Position );

  zzz_setFrameSize_( GetFrameSize() ); // クライアントレイヤー更新のため。
}


// _____________________________________________________________________________
/// @brief コピーコンストラクタ
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Owner::Owner( cref<td_self> in_owner )
  : td_base( in_owner )
  , m_sp_client_layer
    { FindComponentT_by_UserID<Layer>( in_owner.m_sp_client_layer )
    }
{
  m_sp_client_layer->SetAutoUserID();
}


// _____________________________________________________________________________
/// @copydoc CPL::GUC::Component::CreateClone
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sdptr<Component>
  Owner::CreateClone
    ( _in<sdptr<Component>> in_sp_component_for_parent
    , _in<float2          > in_offset_position_from_original
    ) const
{
  return
    zzz_CreateClone_Basic<td_self>
      ( in_sp_component_for_parent
      , in_offset_position_from_original
      );
}


} // namespace GUC
} // namespace CPL
