/***************************************************************************
 *                          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 M.
 *--------------------------------------------------------------------------
 * @purpose:  ZModeler's Image and Text buttons helper class
 *--------------------------------------------------------------------------
 * @histroy: 02.11.2002. Created
 */
#ifndef controlbutton_h_included
#define controlbutton_h_included

#include <zmodeler.h>
#include <core/ui/uiTypes.h>

//-----------------------------------------------------
//  ZImageButton : button based on the resource image
//-----------------------------------------------------
class DLL_LINKAGE ZImageButton
{
public:
  ZImageButton();
  ~ZImageButton(){}

  ZRESULT setPosition(ZPoint ptTo);
  ZRESULT getRect(ZRect& rect);
  LPCRECT getRect();
  ZRESULT isIn(ZPoint& pt);
  ZRESULT hitTest(ZPoint& pt, bool bLButtonDown, long& nHitRes, long nHitDefault);
  void    draw(CDC* pDC);
  void    drawDirect(ZOpaque/*(Gdiplus::Graphics)*/* pGraph);

public:
  bool    m_bPushed;
  bool    m_bActive;
  bool    m_bPushLike;
  bool    m_bVisible;

protected:
  ZRect   m_Rect;
public:
  core::ui::eImageResource    m_DefImage, m_HlImage, m_PushImage;
  long   m_dwUserImgDef, m_dwUserImgHl, m_dwUserImgPsh;
  ZStdPtr<core::ui::IGraphManager>    m_pGraphManager;
};


//-----------------------------------------------------
//  ZTextButton : button with text label
//-----------------------------------------------------
class DLL_LINKAGE ZTextButton
{
public:
  ZTextButton();
  ~ZTextButton() {if (m_pszTitle) free(m_pszTitle);}

  ZRESULT setPosition(ZPoint ptTo);
  ZRESULT getRect(ZRect& rect);
  LPCRECT getRect();
  ZRESULT setRect(const ZRect rect);
  ZRESULT isIn(ZPoint& pt);
  ZRESULT hitTest(ZPoint& pt, bool bLButtonDown, long& nHitRes, long nHitDefault);
  ZRESULT initResources(core::ui::IGraphManager* pGraphManager);
  ZRESULT setTitle(LPCTSTR strTitle);
  void    draw(CDC* pDC);
  void    drawDirect(ZOpaque/*(Gdiplus::Graphics)*/* pGraph);

public:
  bool    m_bPushed;
  bool    m_bActive;
  bool    m_bPushLike;
  bool    m_bVisible;
  bool    m_bBoldHover, m_bBoldDefault;

protected:
  ZRect     m_Rect;
  wchar_t*  m_pszTitle;
public:
  core::ui::eBrushResource            m_brushDefault, m_brushHover;
  core::ui::ePenResource              m_penHighlight, m_penShadow;
  ZStdPtr<core::ui::IGraphManager>    m_pGraphManager;
};


#endif //controlbutton_h_included

