Esempio n. 1
0
int CRealTimeGrid::OnCellTypeNotify(long ID,int col,long row,long msg,long param)
{
	if( ID == m_buttonIndex && msg == UGCT_BUTTONCLICK )
	{
		QuickSetNumber( 0, row, 0 );
		QuickRedrawCell( 0, row );

		CUGCell cell;
		GetCell( 3, row, &cell );
		cell.SetBackColor(RGB(255,255,255));
		cell.SetTextColor(RGB(0,0,0));
		cell.SetText( _T( "Okay" ) );
		SetCell( 3, row, &cell );
		QuickRedrawCell( 3, row );

		TRACE( _T( "Reset the progress bar in row %ld" ), row );
		GotoCell( -1, row );
	}

	if( ID == UGCT_CHECKBOX && msg == UGCT_CHECKBOXSET )
	{
		if( param == TRUE )
			TRACE( _T( "Progress bar in row %ld was enabled." ), row );
		else
			TRACE( _T( "Progress bar in row %ld was disabled." ), row );
	}
		
	return TRUE;
}
void CTWenUGCtrlEx::OnSetup(void)
{
	CFont * pcFont = GetFont(m_nFontID_Content); 

	CUGCell	cell;
	GetGridDefault(&cell); 
	cell.SetTextColor(RGB(0,0,0)); 
	cell.SetFont(pcFont);
	cell.SetReadOnly(true);
	SetGridDefault(&cell); 

	CString AppPath = CApplication::GetApplicationPath();
	AppPath += _T('\\');


	m_nIndexBMP_Delete		= AddBitmap(AppPath + _T("_Action_Delete.bmp"));
	m_nIndexBMP_INF			= AddBitmap(AppPath + _T("_Action_Info.bmp"));
	m_nIndexBMP_Add			= AddBitmap(AppPath + _T("_Action_Add.bmp"));

	CString s;
	if(m_nIndexBMP_Delete<0)
		s += (_T("\r\n") + AppPath + _T("_Action_Delete.bmp"));
	if(m_nIndexBMP_INF<0) 
		s += (_T("\r\n") + AppPath + _T("_Action_Info.bmp"));
	if(m_nIndexBMP_Add<0) 
		s += (_T("\r\n") + AppPath + _T("_Action_Add.bmp"));
	if(!s.IsEmpty()) AfxMessageBox(_T("以下图片未能加载:") + s);
}
	void CNormalsDataGridCtrl::OnSetCell(int col, long row, CUGCell *cell)
	{
		ASSERT(col >= 0 && row >= -1);
		ASSERT(m_bEditable);

		if (row != -1 && col != -1)
		{
			size_t v = F2V(col);
			if (m_variables.none() || m_variables[v])
			{
				CUGCell oldCell;
				GetCellIndirect(col, row, &oldCell);

				CTRef TRef = GetTRef(row);
				ASSERT(TRef.GetTM().Type() == CTM::HOURLY);

				std::string oldStr = CStringA(oldCell.GetText());
				std::string newStr = CStringA(cell->GetText());

				if (newStr != oldStr)
				{
					size_t pos = row*GetNumberCols() + row;
					m_bDataEdited[row].set(col);

					float newValue = UtilWin::ToFloat(cell->GetText());
					m_bModified = true;

					(*m_pStation)[row][col] = newValue;
				}
			}
		}


		CUGEditCtrl::OnSetCell(col, row, cell);
	}
Esempio n. 4
0
/***************************************************
OnLClicked - overloaded CUGCellType::OnLClicked
	Checks to see if the slider has been clicked on.
	If the mouse button is pressed over the slider,
	then the slider is put into a interactive update
	state.
	Once the mouse button is release the interactive
	update state is turned off

    **See CUGCellType::OnLClicked for more details
	about this function
****************************************************/
BOOL CUGSliderType::OnLClicked(int col,long row,int updn,RECT *rect,POINT *point){

	if(updn)
	{
		m_updateSlider = FALSE;
	}

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

	//get the slider percentage
	int percent = 0;
	if(cell.IsPropertySet(UGCELL_STRING_SET))
		percent = _ttol(cell.GetText());
	//get the percent
	if(percent >100)
		percent = 100;
	else if(percent <0)
		percent = 0;

	//find the slider x position
	long width = rect->right - rect->left - 6;
	int xPos = rect->left + 3 + ((width * percent) / 100);

	int mouseX = point->x;

	if(mouseX > xPos- 6 && mouseX < xPos+6)
	{
		m_updateSlider = TRUE;
		return TRUE;
	}	

	return FALSE;
}
Esempio n. 5
0
/************************************************
OnPaint
	Paints the corner button object. The corner button object uses a CUGCell
	located at position -1,-1 from the default datasource then uses the cell
	type associated with this cell to draw itself with.
Params:
	<none>
Return:
	<none>
*************************************************/
void CUGCnrBtn::OnPaint() 
{
	if ( m_GI->m_paintMode == FALSE )
		return;

	CPaintDC dc(this); // device context for painting

	m_ctrl->OnScreenDCSetup(&dc,NULL,UG_TOPHEADING);
	
	RECT rect;
	GetClientRect(&rect);

	CUGCellType * cellType;
	CUGCell cell;
	m_ctrl->GetCellIndirect(-1,-1,&cell);

	//get the cell type to draw the cell
	if(cell.IsPropertySet(UGCELL_CELLTYPE_SET))
		cellType = m_ctrl->GetCellType(cell.GetCellType());
	else
		cellType = m_ctrl->GetCellType(-1);
	
	CFont * pOldFont = NULL;

	// get the default font if there is one
	if( m_GI->m_defFont != NULL )
	{
		pOldFont = dc.SelectObject( ( CFont* )m_GI->m_defFont );
	}
	
	cellType->OnDraw(&dc,&rect,-1,-1,&cell,0,0);

	if( m_GI->m_defFont != NULL && pOldFont != NULL )
		dc.SelectObject( pOldFont );
}
void CDDBaseGrid::QuickSetParam(int col, long row, long paramval)
{
   CUGCell cell;
   this->GetCell(col, row, &cell);
   cell.SetParam(paramval);
   this->SetCell(col, row, &cell);
}
long CDDBaseGrid::QuickGetParam(int col, long row)
{
   CUGCell cell;
   this->GetCell(col, row, &cell);
   
   return cell.GetParam();
}
	void COutputGridCtrl::OnSetup()
	{
		//change font of header
		CUGCell cell;
		GetHeadingDefault(&cell);
		CFont* pFont = GetParent()->GetFont();
		cell.SetFont(pFont);
		SetHeadingDefault(&cell);

		CStringArrayEx title(IDS_FUNCTION_TEST_CTRL);
		ASSERT(title.GetSize() == 2);

		SetNumberCols((int)title.GetSize() - 1);
		SetNumberRows((int)m_functionVector.size());

		for (int i = 0; i < title.GetSize(); i++)
		{
			QuickSetText(i - 1, -1, title[i]);
		}

		for (int i = 0; i < m_functionVector.size(); i++)
		{
			QuickSetText(-1, i, UtilWin::Convert(m_functionVector[i].m_name));
		}

		BestFit(-1, 0, 0, UG_BESTFIT_TOPHEADINGS);

		EnableToolTips();

	}
Esempio n. 9
0
void CLayerTypeDlg::fillLayerColorsInGrid()
{
   int lastColIndx = m_layerTypeGrid.GetNumberCols() - 1;
   int rowCnt = m_layerTypeGrid.GetNumberRows();

	for (int layerSet=0; layerSet<MAX_LAYERSETS; layerSet++)
	{
		for (int row=0; row < rowCnt; row++)
		{
			// get the layer type in the last column (hidden)
         CString layerTypeStrVal( m_layerTypeGrid.QuickGetText(lastColIndx, row) );
         int layerTypeIntVal = atoi(layerTypeStrVal);

         if (layerTypeIntVal < 0)
            continue;

			LayerTypeStruct *lt = &pDoc->LayerTypeArray[layerSet][layerTypeIntVal];

         int col = layerSet+1;
         m_layerTypeGrid.QuickSetBackColor(col, row, lt->color);

         CUGCell cell;
         m_layerTypeGrid.GetCell(col, row, &cell);
         cell.SetBool(lt->show);
         m_layerTypeGrid.SetCell(col, row, &cell);
		}
	}
}
Esempio n. 10
0
void CTWenUGCtrlEx::AppendRow_ButtonAdd(void)
{
	int nRow = CUGCtrl::GetNumberRows();

	if(nRow > 0)
	{
		CUGCell cell;
		GetCell(0, nRow-1, &cell);

		if(cell.GetBitmap()==GetBitmap(m_nIndexBMP_Add))//如果有增加行
		{
			return;
		}
	}

	if(AppendRow() != UG_SUCCESS) return;

	int nCol = GetNumberCols();

	JoinCells(1, nRow, nCol-1, nRow);

	if(nCol>1)
	{
		QuickSetBackColor(1, nRow, RGB(240,240,240));
		QuickSetBorder(1, nRow, UG_BDR_RAISED|UG_BDR_LTHIN|UG_BDR_RTHIN|UG_BDR_TTHIN|UG_BDR_BTHIN); 
	}

	QuickSetBitmap(0, nRow, m_nIndexBMP_Add);
}
Esempio n. 11
0
void CLayerTypeGrid::OnDClicked(int col,long row, RECT *rect,POINT *point,BOOL processed)
{
   int lastColIndx = GetNumberCols() - 1;
   CString cellText(QuickGetText(lastColIndx, row));
   int layerType = atoi(cellText);

   // Edit color if a layerType row (not a group name row)
   // and double click was not in the layer type column.
   if (layerType > -1 && col > 0)
   {
      CUGCell cell;
      GetCell(col, row, &cell); 

      COLORREF color = cell.GetBackColor(); // current color

	   CPersistantColorDialog dialog(color);
	   if (dialog.DoModal() == IDOK)
      {
	      color = dialog.GetColor();
         cell.SetBackColor(color);
         SetCell(col, row, &cell);
         RedrawAll();
      }
   }
}
Esempio n. 12
0
// v7.2 - update 04 - added as a pared down version of OnPaint to handle 
//        WM_PRINT message - called from WindowProc below. TD
void CUGCnrBtn::OnPrint(CDC *dc) 
{
	
	RECT rect;
	GetClientRect(&rect);

	CUGCellType * cellType;
	CUGCell cell;
	m_ctrl->GetCellIndirect(-1,-1,&cell);

	//get the cell type to draw the cell
	if(cell.IsPropertySet(UGCELL_CELLTYPE_SET))
		cellType = m_ctrl->GetCellType(cell.GetCellType());
	else
		cellType = m_ctrl->GetCellType(-1);
	
	CFont * pOldFont = NULL;

	// get the default font if there is one
	if( m_GI->m_defFont != NULL )
	{
		pOldFont = dc->SelectObject( ( CFont* )m_GI->m_defFont );
	}
	
	cellType->OnDraw(dc,&rect,-1,-1,&cell,0,0);

	if( m_GI->m_defFont != NULL && pOldFont != NULL )
		dc->SelectObject( pOldFont );
}
Esempio n. 13
0
void CLayerTypeDlg::applyChanges()
{
   int rows = m_layerTypeGrid.GetNumberRows();
	
	// apply all layer set colors
	for (int layerSet = 0; layerSet < MAX_LAYERSETS; layerSet++)
	{
		for (int row = 0; row < rows; row++)
		{
			// get the layer type in the last column (hidden)
         int lastColIndx = m_layerTypeGrid.GetNumberCols() - 1;
         CString layerTypeStr( m_layerTypeGrid.QuickGetText(lastColIndx, row) );
         int layerType = atoi(layerTypeStr);

			if (layerType < 0)
				continue;

         int layerSetColIndx = layerSet + 1;

			LayerTypeStruct *lt = &pDoc->LayerTypeArray[layerSet][layerType];
			
         CUGCell cell;
         m_layerTypeGrid.GetCell(layerSetColIndx, row, &cell);
         COLORREF color = cell.GetBackColor();
         BOOL show = cell.GetBool();

			lt->color = color;
			lt->show = show;
		}
	}
}
Esempio n. 14
0
/***************************************************
GetJoinRange
	function returns join information related to the cell specified
	in the col and row parameters.  These parameters might be changed
	to represent starting col, row position of the join.
Params:
	col, row	- identify the cell to retrieve join information on,
				  these parameters will represent the starting pos
				  of the join.
	endCol,		- will be set to the end col, row position of the
	endRow		  join.
Returns:
	UG_SUCCESS	- on success
	UG_ERROR	- if joins are disabled, or cell specified is not part of a join
*****************************************************/
int CUGTopHdg::GetJoinRange(int *col,int *row,int *endCol,int *endRow)
{
	if(m_GI->m_enableJoins == FALSE)
		return UG_ERROR;

	int startCol;
	long startRow, joinRow;
	BOOL origin;
	CUGCell cell;

	m_ctrl->GetCellIndirect(*col,*row,&cell);
	if(cell.IsPropertySet(UGCELL_JOIN_SET) == FALSE)
		return UG_ERROR;

	cell.GetJoinInfo(&origin,&startCol,&startRow);
	if(!origin)
	{
		*col += startCol;
		*row += (int)startRow;
		m_ctrl->GetCellIndirect(*col,*row,&cell);
	}

	cell.GetJoinInfo(&origin,endCol,&joinRow);
	*endCol +=*col;
	*endRow = joinRow + *row;

	return UG_SUCCESS;
}
Esempio n. 15
0
int CDDBaseGrid::QuickSetBool(int col, long row, bool val)
{
   CUGCell cell;
   GetCell(col, row, &cell);
   cell.SetBool(val);
   SetCell(col, row, &cell);

   return UG_SUCCESS;
}
Esempio n. 16
0
void CDDBaseGrid::SetMultiColHeading(int col1, int row1, int col2, int row2, CString headingStr)
{
   CUGCell cell;

   int res = JoinCells(col1, row1, col2, row2);
	GetCell(col1, row1, &cell);
   cell.SetCellTypeEx(UGCT_NORMALMULTILINE);
   SetCell(col1, row1, &cell);
   QuickSetText(col1, row1, headingStr);
}
Esempio n. 17
0
/***************************************************
OnLClicked - overloaded CUGCellType::OnLClicked
	Allows the progress bars value to be set interactivly
	if SetCanAdjust() is set to TRUE.

    **See CUGCellType::OnLClicked for more details
	about this function
****************************************************/
BOOL CUGAdvProgressType::OnLClicked(int col, long row, int updn, RECT *rect, POINT *point){
	if (!m_canAdjust)
		return UG_SUCCESS;

	int ref = 0, span = 0;
	CUGCell mycell;
	float ftemp;
	if (updn==1){
		m_ctrl->GetCell(col, row, &mycell);

		switch(m_direction){
		case UGCT_PROGRESS_LEFT:
			ref = point->x - rect->left;
			span = rect->right - rect->left; 
			break;
		case UGCT_PROGRESS_TOP:
			ref = point->y - rect->top;
			span = rect->bottom - rect->top; 
			break;
		case UGCT_PROGRESS_RIGHT:
			ref = point->x - rect->right;
			span = rect->left - rect->right; 
			break;
		case UGCT_PROGRESS_BOTTOM:
			ref = point->y - rect->bottom;
			span = rect->top - rect->bottom; 
			break;
		}
		ftemp = ((float)ref / (float)span) * 100;
		if (ftemp>98)
				ftemp=(float)100;
		if (ftemp<2)
				ftemp=(float)0;

		mycell.SetNumber(ftemp);
		m_ctrl->SetCell(col, row, &mycell);

		m_lbuttondown = TRUE;
		m_row = row;
		m_col = col;
		CopyRect(&m_rect,rect);
		m_ctrl->RedrawCell(col, row);

		return TRUE;
	} else {
		// the mouse button was released
		m_lbuttondown = FALSE;

	}

	return FALSE;
}
Esempio n. 18
0
/////////////////////////////////////////////////////////////////////////////
//	OnSetup
//		This function is called just after the grid window 
//		is created or attached to a dialog item.
//		It can be used to initially setup the grid
void CDropDayCug::OnSetup()
{
	SetUserSizingMode( 0 );
	SetDefRowHeight( 50 );
	EnableMenu( TRUE );
	SetDefFont( AddFont( "Arial", -13, 400 ));
	m_crossedFont.CreateFont( -13, 0, 0, 0, 400, 0, 0, 1, 0, 0, 0, 0, 0, "Arial" );

	CUGCell cell;
	GetHeadingDefault( &cell );
	cell.SetFont( GetFont( AddFont( "Arial", -13, 700 )));
	SetHeadingDefault( &cell );
}
Esempio n. 19
0
void CTWenUGCtrlEx::OnLClicked(int col,long row, int updn, RECT *rect, POINT *point, int processed)
{
	CUGCell cell;
	GetCell(col, row, &cell);

	if(updn==FALSE)//只有当鼠标放开的时候才执行
	{
		if(cell.GetBitmap()==GetBitmap(m_nIndexBMP_Delete)) Action_DeleteRow(row);
		else if(cell.GetBitmap()==GetBitmap(m_nIndexBMP_INF)) Action_DisplayRowInf(row);
		else if(cell.GetBitmap()==GetBitmap(m_nIndexBMP_Add)) Action_AddRow();
		else CUGCtrl::OnLClicked(col,row, updn, rect, point, processed);
	}
	else CUGCtrl::OnLClicked(col,row, updn, rect, point, processed);
}
Esempio n. 20
0
void CTWenUGCtrlEx::RomoveRow_ButtonAdd(void)
{
	int nRow = CUGCtrl::GetNumberRows();

	if(nRow == 0) return;

	CUGCell cell;
	GetCell(0, nRow-1, &cell);

	if(cell.GetBitmap()==GetBitmap(m_nIndexBMP_Add))//如果有增加行
	{
		DeleteRow(nRow-1);
	}
}
Esempio n. 21
0
int CDDBaseGrid::QuickSetTextAndColor(int col, long row, LPCTSTR string, COLORREF color)
{
   // A convenient consolidation of QuickSetText and QuickSetColor, in order to
   // reduce the overall GetCell/SetCell calls, but also to reduce the number
   // of grid func calls in the application.

	///m_cell.ClearAll();
   CUGCell cell;
	GetCell(col, row, &cell);
   cell.SetText(string);
	cell.SetTextColor(color);
	SetCell(col, row, &cell);

	return UG_SUCCESS;
}
Esempio n. 22
0
/***************************************************
OnMouseMove - overloaded CUGCellType::OnMouseMove
	
    **See CUGCellType::OnMouseMove for more details
	about this function
****************************************************/
BOOL CUGNoteType::OnMouseMove(int col,long row,POINT *point,UINT nFlags){

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

	if(point->x > rect.left && point->x < rect.right && point->y > rect.top && point->y < rect.bottom){
		if(m_noteWnd.IsWindowVisible() == FALSE ){

			//set the position of the note window
			RECT gridRect;
			m_ctrl->m_CUGGrid->GetClientRect(&gridRect);

			// show the note window to the right to the cell
			rect.left = rect.right + OFSET_HORIZ;
			rect.right = rect.left + m_nNoteWidth;

			if ( rect.top > OFSET_VERT )
				rect.top = rect.top - OFSET_VERT;
			rect.bottom = rect.top + m_nNoteHeight;

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

			m_noteWnd.SetWindowPos(&CWnd::wndTop,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE);
			m_noteWnd.MoveWindow(&rect);
			m_noteWnd.SetWindowText(cell.GetLabelText());
			m_noteWnd.ShowWindow(SW_SHOW);

			m_ctrl->GetCellRect(col,row,&m_noteCellRect);
			m_ctrl->m_CUGGrid->ClientToScreen(m_noteCellRect);

			if(m_timerID != 0)
				KillTimer(m_ctrl->m_hWnd,m_timerID);
			m_timerID = SetTimer(m_noteWnd.m_hWnd,100,200,TimerProc);
		}
		else if(m_timerID == 0){
			m_noteWnd.ShowWindow(SW_HIDE);
		}
	}
	else{
		m_noteWnd.ShowWindow(SW_HIDE);
		KillTimer(m_ctrl->m_hWnd,m_timerID);
	}
	
	return FALSE;
}
Esempio n. 23
0
void CLayerTypeGrid::SetRowCellsToCheckBox(int row)
{
   // Not the first column and not the last column, but all columns in between.
   int rowCnt = this->GetNumberRows();
   int colCnt = this->GetNumberCols();

   for (int colIndx = 1; colIndx < (colCnt-1); colIndx++)
   {
      CUGCell cell;

      GetCell(colIndx, row, &cell); 
      cell.SetCellType(UGCT_CHECKBOX);  // To make it a checkbox cell
      cell.SetCellTypeEx(UGCT_CHECKBOXCHECKMARK); // To make the checkbox use checkmark as opposed to cross mark.
      SetCell(colIndx, row, &cell);
   }
}
Esempio n. 24
0
void CNPBPSType1Grid::OnSetup()
{
	try
	{					
		int	nIndex = 0;
		CUGCell cell;
		GetGridDefault(&cell);
		SetGridDefault(&cell);
		EnableExcelBorders(FALSE);
		SetHighlightRow(TRUE, FALSE);
		SetDoubleBufferMode(TRUE);
		SetUserSizingMode( TRUE );			
		// Create and set default font
		AddFont(L"Arial", -12, FW_NORMAL);
		AddFont(L"Arial", -12, FW_BOLD);
		SetDefFont(0);	
		CDC * pDC;	
		int iHeight;
		int i, j;	
		pDC = GetDC( );	
		iHeight = -MulDiv( 8, GetDeviceCaps( pDC->m_hDC, LOGPIXELSY), 72 );
		m_font.CreateFont( iHeight, 0, 0, 0, 400, 0, 0, 0, 0, 0, 0, 0, 0, _T( "MS Sans Serif" ) );	
		ReleaseDC( pDC );
		SetDefFont( &m_font );		
		GetGridDefault( &cell );
		cell.SetAlignment( UG_ALIGNCENTER | UG_ALIGNVCENTER );
		SetGridDefault( &cell );
		SetNumberCols( 7);		
		m_iArrowIndex = AddCellType( &m_sortArrow );
		SetCurrentCellMode( 2 );
		UseHints( TRUE );
		SetSH_Width( 0 );	
		QuickSetCellType( 0, -1, m_iArrowIndex );
		SortBy( 0, UG_SORT_ASCENDING );
		m_iSortCol = 0;
		m_bSortedAscending = TRUE;		
		InitMenu();
		SetTimer(0, 100, NULL);

		m_pThreads=AfxBeginThread(Show_NPBPStype1, this);	
	}
	 catch(_com_error & ce)
	{
		AfxMessageBox(ce.Description()+L"   writeData");			
	}
}
Esempio n. 25
0
VOID CALLBACK EXPORT CUGMarqueeType::TimerProc(
			HWND hwnd,         // handle to window
			UINT uMsg,         // WM_TIMER message
			unsigned int idEvent,  // timer identifier
			DWORD dwTime       // current system time
			)
#endif
{
	UNREFERENCED_PARAMETER(dwTime);
	UNREFERENCED_PARAMETER(uMsg);
	
	CUGCtrl* ctrl = (CUGCtrl*)CWnd::FromHandle(hwnd);
	//check for errors
	if(ctrl == NULL)	
		return;

	//check to see if any CUGMarqueeType cells are visible
	//if so then mark them for redraw
	int leftCol = ctrl->GetLeftCol();
	int rightCol = ctrl->GetRightCol();
	long topRow = ctrl->GetTopRow();
	long bottomRow = ctrl->GetBottomRow();

	CUGCell cell;
	for(long rows = topRow; rows <= bottomRow; rows++){
		for(int cols = leftCol; cols <= rightCol; cols++){
			ctrl->GetCell(cols,rows,&cell);
			if(cell.GetCellType() == (int)idEvent){

				//run other windows messages first

				//update the position for the next time the cell is drawn
				cell.SetParam(cell.GetParam() +1);
				ctrl->SetCell(cols,rows,&cell);
				
				RECT rect;
				ctrl->GetCellRect(cols,rows,&rect);
				ctrl->m_CUGGrid->m_drawHint.AddHint(cols,rows,cols,rows);
				if(ctrl->GetCurrentRow() != rows || ctrl->GetCurrentCol() != cols)
					ctrl->TempDisableFocusRect();
				ctrl->m_CUGGrid->PaintDrawHintsNow(&rect);
			}
		}
	}

}
Esempio n. 26
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;
}
Esempio n. 27
0
void CNPBPSType1Grid::filter()
{
	try
	{
	 CMenu *pMnenu;
	pMnenu= GetPopupMenu();

	if ( CNPBPSType1Grid::insertFilterFlag==0)
	{
			addItemToCombobox();
			CNPBPSType1Grid::insertFilterFlag=1;
			InsertRow(0);
			for (int col_count=0;col_count<13;col_count++)
			{
				CUGCell cell;
				int row=0;
				int col=col_count;
				cell.ClearAll();
				cell.SetCellType(UGCT_DROPLIST);
				cell.SetCellTypeEx(UGCT_DROPLISTHIDEBUTTON);
				cell.SetParam(CELLTYPE_IS_EDITABLE);
				QuickSetRange(col,row,col,row,&cell);
				QuickSetLabelText(col,row,str[col_count]);
			}
			pMnenu->CheckMenuItem(2001,MF_CHECKED);

	}
	else
	{
		
		DeleteRow(0);
		CNPBPSType1Grid::insertFilterFlag=0;
		
		pMnenu->CheckMenuItem(2001,MF_UNCHECKED);
	}
	RedrawAll();
	}
	catch(_com_error & ce)
	{
		AfxMessageBox(ce.Description()+L"   filter");			
	} 
 }
Esempio n. 28
0
void CLayerTypeGrid::OnLClicked(int col,long row, int updn, RECT *rect, POINT *point, int processed) 
{
   // A click will get two event calls here, one for button down (updn = true) and one
   // for button up. We don't want to do this twice for a single click.
   // So react only to the button up, that is the end of the click event.
   if (updn)
      return;  // Ignore the button down.

   int lastColIndx = GetNumberCols() - 1;
   CString cellText(QuickGetText(lastColIndx, row));
   int layerType = atoi(cellText);

   // Toggle expand/collapse if layer type indicates this is a layer group row.
   // React only if cell was first column cell.
   if (layerType < 0 && col == 0)
   {
      int rowCnt = GetNumberRows();

      CUGCell cell;
      GetCell(col, row, &cell);

      // We use the "+" and "-" in name to track expanded/collapsed state.
      // The char shows the current state.
      CString groupNameText( cell.GetText() );
      bool isExpanded = (groupNameText.Left(1).Compare("-") == 0);

      if (isExpanded)
      {
         // Is expanded, perform collapse.
         CollapseLayerGroup(row);
         RedrawAll();
      }
      else
      {
         // Is collapsed, perform expand.
         ExpandLayerGroup(row);
         RedrawAll();
      }
   }
}
Esempio n. 29
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 );
	}
}
Esempio n. 30
0
int CDDBaseGrid::QuickSetNumber(int col, long row, int number)
{
   // The standard set number takes double args, and one can set number of
   // decimal places. This convenience func just puts them together in one place.
   CUGCell cell;
   this->GetCell(col, row, &cell);
   cell.SetPropertyFlags( cell.GetPropertyFlags() | UGCELL_DONOT_LOCALIZE );
   cell.SetNumber( (double)number );
   cell.SetNumberDecimals( 0 );
   cell.SetTextColor(colorBlack);
   this->SetCell(col, row, &cell);

   return UG_SUCCESS;
}