//	TwistPane.h
//
//	This class is a Pane which encapsulates a twisty outline list.

#ifndef __TWISTPANE_H
#define __TWISTPANE_H

#include "Pane.h"
#include "IconPane.h"

class TwistPane : public Pane
{
  public:
	TwistPane();
	virtual ~TwistPane();

	virtual void Draw();
	virtual Boolean Click(Point where, short modifiers);
	virtual void SetOpen(const Boolean open);

	// The header is drawn to the right of a twisty triangle
	// (an icon indicating whether the pane is open or not).
	// Typically, this will be a TextPane, but it could be anything.
	// Owned & destroyed by the TwistPane.
	Pane *mHeader;

	// When the mOpen == true, mSubpane is drawn below the header;
	// otherwise only the header is drawn.
	// The frame height is adjusted accordingly.
	// Owned & destroyed by the TwistPane.
	Pane *mSubpane;
	
	// If mNextPane is not null, then it is moved and redrawn
	// whenever this TwistPane opens or closes.
	// This pane is *not* owned or destroyed by the TwistPane.
	Pane *mNextPane;

  protected:
	Boolean mOpen;
	IconPane	mTriangle;
	virtual void DrawTriangle(const Boolean erase);	// called by DrawHeader()
	virtual void DrawHeader(const Boolean erase);	// called by Draw()
	virtual void DrawSubpane(const Boolean erase);	// called by Draw()
};

#endif
