1 /*---------------------------------------------------------------------------* 2 Project: WiiConnect24 API demos 3 File: MsgViewer.h 4 5 Copyright 2006 Nintendo. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Log: MsgViewer.h,v $ 14 Revision 1.1 2006/09/27 08:59:01 torigoe_nobutaka 15 Renamed from MessageViewer.h 16 17 Revision 1.2 2006/09/27 07:30:27 torigoe_nobutaka 18 Added definition of MsgData structure. 19 Added GetListedSubjects() and ReleaseListedSubjects(). 20 Changed value of some constants. 21 22 Revision 1.1 2006/08/28 08:51:50 torigoe_nobutaka 23 Initial check in. 24 25 26 $NoKeywords: $ 27 *---------------------------------------------------------------------------*/ 28 29 #ifndef __DEMOS_NWC24DEMO_MSG_VIEWER_H__ 30 #define __DEMOS_NWC24DEMO_MSG_VIEWER_H__ 31 32 #include <revolution/types.h> 33 #include <revolution/nwc24/NWC24Types.h> 34 35 #define NUM_MSG_BOX_MENUS 4 36 #define FONT_SIZE 16 37 #define LIST_BOX_ROWS 5 38 #define TEXT_BOX_ROWS 5 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 /*===========================================================================*/ 44 45 /*---------------------------------------------------------------------------* 46 Type definitions 47 *---------------------------------------------------------------------------*/ 48 /* Menu Items */ 49 typedef enum MsgBoxMenu 50 { 51 MB_MENU_RECV_BOX, // Inbox 52 MB_MENU_SEND_BOX, // Outbox 53 MB_MENU_RECV_MSG, // Receive message 54 MB_MENU_POST_MSG // Post message 55 } MsgBoxMenu; 56 57 /* Type of message box */ 58 #define NUM_MSG_BOX_TYPES 2 59 typedef enum MsgBoxType 60 { 61 MB_TYPE_RECV = 0, // Inbox 62 MB_TYPE_SEND = 1 // Outbox 63 } MsgBoxType; 64 65 /* Application status */ 66 typedef enum MsgBoxState 67 { 68 MB_STATE_MENU, // Menu selection 69 MB_STATE_RECV_BOX, // Select received message 70 MB_STATE_SEND_BOX, // Select sent message 71 MB_STATE_MSG_CONTENT, // View message contents 72 MB_STATE_DELETE_MSG, // Delete message 73 MB_STATE_BEFORE_RECV_MSG, // Before receiving message 74 MB_STATE_BEFORE_POST_MSG, // Before sending message 75 MB_STATE_DONE_RECV_MSG, // After receiving message 76 MB_STATE_DONE_POST_MSG // After sending message 77 } MsgBoxState; 78 79 #define MAX_ADDR_SIZE NWC24MSG_MAX_ADDRSTR 80 #define MAX_NUM_TO NWC24MSG_MAX_TO 81 #define MAX_SUBJECT_SIZE 256 82 #define MAX_TEXT_SIZE 4096 83 typedef struct MsgData 84 { 85 NWC24MsgType type; 86 char from[MAX_ADDR_SIZE]; 87 u32 numTo; 88 char to[MAX_NUM_TO][MAX_ADDR_SIZE]; 89 char subject[MAX_SUBJECT_SIZE]; 90 char text[NWC24MSG_MAX_BODYSIZE]; 91 } MsgData; 92 93 /*---------------------------------------------------------------------------* 94 External constants 95 *---------------------------------------------------------------------------*/ 96 extern const GXColor CLR_DARKBLUE; 97 extern const GXColor CLR_WHITE; 98 extern const GXColor CLR_YELLOW; 99 extern const char* HIDDEN_MESSAGE; 100 101 /*---------------------------------------------------------------------------* 102 External variables 103 *---------------------------------------------------------------------------*/ 104 extern s16 g_screenWidth; 105 extern s16 g_screenHeight; 106 extern OSFontHeader* g_fontData; 107 extern u32 g_longHold; 108 extern MsgBoxState g_state; 109 extern MsgBoxMenu g_selectedMenu; 110 extern u32* g_idListBuf[NUM_MSG_BOX_TYPES]; 111 extern u32 g_numMsgs[NUM_MSG_BOX_TYPES]; 112 extern u32 g_idxSelectedId[]; 113 extern u32 g_idxIdTopOfList[]; 114 extern u32 g_lineTopOfBodyText; 115 extern u32 g_numLinesBodyText; 116 extern char* g_subjectBuf[NUM_MSG_BOX_TYPES][LIST_BOX_ROWS]; 117 extern u32 g_idxSubjectBufStart[NUM_MSG_BOX_TYPES]; 118 extern MsgData g_msgData; 119 120 /*---------------------------------------------------------------------------* 121 Function prototypes 122 *---------------------------------------------------------------------------*/ 123 void CheckError ( const char* strFunc, NWC24Err err ); 124 void GetMsgIdList ( NWC24MsgBoxId mBoxId ); 125 void ReleaseMsgIdList ( NWC24MsgBoxId mBoxId ); 126 void GetListedSubjects ( NWC24MsgBoxId mBoxId ); 127 void ReleaseListedSubjects( NWC24MsgBoxId mBoxId ); 128 129 /*===========================================================================*/ 130 #ifdef __cplusplus 131 } 132 #endif 133 #endif /* __DEMOS_NWC24DEMO_MSG_VIEWER_H__ */ 134 135 /*======== End of MsgViewer.h ========*/ 136