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

Method addButton

source/windowing/StarButtonGroup.cpp:22–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22int ButtonGroup::addButton(ButtonWidget* button, int id) {
23 if (!button)
24 return NoButton;
25 else if (m_buttonIds.contains(button))
26 return m_buttonIds.get(button);
27
28 // If we are auto-generating an id, start at the last id and work forward.
29 if (id == NoButton && !m_buttons.empty())
30 id = (prev(m_buttons.end()))->first;
31
32 while (m_buttons.contains(id))
33 ++id;
34
35 m_buttons[id] = button;
36 m_buttonIds[button] = id;
37 return id;
38}
39
40void ButtonGroup::removeButton(ButtonWidget* button) {
41 if (m_buttonIds.contains(button)) {

Callers 1

setButtonGroupMethod · 0.80

Calls 4

containsMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected