// DrawBut.cpp : implementation file
//

#include "stdafx.h"
#include "wgscnf.h"
#include "DrawBut.h"
#include "OptEdit.h"
#include "CnfAsrt.h"

#define FILREV "$Revision: 1 $"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// DrawButton

DrawButton::DrawButton()
{
}

DrawButton::~DrawButton()
{
}


BEGIN_MESSAGE_MAP(DrawButton, CButton)
     //{{AFX_MSG_MAP(DrawButton)
     ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
     ON_CONTROL_REFLECT(BN_DOUBLECLICKED, OnDoubleclicked)
     //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// DrawButton message handlers

BOOL DrawButton::Create( const CRect &rect, CWnd *parent, UINT id, CFont *font )
{
     BOOL      result = CButton::Create( "WgsDraw", 
                                         WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,
                                         rect, parent, id
                                       );

     CnfAssert( result );

     if (result)
     {
          if (font != NULL)
          {
               SetFont( font );
          }
     }

     return( result );
}

void DrawButton::OnClicked() 
{
     OptionEditView *parent = static_cast< OptionEditView * >( GetParent() );

     CnfAssert( parent != NULL );

     parent->CustomEdit();
}

void DrawButton::OnDoubleclicked() 
{
     OnClicked();
}
