xref: /haiku/src/apps/pairs/PairsView.h (revision 508f54795f39c3e7552d87c95aae9dd8ec6f505b)
1 /*
2  * Copyright 2008 Ralf Schülke, ralf.schuelke@googlemail.com.
3  * Copyright 2010 Adam Smith <adamd.smith@utoronto.ca>
4  * All rights reserved. Distributed under the terms of the MIT License.
5  */
6 #ifndef PAIRS_VIEW_H
7 #define PAIRS_VIEW_H
8 
9 
10 #include <View.h>
11 
12 
13 class TopButton;
14 
15 class PairsView : public BView {
16 public:
17 								PairsView(BRect frame, const char* name,
18 									int width, int height,
19 									uint32 resizingMode);
20 
21 	virtual						~PairsView();
22 	virtual	void				AttachedToWindow();
23 	virtual	void				Draw(BRect updateRect);
24 	virtual	void				CreateGameBoard();
25 
26 			int 				fWidth;
27 			int					fHeight;
28 			int					fNumOfCards;
29 
30 			BList				fDeckCard;
31 			int					GetIconFromPos(int pos);
32 
33 private:
34 			void				_SetPairsBoard();
35 			void				_ReadRandomIcons();
36 			void				_GenerateCardPos();
37 			bool				_HasBitmap(BList& bitmaps, BBitmap* bitmap);
38 
39 			BMessage*			fButtonMessage;
40 			BList				fCardBitmaps;
41 			int*				fRandPos;
42 			int*				fPosX;
43 			int*				fPosY;
44 };
45 
46 
47 #endif	// PAIRS_VIEW_H
48