Creating a new widget for my website

Hello all!

I would like to create a widget plugin for my site and I was thinking of using the "Recent Global Posts" widget as a starting point.

I don't want to mess up that widget, but I want to copy it as a starting point for my own. Where should I start with in order to make it a plugin that could be reused?

Really I want to heavily re-style the existing widget, but it will not be possible without editing it.