i7Baby :
Its an AC adapter. The voltage regulation is done by the controller in the laptop.
No it's not. It's an AC adapter in the sense that it takes in AC power. It's output at a fixed DC voltage.
I don't know about macs specifically, but usually all the regulation to e.g. 18V is done in the adapter - it's just a simple switch-mode power supply.
The laptop then has a pile of DC-DC convertors (with their own regulation) to give it the voltages needed for its components from either the adapter or the battery, and to charge the battery.
How variable voltages are usually done is you have a resistor inside the device, between two pins (or one pin and ground). The controller chip in the adapter reads the value of this resistor by applying a known current through it and measuring the voltage drop across it, then regulates the output voltage based on this.