Determine if widget

Is there a programmatic way of determining whether a program is running as a widget or app?

Is there a "has" that will do it?