-
Notifications
You must be signed in to change notification settings - Fork 2
/
RecipeIcon.cpp
82 lines (66 loc) · 2.19 KB
/
RecipeIcon.cpp
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
#include "stdafx.h"
#include "RecipeIcon.h"
RecipeIcon::RecipeIcon(UTFWin::IWindow* window, Recipe juh)
{
mapItemWindow = window;
myRecipe = juh;
mapError = u"";
string16 products;
products.assign_convert(to_string(myRecipe.productAmount));
products = u" x" + products;
mapItemWindow->FindWindowByID(id("zurgtastic"))->FindWindowByID(id("count"))->SetCaption(products.c_str());
PropertyListPtr sillyPropList;
//If CargoType get from SpaceTrading aka 0x034d97fa
if (myRecipe.CargoType) {
PropManager.GetPropertyList(myRecipe.mToolID, 0x034d97fa, sillyPropList);
}
else {
PropManager.GetPropertyList(myRecipe.mToolID, 0x30608f0b, sillyPropList);
}
LocalizedString silly;
LocalizedString verySilly;
(App::Property::GetText(sillyPropList.get(), 0x3068D95D, silly));
(App::Property::GetText(sillyPropList.get(), 0x04CAD19B, verySilly));
myTooltip = UTFWin::CreateTooltip(silly.GetText(),verySilly.GetText());
window->FindWindowByID(id("zurgtastic"))->AddWinProc(myTooltip);
}
RecipeIcon::~RecipeIcon()
{
}
// For internal use, do not modify.
int RecipeIcon::AddRef()
{
return DefaultRefCounted::AddRef();
}
// For internal use, do not modify.
int RecipeIcon::Release()
{
return DefaultRefCounted::Release();
}
// You can extend this function to return any other types your class implements.
void* RecipeIcon::Cast(uint32_t type) const
{
CLASS_CAST(Object);
CLASS_CAST(IWinProc);
CLASS_CAST(RecipeIcon);
return nullptr;
}
// This method returns a combinations of values in UTFWin::EventFlags.
// The combination determines what types of events (messages) this window procedure receives.
// By default, it receives mouse/keyboard input and advanced messages.
int RecipeIcon::GetEventFlags() const
{
return kEventFlagBasicInput | kEventFlagAdvanced;
}
// The method that receives the message. The first thing you should do is probably
// checking what kind of message was sent...
bool RecipeIcon::HandleUIMessage(IWindow* window, const Message& message)
{
if (message.eventType == MessageType::kMsgButtonClick)
{
FabricatorSystemA.SelectRecipe(myRecipe);
return true;
}
// Return true if the message was handled, and therefore no other window procedure should receive it.
return false;
}