Update: This post is really old.
It's a really old solution which is absurdly complex compared to my new solution of using a Button node instead.
To make the Button behave like a ?Gamepad button, it should have this script with on_button_down and on_button_up signals for simulating the button press:
extends Button
func _on_button_down():
Input.action_press("jump"); #Replace "jump" with your desired action
func _on_button_up():
Input.action_release("jump"); #Replace "jump" with your desired action