Exemple #1
0
/***************************************************
OnMouseMove - overloaded CUGCellType::OnMouseMove
	If the slider update state has been activated
	with during OnLClicked. Then this function tracks
	the position of the mouse and updates the cells
	value according to the mouses position along the
	slider (0-100 percent). As the value changes the
	slider is redrawn.

    **See CUGCellType::OnMouseMove for more details
	about this function
****************************************************/
BOOL CUGSliderType::OnMouseMove(int col,long row,POINT *point,UINT flags){

	if((flags& MK_LBUTTON)== FALSE){
		return FALSE;
	}

	if(m_updateSlider){

		RECT rect;
		m_ctrl->GetCellRect(col,row,&rect);

		long mouseX = point->x - rect.left - 3;

		if(mouseX < 0)
			mouseX = 0;

		long width = rect.right - rect.left - 6;

		long percent = (mouseX*100)/width;

		if(percent < 0)
			percent = 0;
		if(percent > 100)
			percent = 100;

		CUGCell cell;
		m_ctrl->GetCellIndirect(col,row,&cell);

		if ( cell.GetReadOnly() == TRUE )
			return FALSE;

		if(percent != (long)cell.GetNumber())
		{
			cell.SetNumber(percent);
			m_ctrl->SetCell(col,row,&cell);
			m_ctrl->RedrawCell(col,row);

			OnCellTypeNotify(m_ID, col, row, UGCT_SLIDER_MOVED, percent);
		}
		return TRUE;
	}
	return FALSE;
}
Exemple #2
0
/////////////////////////////////////////////////////////////////////////////
//	OnGetCell
//		This message is sent everytime the grid needs to
//		draw a cell in the grid. At this point the cell
//		object has been populated with all of the information
//		that will be used to draw the cell. This information
//		can now be changed before it is used for drawing.
//	Warning:
//		This notification is called for each cell that needs to be painted
//		Placing complicated calculations here will slowdown the refresh speed.
//	Params:
//		col, row	- coordinates of cell currently drawing
//		cell		- pointer to the cell object that is being drawn
//	Return:
//		<none>
void CDropDayCug::OnGetCell(int col,long row,CUGCell *cell)
{
	if ( col == 0 && row == -1 )
		cell->SetText( "" );
	else if ( col == 0 && row >= 0 )
	{
		cell->SetCellType( UGCT_CHECKBOX );
		cell->SetCellTypeEx( UGCT_CHECKBOXCHECKMARK|UGCT_CHECKBOXUSEALIGN );
		cell->SetAlignment( UG_ALIGNCENTER|UG_ALIGNVCENTER );

		if ( row == GetNumberRows() -1 )
			cell->SetReadOnly( TRUE );
	}
	else if ( col == 1 && row >= 0 )
	{
		CUGCell checkCell;
		GetCell( 0, row, &checkCell );

		if ( checkCell.GetNumber() > 0 )
			cell->SetFont( &m_crossedFont );
	}
}
Exemple #3
0
/***************************************************
OnMouseMove - overloaded CUGCellType::OnMouseMove
	Allows the progress bars value to be set interactivly
	if SetCanAdjust() is set to TRUE.

    **See CUGCellType::OnMouseMove for more details
	about this function
****************************************************/
BOOL CUGAdvProgressType::OnMouseMove(int col,long row,POINT *point,UINT flags){

	UNREFERENCED_PARAMETER(col);
	UNREFERENCED_PARAMETER(row);

	if((flags&MK_LBUTTON) == FALSE)
		return FALSE;

	if (!m_canAdjust)
		return FALSE;

	int ref = 0, span = 0;
	float ftemp;
	CUGCell mycell;

	if (point->x>m_rect.right) 
		point->x = m_rect.right;
	if (point->x<m_rect.left)  
		point->x = m_rect.left;
	if (point->y>m_rect.bottom) 
		point->y = m_rect.bottom;
	if (point->y<m_rect.top) 
		point->y = m_rect.top;

	m_ctrl->GetCell(m_col, m_row, &mycell);


	switch(m_direction){

		case UGCT_PROGRESS_LEFT:
			ref = point->x - m_rect.left;
			span = m_rect.right - m_rect.left; 
			break;
		case UGCT_PROGRESS_TOP:
			ref = point->y - m_rect.top;
			span = m_rect.bottom - m_rect.top; 
			break;
		case UGCT_PROGRESS_RIGHT:
			ref = point->x - m_rect.right;
			span = m_rect.left - m_rect.right; 
			break;
		case UGCT_PROGRESS_BOTTOM:
			ref = point->y - m_rect.bottom;
			span = m_rect.top - m_rect.bottom; 
			break;
	}
	
	ftemp = ((float)ref / (float)span) * 100;
	

	if((flags&MK_LBUTTON)){
		// we are resizing the progress bar
		// find the new mouse position, and change the percent value in the
		// cell to reflect the mouse position
	
		mycell.SetNumber(ftemp);
		m_ctrl->SetCell(m_col, m_row, &mycell);
		m_ctrl->RedrawCell(m_col, m_row);

	} else {
		// we just moving over the resize area, not changing the progress bar
		// if the mouse pointer moves within 5 pixels of the current progress bar setting
		// then we should change the mouse pointer to double resize arrows.

		if (abs((int)ftemp - (int)mycell.GetNumber()) < 5){
			if (m_direction == UGCT_PROGRESS_TOP || m_direction == UGCT_PROGRESS_BOTTOM){
				// change the mouse pointer to double arrows left and right
			} else {
				// change the mouse pointer to double up and down arrows
			}
		}else{
		}
			// change mouse pointer to normal


	}
	return TRUE;
}