1 /*---------------------------------------------------------------------------*
2 
3   Copyright (C) 2010-2012 Nintendo.  All rights reserved.
4 
5   These coded instructions, statements, and computer programs contain
6   proprietary information of Nintendo of America Inc. and/or Nintendo
7   Company Ltd., and are protected by Federal copyright law.  They may
8   not be disclosed to third parties or copied or duplicated in any form,
9   in whole or in part, without the prior written consent of Nintendo.
10 
11  *---------------------------------------------------------------------------*/
12 
13 #ifndef __DEMOWIN_SCROLL_BAR_H_
14 #define __DEMOWIN_SCROLL_BAR_H_
15 
16 struct ScrollBar : public MenuItem
17 {
18     ScrollBar(Window* window, CVec3 position, CVec2 size, float _count = 0, float _max = 10)
MenuItemScrollBar19         : MenuItem(window, position, size), pos(0), subHeight(size.y / 10), count(_count), max(_max), pPos(&pos) {}
20 
ScrollBarScrollBar21     ScrollBar(Window* window, CVec3 position, CVec2 size, float* _pPos, float _count, float _max)
22         : MenuItem(window, position, size), subHeight(size.y / 10), count(_count), max(_max), pPos(_pPos) {}
23 
ScrollBarScrollBar24     ScrollBar(const ScrollBar& copy)
25         : MenuItem(copy), pos(copy.pos), subHeight(copy.subHeight), count(copy.count), max(copy.max), pPos(copy.pPos) {if (copy.pPos == &copy.pos) {pPos = &pos;};}
26 
27     static ScrollBar* Add(const ScrollBar& item);
28 
29     bool Update();
30     void Draw();
31     void Reset();
32 
33     float pos;
34     float oldY;
35 
36     float subHeight;
37 
38     float oldPos;
39     bool wasMax;
40 
41     float count;
42     float max;
43 
44     float* pPos;
45 };
46 
47 const float SCROLLBAR_WIDTH = 0.05;
48 
49 #endif
50