File: CHeroWindow.h

package info (click to toggle)
vcmi 1.6.5%2Bdfsg-2
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid, trixie
  • size: 32,060 kB
  • sloc: cpp: 238,971; python: 265; sh: 224; xml: 157; ansic: 78; objc: 61; makefile: 49
file content (113 lines) | stat: -rw-r--r-- 3,079 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
 * CHeroWindow.h, part of VCMI engine
 *
 * Authors: listed in file AUTHORS in main folder
 *
 * License: GNU General Public License v2.0 or later
 * Full text of license available in license.txt file, in main folder
 *
 */
#pragma once

#include "CWindowWithArtifacts.h"

#include "../../lib/bonuses/IBonusBearer.h"

#include <vcmi/FactionMember.h>

VCMI_LIB_NAMESPACE_BEGIN

class CGHeroInstance;

VCMI_LIB_NAMESPACE_END

class CButton;
class CHeroWindow;
class LClickableAreaHero;
class LRClickableAreaWText;
class LRClickableAreaWTextComp;
class CArtifactsOfHeroMain;
class MoraleLuckBox;
class CToggleButton;
class CToggleGroup;
class CGStatusBar;
class CTextBox;
class CGarrisonInt;

/// Button which switches hero selection
class CHeroSwitcher : public CIntObject
{
	const CGHeroInstance * hero;
	std::shared_ptr<CAnimImage> image;
	CHeroWindow * owner;
public:
	void clickPressed(const Point & cursorPosition) override;

	CHeroSwitcher(CHeroWindow * owner_, Point pos_, const CGHeroInstance * hero_);
};

class CHeroWindow : public CStatusbarWindow, public IGarrisonHolder, public CWindowWithArtifacts
{
	std::shared_ptr<CLabel> name;
	std::shared_ptr<CLabel> title;

	std::shared_ptr<CAnimImage> banner;

	std::vector<std::shared_ptr<CHeroSwitcher>> heroList;
	std::shared_ptr<CPicture> listSelection;

	std::shared_ptr<LRClickableAreaWText> portraitArea;
	std::shared_ptr<CAnimImage> portraitImage;

	std::vector<std::shared_ptr<LRClickableAreaWTextComp>> primSkillAreas;
	std::vector<std::shared_ptr<CAnimImage>> primSkillImages;
	std::vector<std::shared_ptr<CLabel>> primSkillValues;

	std::shared_ptr<CLabel> expValue;
	std::shared_ptr<LRClickableAreaWText> expArea;

	std::shared_ptr<CLabel> manaValue;
	std::shared_ptr<LRClickableAreaWText> spellPointsArea;

	std::shared_ptr<LRClickableAreaWText> specArea;
	std::shared_ptr<CAnimImage> specImage;
	std::shared_ptr<CLabel> specName;
	std::shared_ptr<MoraleLuckBox> morale;
	std::shared_ptr<MoraleLuckBox> luck;
	std::vector< std::shared_ptr<CSecSkillPlace>> secSkills;
	std::vector<std::shared_ptr<CLabel>> secSkillNames;
	std::vector<std::shared_ptr<CLabel>> secSkillValues;

	std::shared_ptr<CButton> quitButton;
	std::shared_ptr<CTextBox> dismissLabel;
	std::shared_ptr<CButton> dismissButton;
	std::shared_ptr<CTextBox> questlogLabel;
	std::shared_ptr<CButton> questlogButton;
	std::shared_ptr<CButton> commanderButton;
	std::shared_ptr<CButton> backpackButton;

	std::shared_ptr<CToggleButton> tacticsButton;
	std::shared_ptr<CToggleGroup> formations;

	std::shared_ptr<CGarrisonInt> garr;
	std::shared_ptr<CArtifactsOfHeroMain> arts;

	std::vector<std::shared_ptr<CLabel>> labels;

public:
	const CGHeroInstance * curHero;

	CHeroWindow(const CGHeroInstance * hero);

	void update() override;

	void dismissCurrent(); //dismissed currently displayed hero (curHero)
	void commanderWindow();
	void switchHero(); //changes displayed hero
	void updateGarrisons() override;
	bool holdsGarrison(const CArmedInstance * army) override;
	void createBackpackWindow();

	//friends
	friend class CPlayerInterface;
};