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

Method OnClick

src/script/script_gui.cpp:196–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194 }
195
196 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
197 {
198 switch (widget) {
199 case WID_SCRL_LIST: { // Select one of the Scripts
200 int sel = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_SCRL_LIST) - 1;
201 if (sel < static_cast<int>(this->info_list->size())) {
202 this->selected = sel;
203 this->SetDirty();
204 if (click_count > 1) {
205 this->ChangeScript();
206 this->Close();
207 }
208 }
209 break;
210 }
211
212 case WID_SCRL_ACCEPT: {
213 this->ChangeScript();
214 this->Close();
215 break;
216 }
217 }
218 }
219
220 void OnResize() override
221 {

Callers

nothing calls this directly

Calls 5

ChangeScriptMethod · 0.95
sizeMethod · 0.45
SetDirtyMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected