#ifndef __OOL_XCONTOBJECT_H__
#define __OOL_XCONTOBJECT_H__

/*===========================================================================*/
/* OOL ------------------- the Open Object Library ------------- OS/2 Beta 1 */
/*===========================================================================*/
/*                              class: XContainerObject                      */
/*                       derived from: XObject                               */
/*                        last update: 3/97                                  */
/*                      programmed by: Stefan von Brauk (sbrauk@gwdg.de)     */
/*===========================================================================*/



#include "xobject.h"
#include "xcontain.h"
#include "XBitmap.h"
#include "XIcon.h"
#include "xdate.h"
#include "xtime.h"
#include "xstring.h"

class XContainerControl;
class XString;
class XTime;
class XDate;

class _export_ XContainerObject: public XObject
{
      friend XContainerControl;
   private:
      RECORDCORE * core;
		char * GetColumnPointer( SHORT column) { return (char *) ((PBYTE) core + sizeof(RECORDCORE) + sizeof(void*) + column * sizeof(void*)); }
	protected:
		XString title;
   public:
      XContainerObject( XContainerControl * owner, SHORT columns = 0, LONG attr = 0);
      virtual ~XContainerObject() { ;}
      LONG GetEmphasis( void ) const { return core->flRecordAttr; }
      void GetBitmap( XBitmap *);
      void GetIcon( XIcon * );
      void GetTitle( XString *);
      void SetBitmap( const XBitmap * b) { core->hbmBitmap = b->GetHandle(); }
      void SetColumnData( const SHORT column, const char * data) { memcpy( GetColumnPointer(column), &data, sizeof(PVOID)); }
      void SetColumnData( const SHORT column, const LONG data) { memcpy( GetColumnPointer(column), &data, sizeof(LONG)); }
      void SetColumnData( const SHORT column, const XBitmap*bitmap) { LONG buffer = bitmap->GetHandle(); memcpy( GetColumnPointer(column), &buffer, sizeof(LONG)); }
      void SetColumnData( const SHORT column, const XDate * data) { memcpy( GetColumnPointer(column), &data->d, 4); }
      void SetColumnData( const SHORT column, const XIcon * icon) { LONG buffer = icon->GetHandle(); memcpy( GetColumnPointer(column), &buffer, sizeof(LONG)); }
      void SetColumnData( const SHORT column, const XTime * data) { memcpy( GetColumnPointer(column), &data->t, 3); }
      void SetIcon( const XIcon * icon) { core->hptrIcon = icon->GetHandle(); }
      void SetMiniBitmap( const XBitmap* b) {core->hbmMiniBitmap = b->GetHandle();}
      void SetMiniIcon( const XIcon* icon) { core->hptrMiniIcon = icon->GetHandle(); }
//      void SetTitle( char * t) { title = t; memcpy( &core->pszIcon, (char*) title, sizeof(PVOID)); }// = core->pszName = core->pszTree = core->pszText = (PSZ) (char*) title.GetBuffer(s+1); strncpy(core->pszText, t, s+1); title.releaseBuffer(); }
      void SetTitle( char * t) { title = t; core->pszIcon = core->pszName = core->pszTree = core->pszText = (PSZ) (char*) title; }
      virtual SHORT Sort( const XContainerObject*) const { return 0; }
};


#endif
