/*--------------------------------------------------------------------------
  Project:  Manual 2D Library - m2d
  File:     window.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.31 $
 *-------------------------------------------------------------------------*/

#ifndef NTMV_M2D_WINDOW_H_
#define NTMV_M2D_WINDOW_H_

#if defined(__CWCC__)
#pragma once
#endif

#include <ntmv/m2d/pane.h>
#include <ntmv/m2d/texMap.h>
#include <ntmv/m2d/Color.h>

namespace ntmv
{
namespace m2d
{

namespace detail
{

struct FrameSize
{
    ResS16      l;
    ResS16      r;
    ResS16      t;
    ResS16      b;
};

}   // namespace detail

class DrawInfo;
class AnimationLink;

class Window : public Pane
{
    typedef Pane Base;

    struct Content
    {
        GXRgba              color;
    };

    struct Frame
    {
                            Frame()
                            :   textureFlip(0)
                            {}

        void                Finalize(const ObjectConstructor& objectConstructor);

        TexMap              texMap;
        u8                  textureFlip;
    };

public:
    NTMV_RNT_RUNTIME_TYPEINFO;

                        Window(
                            const ObjectConstructor&    objectConstructor,
                            const res::Window*          pBlock,
                            const ResBlockSet&          resBlockSet);

    virtual void        Finalize(const ObjectConstructor& objectConstructor);

protected:
    virtual void        DrawSelf(const DrawInfo& drawInfo);

    virtual void        DrawContent(
                            const DrawInfo&             drawInfo,
                            const Point                 basePt,
                            const detail::FrameSize&    frameSize);
    virtual void        DrawFrame(
                            const DrawInfo&             drawInfo,
                            const Point                 basePt,
                            const Frame&                frame,
                            const detail::FrameSize&    frameSize);
    virtual void        DrawFrame4(
                            const DrawInfo&             drawInfo,
                            const Point                 basePt,
                            const Frame*                frames,
                            const detail::FrameSize&    frameSize);

    const detail::FrameSize
                        GetFrameSize(
                            u8              frameNum,
                            const Frame*    frames);

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

    void                InitFrame(
                            const ObjectConstructor&    objectConstructor,
                            u8                          frameNum);

protected:
    Content             mContent;
    Frame*              mFrames;

    u8                  mFrameNum;

};

}   // namespace m2d
}   // namespace ntmv

/* NTMV_M2D_WINDOW_H_ */
#endif

