#require <Classes/ActiveBasic/Windows/UI/Control.ab>

Namespace ActiveBasic
Namespace Windows
Namespace UI

/*!
@date 2008/10/16
@brief	ウィンドウクラス"BUTTON"用基底クラス。
@author Egtra
*/
Class ButtonBase
	Inherits WmCommandControl
Protected
	Override Sub GetCreateStruct(ByRef cs As CREATESTRUCT)
		cs.lpszClass = "BUTTON"
	End Sub

	Sub ButtonBase()
	End Sub
Public
	Sub RaiseClick()
		OnClick(Args.Empty)
	End Sub

	Override Function RaiseCommandEvent(notificationCode As Word) As Boolean
		Dim lr As LRESULT
		RaiseCommandEvent = False
		Select Case notificationCode
			Case BN_CLICKED
				RaiseCommandEvent = OnClick(Args.Empty)
			Case BN_DBLCLK
				RaiseCommandEvent = OnDoubleClick(Args.Empty)
			Case BN_SETFOCUS
				RaiseCommandEvent = ProcessMessage(WM_SETFOCUS, 0, 0, lr)
			Case BN_KILLFOCUS
				RaiseCommandEvent = ProcessMessage(WM_KILLFOCUS, 0, 0, lr)
			'ここに挙げられなかったBNメッセージは、16ビットWindowsとの互換性のためとされているもの。
		End Select
	End Function

End Class

End Namespace 'UI
End Namespace 'Widnows
End Namespace 'ActiveBasic
