MCPcopy Create free account
hub / github.com/Aloshi/EmulationStation / setEntry

Method setEntry

src/components/ComponentListComponent.cpp:36–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36void ComponentListComponent::setEntry(Eigen::Vector2i pos, Eigen::Vector2i size, GuiComponent* component, bool canFocus, AlignmentType align,
37 Eigen::Matrix<bool, 1, 2> autoFit, UpdateBehavior updateType)
38{
39 if(pos.x() > mGridSize.x() || pos.y() > mGridSize.y() || pos.x() < 0 || pos.y() < 0)
40 {
41 LOG(LogError) << "Tried to set entry beyond grid size!";
42 return;
43 }
44
45 if(component == NULL)
46 {
47 LOG(LogError) << "Tried to add NULL component to ComponentList!";
48 return;
49 }
50
51 ComponentEntry entry(Eigen::Vector2i(pos.x(), pos.y()), Eigen::Vector2i(size.x(), size.y()), component, updateType, canFocus, align);
52
53 mEntries.push_back(entry);
54
55 for(int y = pos.y(); y < pos.y() + size.y(); y++)
56 {
57 for(int x = pos.x(); x < pos.x() + size.x(); x++)
58 {
59 setCell(x, y, &mEntries.back());
60 }
61 }
62
63 if(component->getParent() != NULL)
64 LOG(LogError) << "ComponentListComponent ruining an existing parent-child relationship! Call a social worker!";
65 component->setParent(this);
66
67 if(!cursorValid() && canFocus)
68 mCursor = pos;
69
70 //update the column width and row height
71 if(autoFit.x() && (int)getColumnWidth(pos.x()) < component->getSize().x())
72 setColumnWidth(pos.x(), (unsigned int)component->getSize().x());
73 if(autoFit.y() && (int)getRowHeight(pos.y()) < component->getSize().y())
74 setRowHeight(pos.y(), (unsigned int)component->getSize().y());
75
76 component->setPosition(getCellOffset(pos));
77}
78
79void ComponentListComponent::setRowHeight(int row, unsigned int size)
80{

Callers 1

GuiSettingsMenuMethod · 0.80

Calls 5

push_backMethod · 0.80
getParentMethod · 0.80
setParentMethod · 0.80
getSizeMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected