示例#1
0
文件: checkbox.cpp 项目: kdt3rd/gecko
bool checkbox_w::mouse_move( const event &e )
{
	if ( _tracking )
	{
		if ( contains( e.from_native( e.raw_mouse().x, e.raw_mouse().y ) ) )
			_current = !_state;
		else
			_current = _state;
		invalidate();
		return true;
	}
	return false;
}
示例#2
0
文件: checkbox.cpp 项目: kdt3rd/gecko
bool checkbox_w::mouse_release( const event &e )
{
	if ( e.raw_mouse().button != 1 )
		return false;

	if ( _tracking )
	{
		_tracking = false;
		if ( contains( e.from_native( e.raw_mouse().x, e.raw_mouse().y ) ) )
			set_state( _current );
		_current = _state;
		invalidate();
		context::current().release_source( e );
		return true;
	}

	return false;
}
示例#3
0
文件: checkbox.cpp 项目: kdt3rd/gecko
bool checkbox_w::mouse_press( const event &e )
{
	if ( e.raw_mouse().button != 1 )
		return false;

	context::current().grab_source( e, shared_from_this() );

	_tracking = true;
	_current = !_state;
	invalidate();

	return _tracking;
}