Do I have to activate it the next time my opponent attacks, or can I wait and activate it on any future occasion of my choice where my opponent attacks?
You can decide to activate it anytime "an opponent's monster declares an attack".
On normal conditions*, nothing is making you activate this card the immediately next attack your opponent declares; you can hold its use for whenever you feel like it or well if you think it would be optimal strategy to use it there.
The things you have to have in mind before attempting to activate (along with your game strategy, that is) are:
Trap cards and Quick-play spell cards cannot be activated the turn they are set (other spell cards can, though). If you just set this trap card you will have to wait until your opponent's turn to be able to activate it.
That you meet the card's activation conditions. In this case your Widespread Ruin indicates: "When an opponent's monster declares an attack". This is telling us that only when that happens is that you may decide (or not) to activate this card.
*The only example that comes to mind about forcing you to activate something is Bait Doll (quite an old card actually). From its description we can read:
Target 1 Set card in the Spell & Trap Card Zone; reveal that target, force its activation if it is a Trap Card, then negate its effect if the activation timing is incorrect, and if you do, destroy it. (If it is not a Trap Card, return it face-down.) When this card resolves, shuffle it into the Deck instead of sending it to the Graveyard.
We can see its effect revolves around the target to have an incorrect timing; if we played this card to a set Widespread Ruin we would effectively destroy it, as the card would not have correct timing (i.e.: attack was not declared).
On a further note, it is worth recalling that there are some effects that you are actually forced to activate, that is, they are not optional. Some examples of that are usually found on cards with continuous effects (either monster or spell/trap), or well some that are obligatory when a condition is met. One example is Dark Room of Nightmare:
Each time your opponent takes damage from a card effect, except "Dark Room of Nightmare", inflict 300 damage to your opponent.
As you can see, this effect has to be activated every time you inflict effect damage to your opponent. Another case is Doomcaliber Knight, which has to be activated on the moment a monster effect is activated (even yours, so careful):
Cannot be Special Summoned. During either player's turn, if a monster effect is activated: Tribute this face-up card; negate the activation, and if you do, destroy that monster.