/*---------------------------------------------------------------------------* Project: Horizon File: TenKey.h Copyright (C)2009-2012 Nintendo Co., Ltd. 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. $Rev: 46365 $ *---------------------------------------------------------------------------*/ #ifndef NN_COMMON_SCENE_TENKEY_H_ #define NN_COMMON_SCENE_TENKEY_H_ #include #include #include "GuiControlManager.h" namespace scene { class TenKey { public: enum State { STATE_NORMAL, // Normal STATE_OK, // OK STATE_CANCELLED, // Cancel. STATE_MAX }; public: /* Please see man pages for details */ TenKey(); /* Please see man pages for details */ virtual ~TenKey(); /* Please see man pages for details */ void Initialize(u32 length, u32 split = 0, const wchar_t* pInitial = NULL, u32 numLowestChars = 1, bool isPassword = false); /* Please see man pages for details */ void Finalize(); /* Please see man pages for details */ void Update(); /* Please see man pages for details */ void Draw(); /* Please see man pages for details */ void Reset(const wchar_t* pInitial = NULL); /* Please see man pages for details */ void SetState(State state) {m_state = state;} /* Please see man pages for details */ bool IsOK() const {return (m_state == STATE_OK);} /* Please see man pages for details */ bool IsCancelled() const {return (m_state == STATE_CANCELLED);} /* Please see man pages for details */ const wchar_t* GetInput() const {return m_pInput;} /* Please see man pages for details */ u32 GetInputInteger() const; /* Please see man pages for details */ u32 GetCursor() const {return m_cursor;} protected: // Event callback static void MyControlEventCallback(scene::ControlEvent event, scene::ControlBase* pControl, s16 x, s16 y, void* pParam); protected: // vtable 4byte exists in this position (keep in mind when adjusting padding) // Input characters wchar_t* m_pInput; // Number of characters u32 m_length; // Separation position u32 m_split; // Minimum number of characters u32 m_numLowestChars; // cursor position u32 m_cursor; // Status nn::util::SizedEnum4 m_state; // Password? bool m_isPassword; NN_PADDING3; // GUI manager scene::ControlManager m_controlManager; }; } // namespace scene #endif // NN_COMMON_SCENE_TENKEY_H_