MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / Close

Method Close

src/dropdown.cpp:125–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123 }
124
125 void Close([[maybe_unused]] int data = 0) override
126 {
127 /* Finish closing the dropdown, so it doesn't affect new window placement.
128 * Also mark it dirty in case the callback deals with the screen. (e.g. screenshots). */
129 this->Window::Close();
130
131 Point pt = _cursor.pos;
132 pt.x -= this->parent->left;
133 pt.y -= this->parent->top;
134 this->parent->OnDropdownClose(pt, this->parent_button, this->selected_result, this->selected_click_result, this->options.Test(DropDownOption::InstantClose));
135
136 /* Set flag on parent widget to indicate that we have just closed. */
137 NWidgetCore *nwc = this->parent->GetWidget<NWidgetCore>(this->parent_button);
138 if (nwc != nullptr) nwc->disp_flags.Set(NWidgetDisplayFlag::DropdownClosed);
139 }
140
141 void OnFocusLost(bool closing) override
142 {

Callers 2

OnFocusLostMethod · 0.95
OnMouseLoopMethod · 0.95

Calls 3

TestMethod · 0.80
OnDropdownCloseMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected