/***************************************************************************
 *                          Zanoza Modeler v2.x                            *
 *      This is unpublished propietary source code of Zanoza Software.     *
 *      The copyright notice does not evidence any actual or intended      *
 *                    publication of such source code.                     *
 *                                                                         *
 *                Copyright (c) 2002-2008 Zanoza Software.                 *
 *                                                                         *
 *                        All rights reserved.                             *
 ***************************************************************************
 *--------------------------------------------------------------------------
 * @author:   Oleg Melashenko
 *--------------------------------------------------------------------------
 * @purpose:  Declaration of the class IMenuService
 *   Implements basic CMenu service. Service initially creates a
 *   nonpop-up menu which is ready to add items. You can create
 *   pop-up menu inside the main menu by passing non-empty branch
 *   parameter in addGeneric or addTool functions. To display and
 *   track pop-up menu use trackPopupMenu passing zero in
 *   nSubMenu argument.
 *--------------------------------------------------------------------------
 * @created: Tuesday, January 07, 2003 16:37:28
 */

#if !defined(IMenuService_h_included)
#define IMenuService_h_included
//forward declaration of this class might require
namespace services
{ class IMenuService; };
#include <zmodeler.h>
#include <core/coreTypes.h>
#include <services/zmServices.h>
#include <services/IUIService.h>
#include <core/tools/ITool.h>
#include <core/events/ICommandEventHandler.h>
#include <core/ui/IViewport.h>


namespace services
{
  
  class IMenuService : public services::IUIService
  {
  public:
    /* forces menu service to detach itself from zmodeler. In current implemenation
     * each menu services binds to MainFrame and registers as event handler. This
     * is the only routine to force menu service detach from these stuff. */
    virtual ZRESULT detach(void)=0;
    virtual ZRESULT apply(CWnd* pOwningWnd, bool bCompact=false)=0;
    virtual ZRESULT getMenuRoot(CMenu** ppRoot)=0;
    virtual ZRESULT loadMenu(DWORD dwResourceID)=0;
    virtual ZRESULT addTool(core::tools::ITool* pTool, long nIndex=-1, ZStringSeq* pseqBaseBranch=NULL)=0;
    virtual ZRESULT addGenericItem(DWORD mfFlags, ZStringSeq& seqBranch, ZString strTitle, DWORD nID, core::events::ICommandEventHandler* pCommandHandler=NULL, bool bHoldHandlerRef=true, CImageList* pList=NULL, long nImage=0)=0;
    /* Operation allows to modify menu item's state (flags, caption, images, etc) */
    virtual ZRESULT modifyItem(DWORD nID, DWORD nFlags=0, LPCTSTR pszTitle=NULL)=0;
    virtual ZRESULT trackPopupMenu(DWORD nFlags, ZPoint pt, long nSubMenu=0, bool bCompact=false, core::ui::IViewport* pVPort=NULL)=0;
  
  };//class IMenuService
};//services

#endif
