While typically people work in a studio to accomplish most kinds of creative production, inspiration can certainly arrive at less than opportune times. In the case of music making, my two favorite DAWs (Logic and Ableton Live) both offer onscreen keyboards that simulate a real MIDI keyboard. Obviously you sacrifice velocity sensitivity, but this can be immensely useful when, say, waiting at an airport.
The keyboard is limited in that its only one octave at a time and starts at a. In Live you can change octaves with z and x, in Logic as the screenshot shows this adjusts volume.
In Logic 9, simply hit caps lock and an onscreen keyboard appears.
In Ableton 8, hit Cmd-Shift-K or click the little keyboard icon on the upper right.
The only thing left is mod wheel support, if you know any free solutions for Mac let me know in the comments!