MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / buildItemTooltip

Method buildItemTooltip

source/frontend/StarItemTooltip.cpp:24–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22namespace Star {
23
24PanePtr ItemTooltipBuilder::buildItemTooltip(ItemPtr const& item, PlayerPtr const& viewer) {
25 if (!item) {
26 return {};
27 } else {
28 PanePtr tooltip = make_shared<Pane>();
29 tooltip->removeAllChildren();
30
31 String title;
32 String subTitle;
33
34 String tooltipKind = item->tooltipKind();
35
36 if (tooltipKind.empty())
37 tooltipKind = "base";
38 if (!tooltipKind.endsWith(".tooltip"))
39 tooltipKind = "/interface/tooltips/" + tooltipKind + ".tooltip";
40
41 buildItemDescriptionInner(tooltip, item, tooltipKind, title, subTitle, viewer);
42
43 auto titleIcon = make_shared<ItemSlotWidget>(item, "/interface/inventory/portrait.png");
44 titleIcon->setBackingImageAffinity(true, true);
45 titleIcon->showRarity(false);
46 tooltip->setTitle(titleIcon, title, subTitle);
47
48 return tooltip;
49 }
50}
51
52void ItemTooltipBuilder::buildItemDescription(WidgetPtr const& container, ItemPtr const& item) {
53 String tooltipKind = item->tooltipKind();

Callers

nothing calls this directly

Calls 7

removeAllChildrenMethod · 0.80
showRarityMethod · 0.80
setTitleMethod · 0.80
tooltipKindMethod · 0.45
emptyMethod · 0.45
endsWithMethod · 0.45

Tested by

no test coverage detected