I think you are looking for http://docs.moodle.org/en/Development#Make_a_new_plugin .. and you might find http://xref.moodle.org/nav.html?index.html and http://phpdocs.moodle.org/19/index.html helpful too at some point.
Make sure to read
http://docs.moodle.org/en/Development:Guidelines_for_contributed_code
Mat
Make sure to read
http://docs.moodle.org/en/Development:Guidelines_for_contributed_code
Mat