It would actually be a lot like a dynamic floodgate. Imagine a floodgate linked to a waterwheel. The waterwheel supplies power to the floodgate, keeping it open. If the flow direction changes, the waterwheel reverses power supply, force-shutting the floodgate.
I think in the future (of DF) all the levers and systems will be better off working this way.
A gearbox would have an ability to switch itself on and off (clutch), or provide power directly, or in reverse. They might be two different gearboxes, if that concept is difficult. Any item that moves will require a mechanical power supply to function - and will function without a lever, as long as the power is supplied. The direction of the said power (CW or CCW, specifically listed on the mechanical components) will determine how the item operates - raising or lowering a drawbridge, opening/closing floodgates, doors, hatches, bars, etc. A lever will be linked to a reversing gearbox that will shift the gear into the reverse of the active, thus toggling the operation of the item.
Applied to windmills, the less reliable supply, the system will be simpler - as the 'mills can be set to specifically produce CW or CCW power, and produce it constantly regardless of wind direction. Waterwheels, as noted, produce power dependant on the orientation of the flow, and orientation of the connecting axle. While more cumbersome in some situations, the waterwheels will thus allow such dynamic self-controlling floodgates.
Way to make a long winded post to explain a complex principle used to fulfill a simple need.
I seek no easy route.