<commit_before>/*!
 * \file dcxbutton.cpp
 * \brief blah
 *
 * blah
 *
 * \author <NAME> ( clickhere at scriptsdb dot org )
 * \version 1.0
 *
 * \b Revisions
 *
 *  ScriptsDB.org - 2006
 */

#include "dcxbutton.h"
#include "dcxdialog.h"

/*!
 * \brief Constructor
 *
 * \param ID Control ID
 * \param p_Dialog Parent DcxDialog Object
 * \param rc Window Rectangle
 * \param styles Window Style Tokenized List
 */

DcxButton::DcxButton( UINT ID, DcxDialog * p_Dialog, RECT * rc, TString & styles ) 
: DcxControl( ID, p_Dialog ) 
, m_bBitmapText(FALSE)
{

  LONG Styles = 0, ExStyles = 0;
  BOOL bNoTheme = FALSE;
  this->parseControlStyles( styles, &Styles, &ExStyles, &bNoTheme );

  this->m_Hwnd = CreateWindowEx(	
    ExStyles, 
    DCX_BUTTONCLASS, 
    NULL,
    WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | Styles, 
    rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top,
    p_Dialog->getHwnd( ),
    (HMENU) ID,
    GetModuleHandle( NULL ), 
    NULL);

  if ( bNoTheme )
    SetWindowTheme( this->m_Hwnd , L" ", L" " );

  ZeroMemory( &this->m_aBitmaps, 4*sizeof(HBITMAP) );
  ZeroMemory( &this->m_aColors, 4*sizeof(COLORREF) );

  this->m_bHover = FALSE;
  this->m_bSelected = FALSE;
  this->m_bTracking = FALSE;

  this->m_iIconSize = 16;
  this->m_ImageList = NULL;

	if (p_Dialog->getToolTip() != NULL) {
		if (styles.istok("tooltips"," ")) {

			this->m_ToolTipHWND = p_Dialog->getToolTip();

			AddToolTipToolInfo(this->m_ToolTipHWND, this->m_Hwnd);
		}
	}

  this->setControlFont( (HFONT) GetStockObject( DEFAULT_GUI_FONT ), FALSE );
  this->registreDefaultWindowProc( );
  SetProp( this->m_Hwnd, "dcx_cthis", (HANDLE) this );
}

/*!
 * \brief Constructor
 *
 * \param ID Control ID
 * \param p_Dialog Parent DcxDialog Object
 * \param mParentHwnd Parent Window Handle
 * \param rc Window Rectangle
 * \param styles Window Style Tokenized List
 */

DcxButton::DcxButton( UINT ID, DcxDialog * p_Dialog, HWND mParentHwnd, RECT * rc, TString & styles ) 
: DcxControl( ID, p_Dialog ) 
{

  LONG Styles = 0, ExStyles = 0;
  BOOL bNoTheme = FALSE;
  this->parseControlStyles( styles, &Styles, &ExStyles, &bNoTheme );

  this->m_Hwnd = CreateWindowEx(	
    ExStyles, 
    DCX_BUTTONCLASS, 
    NULL,
    WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | Styles, 
    rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top,
    mParentHwnd,
    (HMENU) ID,
    GetModuleHandle(NULL), 
    NULL);

  if ( bNoTheme )
    SetWindowTheme( this->m_Hwnd , L" ", L" " );

  ZeroMemory( &this->m_aBitmaps, 4*sizeof(HBITMAP) );
  ZeroMemory( &this->m_aColors, 4*sizeof(COLORREF) );
  ZeroMemory( &this->m_aTransp, 4*sizeof(COLORREF) );

  this->m_bHover = FALSE;
  this->m_bSelected = FALSE;
  this->m_bTracking = FALSE;

  this->m_iIconSize = 16;
  this->m_ImageList = NULL;

	if (p_Dialog->getToolTip() != NULL) {
		if (styles.istok("tooltips"," ")) {

			this->m_ToolTipHWND = p_Dialog->getToolTip();

			AddToolTipToolInfo(this->m_ToolTipHWND, this->m_Hwnd);
		}
	}

  this->setControlFont( (HFONT) GetStockObject( DEFAULT_GUI_FONT ), FALSE );
  this->registreDefaultWindowProc( );
  SetProp( this->m_Hwnd, "dcx_cthis", (HANDLE) this );
}

/*!
 * \brief blah
 *
 * blah
 */
<commit_msg>changed button control to setup default text colours correctly (now shows text in COLOR_BTNTEXT instead of black, & shows disabled button text in COLOR_GRAYTEXT)<commit_after>/*!
 * \file dcxbutton.cpp
 * \brief blah
 *
 * blah
 *
 * \author <NAME> ( clickhere at scriptsdb dot org )
 * \version 1.0
 *
 * \b Revisions
 *
 *  ScriptsDB.org - 2006
 */

#include "dcxbutton.h"
#include "dcxdialog.h"

/*!
 * \brief Constructor
 *
 * \param ID Control ID
 * \param p_Dialog Parent DcxDialog Object
 * \param rc Window Rectangle
 * \param styles Window Style Tokenized List
 */

DcxButton::DcxButton( UINT ID, DcxDialog * p_Dialog, RECT * rc, TString & styles ) 
: DcxControl( ID, p_Dialog ) 
, m_bBitmapText(FALSE)
{

  LONG Styles = 0, ExStyles = 0;
  BOOL bNoTheme = FALSE;
  this->parseControlStyles( styles, &Styles, &ExStyles, &bNoTheme );

  this->m_Hwnd = CreateWindowEx(	
    ExStyles, 
    DCX_BUTTONCLASS, 
    NULL,
    WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | Styles, 
    rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top,
    p_Dialog->getHwnd( ),
    (HMENU) ID,
    GetModuleHandle( NULL ), 
    NULL);

  if ( bNoTheme )
    SetWindowTheme( this->m_Hwnd , L" ", L" " );

  ZeroMemory( &this->m_aBitmaps, 4*sizeof(HBITMAP) );
  ZeroMemory( &this->m_aColors, 4*sizeof(COLORREF) );

  this->m_bHover = FALSE;
  this->m_bSelected = FALSE;
  this->m_bTracking = FALSE;

  this->m_iIconSize = 16;
  this->m_ImageList = NULL;

	if (p_Dialog->getToolTip() != NULL) {
		if (styles.istok("tooltips"," ")) {

			this->m_ToolTipHWND = p_Dialog->getToolTip();

			AddToolTipToolInfo(this->m_ToolTipHWND, this->m_Hwnd);
		}
	}

	this->m_aColors[0] = GetSysColor(COLOR_BTNTEXT); // normal
	this->m_aColors[1] = GetSysColor(COLOR_BTNTEXT); // hover
	this->m_aColors[2] = GetSysColor(COLOR_BTNTEXT); // pushed
	this->m_aColors[3] = GetSysColor(COLOR_GRAYTEXT); // disabled

  this->setControlFont( (HFONT) GetStockObject( DEFAULT_GUI_FONT ), FALSE );
  this->registreDefaultWindowProc( );
  SetProp( this->m_Hwnd, "dcx_cthis", (HANDLE) this );
}

/*!
 * \brief Constructor
 *
 * \param ID Control ID
 * \param p_Dialog Parent DcxDialog Object
 * \param mParentHwnd Parent Window Handle
 * \param rc Window Rectangle
 * \param styles Window Style Tokenized List
 */

DcxButton::DcxButton( UINT ID, DcxDialog * p_Dialog, HWND mParentHwnd, RECT * rc, TString & styles ) 
: DcxControl( ID, p_Dialog ) 
{

  LONG Styles = 0, ExStyles = 0;
  BOOL bNoTheme = FALSE;
  this->parseControlStyles( styles, &Styles, &ExStyles, &bNoTheme );

  this->m_Hwnd = CreateWindowEx(	
    ExStyles, 
    DCX_BUTTONCLASS, 
    NULL,
    WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | Styles, 
    rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top,
    mParentHwnd,
    (HMENU) ID,
    GetModuleHandle(NULL), 
    NULL);

  if ( bNoTheme )
    SetWindowTheme( this->m_Hwnd , L" ", L" " );

  ZeroMemory( &this->m_aBitmaps, 4*sizeof(HBITMAP) );
  ZeroMemory( &this->m_aColors, 4*sizeof(COLORREF) );
  ZeroMemory( &this->m_aTransp, 4*sizeof(COLORREF) );

  this->m_bHover = FALSE;
  this->m_bSelected = FALSE;
  this->m_bTracking = FALSE;

  this->m_iIconSize = 16;
  this->m_ImageList = NULL;

	if (p_Dialog->getToolTip() != NULL) {
		if (styles.istok("tooltips"," ")) {

			this->m_ToolTipHWND = p_Dialog->getToolTip();

			AddToolTipToolInfo(this->m_ToolTipHWND, this->m_Hwnd);
		}
	}

	this->m_aColors[0] = GetSysColor(COLOR_BTNTEXT); // normal
	this->m_aColors[1] = GetSysColor(COLOR_BTNTEXT); // hover
	this->m_aColors[2] = GetSysColor(COLOR_BTNTEXT); // pushed
	this->m_aColors[3] = GetSysColor(COLOR_GRAYTEXT); // disabled

  this->setControlFont( (HFONT) GetStockObject( DEFAULT_GUI_FONT ), FALSE );
  this->registreDefaultWindowProc( );
  SetProp( this->m_Hwnd, "dcx_cthis", (HANDLE) this );
}

/*!
 * \brief blah
 *
 * blah
 */

{'fraction_non_alphanumeric': 0.14790538614990026, 'fraction_numerical': 0.006554573952693075, 'mean_word_length': 3.6606905710491366, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 113, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6847380', 'n_tokens_mistral': 2829, 'n_tokens_neox': 2703, 'n_words': 554}