/***************************************************************************
 *                          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 ui::controls helper classes
 *--------------------------------------------------------------------------
 * @histroy: 18.05.2003. Created
 */
#ifndef uicontrollershelper_h_included
#define uicontrollershelper_h_included

#include <core/ui/controls/ITreeElementController.h>
#include <core/ui/controls/IListElementController.h>

namespace core
{
  namespace ui
  {
    namespace controls
    {
      //---------------------------------------------------------------------
      // class CElementController implements IElementController which
      // does nothing and allows any modification of element.
      //---------------------------------------------------------------------
      class DLL_LINKAGE CElementController : public IElementController
      {
      public:
        INTERFACE_DECLAREMAP(CElementController)
      public:
        CElementController();
        virtual ~CElementController(){}
      public:
      //----------------------
      // IElementController:
      //----------------------
      public:
        virtual ZRESULT onDeploy(core::ui::controls::IUIControl* pControl, long nOrdinal);
        virtual ZRESULT onDestroy(void);
        virtual ZRESULT onDelete(long nOrdinal);
        virtual ZRESULT onSetFocus(long nOrdinal);
        virtual ZRESULT onKillFocus(long nOrdinal);
        virtual ZRESULT onLeftClick(long nOrdinal, ZPoint loc);
        virtual ZRESULT onRightClick(long nOrdinal, ZPoint loc);
        /* Notifies on status changing. strValue could be NULL, if status is about to be changed */
        virtual ZRESULT onValueChanging(long nOrdinal, ZString strValue, long nSubItem=0);
        /* Called after chaning status/value to validate new state/value. Both in-out parameters
         * can be altered if desired. strValue could be NULL, if only status was changed */
        virtual ZRESULT onValueChanged(long nOrdinal, ZString& strValue, long nSubItem=0);
      };//class


      //---------------------------------------------------------------------
      // class CTreeElementController implements ITreeElementController which
      // does nothing and allows any modification of tree elements.
      //---------------------------------------------------------------------
      class DLL_LINKAGE CTreeElementController : public ITreeElementController
      {
      public:
        INTERFACE_DECLAREMAP(CTreeElementController)
      public:
        CTreeElementController();
        virtual ~CTreeElementController(){}
      public:
      //----------------------
      // IElementController:
      //----------------------
        virtual ZRESULT onDeploy(core::ui::controls::IUIControl* pControl, long nOrdinal);
        virtual ZRESULT onDestroy(void);
        virtual ZRESULT onDelete(long nOrdinal);
        virtual ZRESULT onSetFocus(long nOrdinal);
        virtual ZRESULT onKillFocus(long nOrdinal);
        virtual ZRESULT onLeftClick(long nOrdinal, ZPoint loc);
        virtual ZRESULT onRightClick(long nOrdinal, ZPoint loc);
        /* Notifies on status changing. strValue could be NULL, if status is about to be changed */
        virtual ZRESULT onValueChanging(long nOrdinal, ZString strValue, long nSubItem=0);
        /* Called after chaning status/value to validate new state/value. Both in-out parameters
         * can be altered if desired. strValue could be NULL, if only status was changed */
        virtual ZRESULT onValueChanged(long nOrdinal, ZString& strValue, long nSubItem=0);
      public:
      //----------------------
      // ITreeElementController:
      //----------------------
        virtual ZRESULT onExpand(long nOrdinal);
        virtual ZRESULT onCollapse(long nOrdinal);
        virtual ZRESULT onBeginDrag(long nOrdinal);
        virtual ZRESULT onDragOver(long nSourceOrdinal, long nTargetOrdinal);
        virtual ZRESULT onDropOnto(long nSourceOrdinal, long nTargetOrdinal);
        virtual ZRESULT onDragInsert(long nSourceOrdinal, long nParentOrdinal, long nInsertionIndex);
        virtual ZRESULT onDropInsert(long nSourceOrdinal, long nParentOrdinal, long nInsertedIndex);

      };//class


      //---------------------------------------------------------------------
      // class CListElementController implements IListElementController which
      // does nothing and allows any modification of list elements.
      //---------------------------------------------------------------------
      class DLL_LINKAGE CListElementController : public IListElementController
      {
      public:
        INTERFACE_DECLAREMAP(CListElementController)
      public:
        CListElementController();
        virtual ~CListElementController(){}
      public:
      //----------------------
      // IElementController:
      //----------------------
        virtual ZRESULT onDeploy(core::ui::controls::IUIControl* pControl, long nOrdinal);
        virtual ZRESULT onDestroy(void);
        virtual ZRESULT onDelete(long nOrdinal);
        virtual ZRESULT onSetFocus(long nOrdinal);
        virtual ZRESULT onKillFocus(long nOrdinal);
        virtual ZRESULT onLeftClick(long nOrdinal, ZPoint loc);
        virtual ZRESULT onRightClick(long nOrdinal, ZPoint loc);
        /* Notifies on status changing. strValue could be NULL, if status is about to be changed */
        virtual ZRESULT onValueChanging(long nOrdinal, ZString strValue, long nSubItem=0);
        /* Called after chaning status/value to validate new state/value. Both in-out parameters
         * can be altered if desired. strValue could be NULL, if only status was changed */
        virtual ZRESULT onValueChanged(long nOrdinal, ZString& strValue, long nSubItem=0);
      public:
      //----------------------
      // IListElementController:
      //----------------------
        virtual ZRESULT onBeginDrag(tLongSeq& nOrdinalSeq);
        virtual ZRESULT onDragOver(tLongSeq& nOrdinalSeq, long nTargetOrdinal);
        virtual ZRESULT onDropOnto(tLongSeq& nOrdinalSeq, long nTargetOrdinal);
        virtual ZRESULT onDragInsert(tLongSeq& nOrdinalSeq, long nInsertionOrdinal);
        virtual ZRESULT onDropInsert(tLongSeq& nOrdinalSeq, long nInsertedOrdinal);
      };//class
    };//controls
  };//ui
};//core


#endif //uicontrollershelper_h_included



