All Web Parts are derived from the CMSAbstractWebPart control and hence you could look at the Page Controls Collection to get all Controls of this type. The CMSAbstractWebPart exsposes the WebPartInfo class and hence you can get the type from that.
Here's a snippet that allows you to recuresively look at the Controls collection and get all controls of a specific type:
public class ControlFinder<T> where T : Control
{
private List<T> _foundControls = new List<T>();
public void FindChildControlsRecursive(Control control)
{
foreach (Control childControl in control.Controls)
{
if (childControl.GetType() == typeof(T))
_foundControls.Add((T)childControl);
else
FindChildControlsRecursive(childControl);
}
}
public List<T> FoundControls
{
get { return _foundControls; }
}
}
You would call this like:
var controlFinder = new ControlFinder<CMSAbstractWebPart>);
var webPartsList = controlFinder.FindChildControlsRecursive(Page);