/***************************************************************************
 *                          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 Zanoza Software.                   *
 *                                                                         *
 *                        All rights reserved.                             *
 ***************************************************************************
 *--------------------------------------------------------------------------
 * @author:   Oleg Melashenko
 *--------------------------------------------------------------------------
 * @purpose:  Declaration of the class ITreeControl
 *--------------------------------------------------------------------------
 * @created: 6 мая 2003 г. 14:48:27
 */

#if !defined(ITreeControl_h_included)
#define ITreeControl_h_included
//forward declaration of this class might require
namespace core
{ namespace ui
  { namespace controls
    { class ITreeControl; }; }; };
#include <zmodeler.h>
#include <core/ui/controls/uiControls.h>
#include <core/ui/controls/IUIControl.h>
#include <core/ui/controls/IElementController.h>
#include <core/ui/controls/ITreeElementController.h>


namespace core
{
  namespace ui
  {
    namespace controls
    {
      
      class ITreeControl : public core::ui::controls::IUIControl
      {
      public:
        virtual long getItemCount(void) const=0;
        /* Prepares list for a number of items to be added */
        virtual ZRESULT setItemCount(long items)=0;
        virtual ZRESULT getParent(long nItem, long& nParent)=0;
        virtual ZRESULT setParent(long nItem, long nParent)=0;
        virtual ZRESULT getSelectedItems(tLongSeq& items)=0;
        virtual long getChildrenCount(long nIndex)=0;
        /* provides direct children IDs */
        virtual ZRESULT getChildren(long nItem, tLongSeq& seqChildren)=0;
        /* provides all children IDs. */
        virtual ZRESULT getAllChildren(long nItem, tLongSeq& seqChildren)=0;
        virtual ZRESULT isChildOf(long nParent, long nChild)=0;
        virtual ZRESULT isRootItem(long nItem)=0;
        virtual ZRESULT isSelected(long nItem)=0;
        /* returns 0 if no check, 1 if checked, 2 in intermediate state */
        virtual long getCheck(long nItem)=0;
        virtual ZRESULT selectItem(long nItem, bool bSelect=true)=0;
        virtual ZRESULT checkItem(long nItem, long nCheckState=1, bool bAllowItermediate=false)=0;
        virtual ZRESULT collapseItem(long nItem)=0;
        virtual ZRESULT expandItem(long nItem)=0;
        virtual ZRESULT getItemText(long nItem, ZString& text)=0;
        virtual ZRESULT setItemText(long nItem, ZString text)=0;
        virtual ZRESULT getItemData(long nItem, DWORD& data)=0;
        virtual ZRESULT setItemData(long nItem, DWORD data)=0;
        /* Modifies item style. Item's style surpresses control style and, if any, column style */
        virtual ZRESULT modifyItemStyle(long nOrdinal, DWORD dwAdd, DWORD dwRemove, DWORD* pdwCurrent=NULL)=0;
        virtual ZRESULT insertItem(long nParent, long index, ZString strLabel, long* pItemID=NULL, CImageList* pList=NULL, long nImage=0, core::ui::controls::IElementController* pController=NULL)=0;
        virtual ZRESULT addItem(long nParent, ZString strLabel, long* pItemID=NULL, CImageList* pList=NULL, long nImage=0, core::ui::controls::IElementController* pController=NULL)=0;
        /* Modifies components of an item. Label, image, controller. */
        virtual ZRESULT modifyItem(long nItemID, LPCTSTR pszLabel, long nParent=-1, CImageList* pList=NULL, long nImage=-1)=0;
        virtual ZRESULT deleteItem(long nIndex)=0;
        /* Provides ordianlID for specified location. Supplied braches are
         * created if allowed */
        virtual ZRESULT getLocation(ZStringSeq seqLabels, bool bAllowCreate, long& nOrdinalID)=0;
        virtual ZRESULT getController(core::ui::controls::ITreeElementController** ppController)=0;
        virtual ZRESULT setController(core::ui::controls::ITreeElementController* pController, bool bHoldRef=true)=0;
      
      };//class ITreeControl
    };//controls
  };//ui
};//core

#endif
