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

#ifndef NTMV_M2D_SCROLLBUTTON_H_
#define NTMV_M2D_SCROLLBUTTON_H_

#if _MSC_VER > 1000 || defined(__CWCC__)
#pragma once
#endif

#include <ntmv/m2d/uiPanel.h>

namespace ntmv
{
namespace m2d
{

/*
    Event types for the scroll button
*/
enum
{
    SCROLLBUTTON_EVENTTYPE_NONE,       // No event
    SCROLLBUTTON_EVENTTYPE_SCROLL,     // Scroll up or down

    SCROLLBUTTON_EVENTTYPE_MAX
};

struct TouchPanelData;

/*
    Structure that stores the results of processing Touch Panel actions for the scroll buttons
*/
struct ScrollButtonResult
{
    u16                 eventType;

    bool                bScrollUp;
    bool                bScrollDown;
};

/*
    Scroll button class
*/
class ScrollButton : public UIPanel
{
    typedef UIPanel Base;

public:
    enum
    {
        BUTTON_DOWN,
        BUTTON_UP,

        UI_MAX
    };

                        ScrollButton();

    void                Init(
                            const ObjectConstructor&    objectConstructor,
                            ObjManager*                 pObjManager,
                            Point                       position,
                            s16                         viewHeight);

    bool                TestTouchPanel(
                            ScrollButtonResult*     pScrollButtonResult,
                            const TouchPanelData&   tpData);

    s16                 GetContentHeight() const            { return mContentHeight; }

    void                SetContentHeight(s16 contentHeight) { mContentHeight = contentHeight; }

    void                SetButtonState(
                            bool    bUpPointed,
                            bool    bDownPointed);

    void                Update(
                            s16     viewY);

    void                Animate();

private:

    s16                 mPointedUIIdx;
    s16                 mContentHeight;
    s16                 mViewHeight;
    s16                 mViewY;
};

}   // namespace m2d
}   // namespace ntmv

/* NTMV_M2D_SCROLLBUTTON_H_ */
#endif
