/***************************************************************************
 *                          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-2003 Zanoza Software.                 *
 *                                                                         *
 *                        All rights reserved.                             *
 ***************************************************************************
 *--------------------------------------------------------------------------
 * @author:   Oleg M.
 *--------------------------------------------------------------------------
 * @purpose:  ZModeler 2.x images helper classes
 *--------------------------------------------------------------------------
 * @histroy: 09.01.2003. Created
 */
#ifndef _std_statushelper_h_included
#define _std_statushelper_h_included

#include <zmodeler.h>

namespace core
{
  // helper routine to determine status of any element:
  // returns STATUS_ENABLED if IStatus not supported
  DLL_LINKAGE DWORD ZAPICALL statusOf(ZUnknown* pUnk);

  //--------------------------------
  // class implements core::IStatus
  //--------------------------------
  class DLL_LINKAGE CStatus : public core::IStatus
  {
  public:
    INTERFACE_DECLAREMAP(CStatus)
    CStatus();
    virtual  ~CStatus(){}

    //-------------------------
    //  core::IStatus:
    //-------------------------
    public:
      virtual ZRESULT getStatus(DWORD& nBits);
      virtual ZRESULT setStatus(DWORD nBits);
      virtual ZRESULT changeStatus(DWORD nAdd, DWORD nRemove);
      virtual ZRESULT checkStatus(DWORD nBit);
    //------------------------
    // data members
    public:
      DWORD           m_dwStatus;
  };//class CStatus
};//core

//--------------------------------------
//  Implementa the status interface
//--------------------------------------
#define  STATUS_HELPER_IMPLEMENT()                              \
    private:                                                    \
      core::CStatus           m_Status;                         \
    public:                                                     \
      virtual ZRESULT getStatus(DWORD& nBits)                   \
        { return m_Status.getStatus(nBits); }                   \
      virtual ZRESULT setStatus(DWORD nBits)                    \
        { return m_Status.setStatus(nBits); }                   \
      virtual ZRESULT changeStatus(DWORD nAdd, DWORD nRemove)   \
        { return m_Status.changeStatus(nAdd, nRemove); }        \
      virtual ZRESULT checkStatus(DWORD nBit)                   \
        { return m_Status.checkStatus(nBit); }


#endif //_std_statushelper_h_included



