/////////////////////////////////////////////////////////////////////////////
// Name:        No names yet.
// Purpose:     Contrib. demo
// Author:      Aleksandras Gluchovas
// Modified by:
// Created:     2000/02/08
// RCS-ID:      $Id: gedthandler.h,v 1.2 2001/04/04 12:42:37 aleksandras Exp $
// Copyright:   (c) Aleksandras Gluchovas
// Licence:   	GPL (version 2.0 or later)
/////////////////////////////////////////////////////////////////////////////

#ifndef __GEDTHANDLER_G__
#define __GEDTHANDLER_G__

#include "wx/event.h"
#include "wx/pmf/pm.h"

#include "XObject.h"
#include "XLayoutUtility.h"

class wxDynamicToolBar;
class wxFrameLayout;

class XGenericEditorHandler : public wxEvtHandler
{
public:
	XGenericEditorHandler( bool useFrameLayout = FALSE );
	~XGenericEditorHandler();

	void SetCurrentScene( XCollection& scene );
	void SetCurrentCmdManager( XCommandManager& cmdMgr );
	void SetLayoutUtility( XLayoutUtility* pUtil );
	XCollection* GetCurrentScene();
	XCommandManager* GetCurrentCmdManager();

	// overridables

	virtual wxPMMergableMenuChain* GetMergableMenuChain();
	virtual void AddToolbars( wxDynamicToolBar* pEditTBar, 
							  wxDynamicToolBar* pLayoutTBar,
							  wxFrameLayout* pFl );


	// menu/toolbar event handlers

	void EditUndo(wxCommandEvent& event);
	void EditRedo(wxCommandEvent& event);
	void EditCut(wxCommandEvent& event);
	void EditCopy(wxCommandEvent& event);
	void EditPaste(wxCommandEvent& event);
	void EditDelete(wxCommandEvent& event);
	void EditSelectAll(wxCommandEvent& event);
	void EditProperties(wxCommandEvent& event);

	void EditUndoUI(wxUpdateUIEvent& event);
	void EditRedoUI(wxUpdateUIEvent& event);
	void EditCutUI(wxUpdateUIEvent& event);
	void EditCopyUI(wxUpdateUIEvent& event);
	void EditPasteUI(wxUpdateUIEvent& event);
	void EditDeleteUI(wxUpdateUIEvent& event);
	void EditSelectAllUI(wxUpdateUIEvent& event);
	void EditPropertiesUI(wxUpdateUIEvent& event);

	void LayoutAlignLeft( wxCommandEvent& event );
	void LayoutAlignRight( wxCommandEvent& event );
	void LayoutAlignTop( wxCommandEvent& event );
	void LayoutAlignBottom( wxCommandEvent& event );

	void LayoutCenterVertical( wxCommandEvent& event );
	void LayoutCenterHorizontal( wxCommandEvent& event );

	void LayoutArrangeRight( wxCommandEvent& event );
	void LayoutArrangeBottom( wxCommandEvent& event );

	void LayoutSameWidth( wxCommandEvent& event );
	void LayoutSameHeight( wxCommandEvent& event );
	void LayoutSameBoth( wxCommandEvent& event );

	void LayoutBringFront( wxCommandEvent& event );
	void LayoutSendBack( wxCommandEvent& event );

	void LayoutTest( wxCommandEvent& event );

	void LayoutAlignUI(wxUpdateUIEvent& event);
	void LayoutCenterUI(wxUpdateUIEvent& event);
	void LayoutArrangeUI(wxUpdateUIEvent& event);
	void LayoutSameUI(wxUpdateUIEvent& event);
	void LayoutBringFrontUI(wxUpdateUIEvent& event);
	void LayoutSendBackUI(wxUpdateUIEvent& event);
	void LayoutTestUI(wxUpdateUIEvent& event);

	void LayoutSpaceAcross( wxCommandEvent& event );
	void LayoutSpaceDown( wxCommandEvent& event );
	void LayoutFlipVertical( wxCommandEvent& event );
	void LayoutFlipHorizontal( wxCommandEvent& event );
	void LayoutGridShow( wxCommandEvent& event );
	void LayoutGridSettings( wxCommandEvent& event );

	void LayoutGridSettingsUI( wxUpdateUIEvent& event );

	// codes for menu commands 

	enum GENERIC_EDITOR_COMMAND_IDS
	{
		FILE_OPEN = 100,
		FILE_SAVE,

		EDIT_UNDO,
		EDIT_REDO,
								
		EDIT_CUT,
		EDIT_COPY,
		EDIT_PASTE,
		EDIT_DELETE,
		EDIT_SELECT_ALL,

		EDIT_PROPERTIES,

		PARSING_REGENERATE,
		PARSING_ADD_EVENT,
		PARSING_DELETE_EVENT,
						  
		LAYOUT_ALIGN_LEFT,
		LAYOUT_ALIGN_RIGHT,
		LAYOUT_ALIGN_TOP,
		LAYOUT_ALIGN_BOTTOM,

		LAYOUT_CENTER_VERTICAL,
		LAYOUT_CENTER_HORIZONTAL,

		LAYOUT_ARRANGE_RIGHT,
		LAYOUT_ARRANGE_BOTTOM,

		LAYOUT_SAME_WIDTH,
		LAYOUT_SAME_HEIGHT,
		LAYOUT_SAME_BOTH,

		LAYOUT_BRING_FRONT,
		LAYOUT_SEND_BACK,

		LAYOUT_SPACE_ACROSS,
		LAYOUT_SPACE_DOWN,
		LAYOUT_FLIP_VERTICAL,
		LAYOUT_FLIP_HORIZONTAL,

		LAYOUT_SHOW_GRID,
		LAYOUT_GRID_SETTINGS,

		LAYOUT_TEST,

		LAYOUT_ALIGN,
		LAYOUT_CENTER,
		LAYOUT_ARRANGE,
		LAYOUT_SAME,
		LAYOUT_SPACE,
		LAYOUT_FLIP,
	};

protected:

	XCollection*     mpScene;    // current scene object
	XCommandManager* mpCmdMgr;   // current command manager object
	XLayoutUtility*  mpLUtil;

	DECLARE_EVENT_TABLE()
};

#endif