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

Method OnClick

src/misc_gui.cpp:950–979  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

948 }
949
950 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
951 {
952 switch (widget) {
953 case WID_QS_DEFAULT:
954 this->editbox.text.DeleteAll();
955 [[fallthrough]];
956
957 case WID_QS_OK:
958 this->OnOk();
959 [[fallthrough]];
960
961 case WID_QS_CANCEL:
962 this->Close();
963 break;
964
965 case WID_QS_MOVE:
966 this->last_user_action = widget;
967
968 if (Station::IsExpected(Station::Get(this->parent->window_number))) {
969 /* this is a station */
970 SetViewportStationRect(Station::Get(this->parent->window_number), !this->IsWidgetLowered(WID_QS_MOVE));
971 } else {
972 /* this is a waypoint */
973 SetViewportWaypointRect(Waypoint::Get(this->parent->window_number), !this->IsWidgetLowered(WID_QS_MOVE));
974 }
975
976 HandlePlacePushButton(this, WID_QS_MOVE, SPR_CURSOR_SIGN, HT_RECT);
977 break;
978 }
979 }
980
981 void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override
982 {

Callers

nothing calls this directly

Calls 7

OnOkMethod · 0.95
CloseMethod · 0.95
SetViewportStationRectFunction · 0.85
SetViewportWaypointRectFunction · 0.85
HandlePlacePushButtonFunction · 0.85
DeleteAllMethod · 0.80
IsWidgetLoweredMethod · 0.80

Tested by

no test coverage detected