/*---------------------------------------------------------------------------* Project: WiiConnect24 API demos File: MsgViewer.h Copyright 2006 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. $Log: MsgViewer.h,v $ Revision 1.3 2008/05/01 08:49:38 hirose_kazuki Added "Close library" mode. Revision 1.2 2008/04/28 11:19:22 hirose_kazuki Updated framework. Revision 1.1 2006/09/27 08:59:01 torigoe_nobutaka Renamed from MessageViewer.h Revision 1.2 2006/09/27 07:30:27 torigoe_nobutaka Added definition of MsgData structure. Added GetListedSubjects() and ReleaseListedSubjects(). Changed value of some constants. Revision 1.1 2006/08/28 08:51:50 torigoe_nobutaka Initial check in. $NoKeywords: $ *---------------------------------------------------------------------------*/ #ifndef __DEMOS_NWC24DEMO_MSG_VIEWER_H__ #define __DEMOS_NWC24DEMO_MSG_VIEWER_H__ #include #include #define NUM_MSG_BOX_MENUS 4 #define FONT_SIZE 16 #define LIST_BOX_ROWS 5 #define TEXT_BOX_ROWS 5 #define LEN_SUBJECT_DISP 32 #ifdef __cplusplus extern "C" { #endif /*===========================================================================*/ /*---------------------------------------------------------------------------* Type definitions *---------------------------------------------------------------------------*/ /* Menu Items */ typedef enum MsgBoxMenu { MB_MENU_RECV_BOX, // Inbox MB_MENU_SEND_BOX, // Outbox MB_MENU_RECV_MSG, // Receive message MB_MENU_POST_MSG // Send message } MsgBoxMenu; /* Type of message box */ #define NUM_MSG_BOX_TYPES 2 typedef enum MsgBoxType { MB_TYPE_RECV = 0, // Inbox MB_TYPE_SEND = 1 // Outbox } MsgBoxType; /* Application status */ typedef enum MsgBoxState { MB_STATE_MENU, // Menu selection MB_STATE_RECV_BOX, // Select received message MB_STATE_SEND_BOX, // Select sent message MB_STATE_MSG_CONTENT, // View message contents MB_STATE_DELETE_MSG, // Delete message MB_STATE_BEFORE_RECV_MSG, // Before receiving message MB_STATE_BEFORE_POST_MSG, // Before sending message MB_STATE_DONE_RECV_MSG, // After receiving message MB_STATE_DONE_POST_MSG, // After sending message MB_STATE_LIB_CLOSED, // The library is closed MB_STATE_WAIT_OPEN, // Waiting for the library to open MB_STATE_ERROR_CONT, // Error display (continuous) MB_STATE_ERROR_STOP // error display } MsgBoxState; #define MAX_ADDR_SIZE NWC24MSG_MAX_ADDRSTR #define MAX_NUM_TO NWC24MSG_MAX_TO #define MAX_SUBJECT_SIZE 256 #define MAX_TEXT_SIZE 4096 typedef struct MsgData { NWC24MsgType type; char from[MAX_ADDR_SIZE]; u32 numTo; char to[MAX_NUM_TO][MAX_ADDR_SIZE]; char subject[MAX_SUBJECT_SIZE]; char text[NWC24MSG_MAX_BODYSIZE]; } MsgData; /*---------------------------------------------------------------------------* External constants *---------------------------------------------------------------------------*/ extern const GXColor CLR_DARKBLUE; extern const GXColor CLR_WHITE; extern const char* HIDDEN_MESSAGE; extern const char* BROKEN_MESSAGE; /*---------------------------------------------------------------------------* External variables *---------------------------------------------------------------------------*/ extern s16 g_screenWidth; extern s16 g_screenHeight; extern OSFontHeader* g_fontData; extern MsgBoxState g_state; extern MsgBoxMenu g_selectedMenu; extern u32* g_idListBuf[NUM_MSG_BOX_TYPES]; extern u32 g_numMsgs[NUM_MSG_BOX_TYPES]; extern u32 g_idxSelectedId[]; extern u32 g_idxIdTopOfList[]; extern u32 g_lineTopOfBodyText; extern u32 g_numLinesBodyText; extern char* g_subjectBuf[NUM_MSG_BOX_TYPES][LIST_BOX_ROWS]; extern u32 g_idxSubjectBufStart[NUM_MSG_BOX_TYPES]; extern MsgData g_msgData; extern s32 g_errorCode; /*---------------------------------------------------------------------------* Function prototypes *---------------------------------------------------------------------------*/ void CheckError ( const char* strFunc, NWC24Err err ); void GetMsgIdList ( NWC24MsgBoxId mBoxId ); void ReleaseMsgIdList ( NWC24MsgBoxId mBoxId ); BOOL ReadSubject ( char* buf, u32 size, NWC24MsgBoxId mBoxId, u32 msgId ); void GetListedSubjects ( NWC24MsgBoxId mBoxId ); void ReleaseListedSubjects( NWC24MsgBoxId mBoxId ); BOOL OpenLib ( void ); BOOL CloseLib ( void ); /*===========================================================================*/ #ifdef __cplusplus } #endif #endif /* __DEMOS_NWC24DEMO_MSG_VIEWER_H__ */ /*======== End of MsgViewer.h ========*/