//   Standard Play/Pause Button Script
//   Use as you please, by Gonzotek & Vica.


#include "../../../lib/std.mi"

// This sets the layout you want the button to be, in this case I want the winshade, change to
// mainnormal, for the normal layout
Global layout mainshade;


// This gets the various buttons I want to use, which in this care are just play & pause
Global button play, pause;


// Setting what objects to get from various layouts on script load
System.onScriptLoaded() {


// Gets the shade mode layout
  Layout mainshade = getContainer("Main").getLayout("shade");


// Gets the "id" tags as defined in my player-shade.xml for the two buttons
  Pause = mainshade.getObject("pause");
  Play = mainshade.getObject("play");


// Hides both buttons until playing status is determined
  Pause.hide();
  Play.hide();


// Determines whether Winamp is playing or paused, then shows the buttons accordingly
  if (getplayitemstring() != "") {
    Pause.show();
  }
    else {
    Play.show();
  }
}


// If winamp is playing, hides the play button and shows pause
System.onPlay()
{
  Play.hide();
  Pause.show();
}


// If winamp is paused, hides pause and shows play
System.onPause()
{
  Play.show();
  Pause.hide();
}

// If winamp is stopped, shows play and hides pause
System.onStop()
{
  Play.show();
  Pause.hide();
}


// After paused and button is again pressed starting play, will show pause and hide play
System.onresume()
{
  Play.hide();
  Pause.show();
}
