2 * Copyright 2008 Ralf Schülke, ralf.schuelke@googlemail.com.
3 * Copyright 2010 Adam Smith <adamd.smith@utoronto.ca>
4 * Copyright 2014 Haiku, Inc. All rights reserved.
6 * Distributed under the terms of the MIT License.
9 * Ralf Schülke, ralf.schuelke@googlemail.com
10 * John Scipione, jscipione@gmail.com
11 * Adam Smith, adamd.smith@utoronto.ca
17 #include <ObjectList.h>
21 const uint8 kSmallIconSize
= 32;
22 const uint8 kMediumIconSize
= 64;
23 const uint8 kLargeIconSize
= 128;
25 const uint32 kMsgCardButton
= 'card';
32 class PairsView
: public BView
{
34 PairsView(BRect frame
, const char* name
,
35 uint8 rows
, uint8 cols
, uint8 iconSize
);
38 virtual void AttachedToWindow();
39 virtual void Draw(BRect updateRect
);
40 virtual void FrameResized(float newWidth
, float newHeight
);
42 virtual void CreateGameBoard();
44 int32
Rows() const { return fRows
; };
45 int32
Cols() const { return fCols
; };
46 BObjectList
<PairsButton
>* PairsButtonList() const
47 { return fPairsButtonList
; };
49 int32
GetIconPosition(int32 index
);
51 int32
IconSize() const { return fIconSize
; };
52 void SetIconSize(int32 size
) { fIconSize
= size
; };
54 int32
Spacing() const { return fIconSize
/ 6; };
57 void _GenerateCardPositions();
58 void _ReadRandomIcons();
59 void _SetPairsBoard();
67 BObjectList
<PairsButton
>* fPairsButtonList
;
68 BObjectList
<BBitmap
>* fSmallBitmapsList
;
69 BObjectList
<BBitmap
>* fMediumBitmapsList
;
70 BObjectList
<BBitmap
>* fLargeBitmapsList
;
71 int32
* fRandomPosition
;
77 #endif // PAIRS_VIEW_H