/*--------------------------------------------------------------------------
  Project:  Manual 2D Library - m2d
  File:     page.h

  Copyright (C)2007-2009 Nintendo  All Rights Reserved.

  These coded instructions, statements, and computer programs contain
  proprietary information of Nintendo of America Inc. and/or Nintendo
  Company Ltd., and are protected by Federal copyright law. They may
  not be disclosed to third parties or copied or duplicated in any form,
  in whole or in part, without the prior written consent of Nintendo.

  $Revision: 1.41 $
 *-------------------------------------------------------------------------*/

#ifndef NTMV_M2D_PAGE_H_
#define NTMV_M2D_PAGE_H_

#if defined(__CWCC__)
#pragma once
#endif

#include <nnsys/fnd.h>
#include <ntmv/m2d/types.h>
#include <ntmv/m2d/textureList.h>

namespace ntmv
{
namespace m2d
{

class ObjectConstructor;
struct Rect;
class ResourceAccessor;
struct ResBlockSet;
class Pane;
class DrawInfo;

class Page
{
public:
                        Page();

    virtual void        Finalize(const ObjectConstructor& objectConstructor);

    bool                Init(
                            const ObjectConstructor&    objectConstructor,
                            const void*                 lytResBuf,
                            ResourceAccessor*           pResAcsr);

    void                Calc(const DrawInfo& drawInfo);

    void                Draw(const DrawInfo& drawInfo);

    void                ClearBuffer(const DrawInfo& drawInfo);

    Pane*               GetRootPane() const     { return mpRootPane; }

    const Size          GetPageSize() const     { return mPageSize; }

    const Rect          GetPageRect() const;

    GXRgb               GetBackColor() const        { return mBackColor; }

    const TextureList*  GetTextureList() const  { return &mTextureList; }

    const wchar_t*      GetPageHeader() const   { return mPageHeader; }

    s16                 GetPageHeightMin() const    { return mPageHeightMin; }

    void                SetPageHeightMin(s16 value) { mPageHeightMin = value; }

protected:
    Pane*               BuildPaneObj(
                            const ObjectConstructor&    objectConstructor,
                            s32                         kind,
                            const void*                 dataPtr,
                            const ResBlockSet&          resBlockSet);

    Pane*               mpRootPane;
    Size                mPageSize;
    GXRgb               mBackColor;
    const wchar_t*      mPageHeader;

    TextureList         mTextureList;
    s16                 mPageHeightMin;

private:
                        // Prohibit calling the copy constructor and assignment operator. This must not be implemented.
                        Page(const Page& other);
                        Page& operator = (const Page& other);
};

}   // namespace m2d
}   // namespace ntmv

/* NTMV_M2D_PAGE_H_ */
#endif
