1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - WM - demos - dataShare-Model
3   File:     menu.h
4 
5   Copyright 2006-2008 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   $Date:: 2008-09-18#$
14   $Rev: 8573 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef __MENU_H__
19 #define __MENU_H__
20 
21 #define ITEM_LENGTH_MAX (30)
22 #define ITEM_NUM_MAX    (20)
23 
24 enum
25 {
26     WIN_STATE_OPENING,
27     WIN_STATE_OPENED,
28     WIN_STATE_CLOSING,
29     WIN_STATE_CLOSED,
30     WIN_STATE_NUM
31 };
32 
33 enum
34 {
35     WIN_FLAG_NONE = 0,
36     WIN_FLAG_SELECTABLE = (1 << 0),
37     WIN_FLAG_NOCONTROL = (1 << 1),
38     WIN_FLAG_LAST = (1 << 8)
39 };
40 
41 typedef struct Window_
42 {
43     int     x, y;
44     int     width, height;
45     int     count;
46     int     itemnum;
47     int     lineheight;
48     int     leftmargin;
49     int     rightmargin;
50     int     selected;
51     int     state;
52     int     flag;
53     char    item[ITEM_NUM_MAX][ITEM_LENGTH_MAX];
54     struct Window_ *next;
55 }
56 Window;
57 
58 extern void initWindow(Window * win);
59 extern void setupWindow(Window * win,
60                         int x, int y, int flag, int lineheight, int leftmargin, int rightmargin);
61 extern void addItemToWindow(Window * win, const char *item);
62 extern void setItemToWindow(Window * win, const char *item, int index);
63 extern void drawWindow(Window * win);
64 extern int updateWindow(Window * win);
65 extern void openWindow(Window * win);
66 extern void closeWindow(Window * win);
67 extern int getWindowSelected(Window * win);
68 extern void drawAllWindow(void);
69 extern void updateAllWindow(void);
70 extern void closeAllWindow(void);
71 
72 #endif
73