38
|
1 /*
|
|
2 * Dialog
|
|
3 */
|
|
4
|
|
5 #ifndef __DIALOG_H__
|
|
6 #define __DIALOG_H__
|
|
7
|
|
8 #include "Core.h"
|
|
9 #include "GuiImage.h"
|
|
10 #include "GuiLabel.h"
|
|
11 #include "GuiButton.h"
|
|
12
|
|
13 /*
|
|
14 * Dialog
|
|
15 */
|
|
16 template<uint32 ButtonCount>
|
|
17 class Dialog : public GuiImage
|
|
18 {
|
|
19 /*
|
|
20 * kLabel
|
|
21 */
|
|
22 GuiLabel kLabel;
|
|
23
|
|
24 /*
|
|
25 * kButton
|
|
26 */
|
|
27 GuiButton kButton[ButtonCount];
|
|
28
|
|
29 public:
|
|
30
|
|
31 /*
|
|
32 * Dialog
|
|
33 */
|
|
34 Dialog() : GuiImage()
|
|
35 {
|
|
36 }
|
|
37
|
|
38 /*
|
|
39 * Initialize
|
|
40 */
|
|
41 virtual ErrorCode Initialize(ResourceManager* pResourceManager)
|
|
42 {
|
|
43 ErrorCode eCode = GuiImage::Initialize(pResourceManager);
|
|
44 if(eCode == Error_Success)
|
|
45 {
|
|
46 SetTexture("Data\\Textures\\Dialog.tga", true);
|
|
47 //SetDimensions(300.0f, 200.0f);
|
|
48
|
|
49 kLabel.Initialize(pResourceManager);
|
|
50 kLabel.SetPosition(150.0f, 50.0f);
|
|
51 kLabel.SetLabelFlag(GuiLabelFlag_CenterX);
|
|
52
|
|
53 Add(&kLabel);
|
|
54
|
|
55 for(uint32 i = 0; i < ButtonCount; ++i)
|
|
56 {
|
|
57 kButton[i].Initialize(pResourceManager);
|
|
58 kButton[i].SetTexture(GuiButtonState_Normal, "Data\\Textures\\ButtonN.tga", true);
|
|
59 kButton[i].SetTexture(GuiButtonState_Hover, "Data\\Textures\\ButtonH.tga");
|
|
60 kButton[i].SetTexture(GuiButtonState_Down, "Data\\Textures\\ButtonD.tga");
|
|
61 kButton[i].Subscribe(GuiButton::EventClick, &Dialog::OnClick, this);
|
|
62
|
|
63 Add(&kButton[i]);
|
|
64 }
|
|
65 }
|
|
66
|
|
67 return eCode;
|
|
68 }
|
|
69
|
|
70 private:
|
|
71
|
|
72 /*
|
|
73 * OnClick
|
|
74 */
|
|
75 void OnClick(GuiEventArguments& kArguments)
|
|
76 {
|
|
77 if(kArguments.pSource == &kButton[0])
|
|
78 {
|
|
79 }
|
|
80 else
|
|
81
|
|
82 if(kArguments.pSource == &kButton[1])
|
|
83 {
|
|
84 }
|
|
85 }
|
|
86 };
|
|
87
|
|
88 #endif //__DIALOG_H__
|