Accelstepper control

Hi I have a stepper motor set up with an easy driver, I have no problem setting it up and running the few sample programs I have found, but they don't do what I need it to do which is quite simple I'm sure but I just hit a brick wall trying to work it out using Accelstepper library, What I want to do is press a button once, the motor travels forward a set distance then stops then delay for 10 seconds then go back to the start position ,

Something like:

#define IDLE 0
#define MOVING 1
#define DELAYING 2

#define DISTANCE  ???  // steps to move

#define button_pin ??

unsigned long when = 0L ;

byte state = IDLE ;

AccelStepper stepper (????) ;  // pins and mode

void setup ()
{
  stepper.setSpeed (???) ;   // top speed, steps/sec
  stepper.setAcceleration (???) ; // top acceleration steps/sec/sec
}

void loop ()
{
  stepper.run () ;   // progress the stepper.  This must be called regularly and often

  // statemachine to progress the states
  switch (state)
  {
  case IDLE:
    if (digitalRead (button_pin) == LOW)
    {
      stepper.moveTo (DISTANCE) ;   // AccelStepper handles the rest, so long as you call run() often
      state = MOVING ;
    }
    break ;
  case MOVING:
    if (stepper.currentPosition () == DISTANCE)
    {
      state = DELAYING ;
      when = millis () ;
    }
    break ;
  case DELAYING:
    if (millis () - when >= 10000)
    {
      stepper.moveTo (0) ;   // start moving back
      state = IDLE ;
    }
  }
}

Thank you Mark I could kiss you all over, it works just as I wanted, I would love to understand it fully , perhaps one day if you have the time you could comment the program for myself and others who will like the program, thanks again .

I'd recommend going to AccelStepper.h file itself and reading all the comments...