/// <summary> /// 按钮点击事件 /// </summary> /// <param name="sender">调用者</param> /// <param name="mp">坐标</param> /// <param name="button">按钮</param> /// <param name="click">点击次数</param> /// <param name="delta">滚轮滚动值</param> private void clickButton(object sender, FCTouchInfo touchInfo) { if (touchInfo.m_firstTouch && touchInfo.m_clicks == 1) { FCView control = sender as FCView; String name = control.Name; if (name == "btnCancel") { close(); } else if (name == "btnOK") { FCTextBox txtName = getTextBox("txtName"); FCTextBox txtScript = getTextBox("txtScript"); List <IndicatorData> indicatorDatas = m_mainFrame.m_indicators; IndicatorData newIndicatorData = null; //判断是否重复 int indicatorDatasSize = indicatorDatas.Count; for (int i = 0; i < indicatorDatasSize; i++) { IndicatorData indicatorData = indicatorDatas[i]; if (indicatorData.m_name == txtName.Text) { if (m_isEdit) { newIndicatorData = indicatorData; } else { MessageBox.Show("该指标名称已经存在!", "提示"); return; } } } //添加指标 if (!m_isEdit) { newIndicatorData = new IndicatorData(); indicatorDatas.Add(newIndicatorData); } newIndicatorData.m_name = txtName.Text; newIndicatorData.m_script = txtScript.Text; String path = Application.StartupPath + "\\indicators.txt"; String content = JsonConvert.SerializeObject(indicatorDatas); FCFile.write(path, content); if (!m_isEdit) { m_mainFrame.addIndicator(newIndicatorData); } close(); Native.update(); Native.invalidate(); } else if (name == "lblDelete") { m_mainFrame.removeIndicator(m_indicatorData); close(); } } }
/// <summary> /// 触摸按下方法 /// </summary> /// <param name="touchInfo">触摸信息</param> public override void onTouchDown(FCTouchInfo touchInfo) { base.onTouchDown(touchInfo); if (touchInfo.m_firstTouch && touchInfo.m_clicks == 1) { if (m_allowResize) { ArrayList <FCGridBand> bands = null; if (m_parentBand != null) { bands = m_parentBand.getBands(); } else { bands = m_grid.getBands(); } int bandsSize = bands.size(); if (m_index > 0 && touchInfo.m_firstPoint.x < 5) { m_resizeState = 1; m_beginWidth = bands[m_index - 1].Width; } else if ((m_parentBand == null || m_index < bandsSize - 1) && touchInfo.m_firstPoint.x > Width - 5) { m_resizeState = 2; m_beginWidth = Width; } m_touchDownPoint = Native.TouchPoint; } } }
/// <summary> /// 触摸点击事件 /// </summary> /// <param name="touchInfo">触摸信息</param> public void onClick(FCTouchInfo touchInfo) { if (m_calendar != null && m_day != null) { m_calendar.SelectedDay = m_day; } }
/// <summary> /// 表格单元格点击事件 /// </summary> /// <param name="sender">调用者</param> /// <param name="cell">单元格</param> /// <param name="mp">坐标</param> /// <param name="button">按钮</param> /// <param name="clicks">点击次数</param> /// <param name="delta">滚轮值</param> private void gridCellClick(object sender, FCGridCell cell, FCTouchInfo touchInfo) { if (touchInfo.m_firstTouch && touchInfo.m_clicks == 2) { onSelectRow(); } }
/// <summary> /// 预处理触摸事件 /// </summary> /// <param name="eventID">事件ID</param> /// <param name="touchInfo">触摸信息</param> /// <returns>状态</returns> public override bool onPreviewsTouchEvent(int eventID, FCTouchInfo touchInfo) { if (callPreviewsTouchEvents(FCEventID.PREVIEWSTOUCHEVENT, eventID, touchInfo)) { return(true); } if (m_allowPreviewsEvent) { if (eventID == FCEventID.TOUCHDOWN) { onDragScrollStart(); } else if (eventID == FCEventID.TOUCHMOVE) { onDragScrolling(); } else if (eventID == FCEventID.TOUCHUP) { bool state = m_isDragScrolling; onDragScrollEnd(); if (state && !m_isDragScrolling2) { return(false); } } } return(false); }
/// <summary> /// 触摸点击方法 /// </summary> /// <param name="touchInfo">触摸信息</param> public void onClick(FCTouchInfo touchInfo) { FCPoint mp = touchInfo.m_firstPoint; int monthButtonsSize = m_monthButtons.size(); for (int i = 0; i < monthButtonsSize; i++) { MonthButton monthButton = m_monthButtons.get(i); if (monthButton.Visible) { FCRect bounds = monthButton.Bounds; if (mp.x >= bounds.left && mp.x <= bounds.right && mp.y >= bounds.top && mp.y <= bounds.bottom) { monthButton.onClick(touchInfo); return; } } } int monthButtonAmSize = m_monthButtons_am.size(); for (int i = 0; i < monthButtonAmSize; i++) { MonthButton monthButton = m_monthButtons_am.get(i); if (monthButton.Visible) { FCRect bounds = monthButton.Bounds; if (mp.x >= bounds.left && mp.x <= bounds.right && mp.y >= bounds.top && mp.y <= bounds.bottom) { monthButton.onClick(touchInfo); return; } } } }
/// <summary> /// 单元格点击事件 /// </summary> /// <param name="cell">单元格</param> /// <param name="mp">坐标</param> /// <param name="button">按钮</param> /// <param name="clicks">点击次数</param> /// <param name="delta">滚轮值</param> public override void onCellClick(FCGridCell cell, FCTouchInfo touchInto) { base.onCellClick(cell, touchInto); List <FCGridRow> rows = m_rows; int rowsSize = rows.Count; for (int i = 0; i < rowsSize; i++) { FCGridRow row = rows[i]; List <FCGridCell> cells = row.getCells(); int cellsSize = cells.Count; for (int j = 0; j < cellsSize; j++) { FCGridControlCell cCell = cells[j] as FCGridControlCell; if (cCell != null) { if (row == cell.Row) { cCell.Control.TextColor = FCDraw.FCCOLORS_TEXTCOLOR4; } else { cCell.Control.TextColor = FCColor.Text; } } } } }
/// <summary> /// 触摸点击方法 /// </summary> /// <param name="touchInfo">触摸信息</param> public override void onTouchDown(FCTouchInfo touchInfo) { base.onTouchDown(touchInfo); bool close = closeMenus(m_items); Native.invalidate(); }
/// <summary> /// 单元格触摸移动方法 /// </summary> /// <param name="cell">单元格</param> /// <param name="touchInfo">触摸信息</param> public override void onCellTouchMove(FCGridCell cell, FCTouchInfo touchInfo) { base.onCellTouchMove(cell, touchInfo); if (m_movingNode != null) { invalidate(); } }
/// <summary> /// 触摸抬起方法 /// </summary> /// <param name="touchInfo">触摸信息</param> public override void onTouchUp(FCTouchInfo touchInfo) { base.onTouchUp(touchInfo); if (!m_allowPreviewsEvent) { onDragScrollEnd(); } }
/// <summary> /// 滚动按钮触摸滚动事件 /// </summary> /// <param name="sender">调用者</param> /// <param name="touchInfo">触摸信息</param> protected void scrollButtonTouchWheel(object sender, FCTouchInfo touchInfo) { FCTouchInfo newTouchInfo = touchInfo.clone(); newTouchInfo.m_firstPoint = TouchPoint; newTouchInfo.m_secondPoint = TouchPoint; onTouchWheel(newTouchInfo); }
/// <summary> /// 触摸按下方法 /// </summary> /// <param name="touchInfo">触摸信息</param> public override void onTouchDown(FCTouchInfo touchInfo) { base.onTouchDown(touchInfo); if (!m_allowPreviewsEvent) { onDragScrollStart(); } }
/// <summary> /// 页头触摸按下方法 /// </summary> /// <param name="sender">调用者</param> /// <param name="touchInfo">触摸信息</param> protected void HeaderTouchDown(object sender, FCTouchInfo touchInfo) { if (m_tabControl != null) { m_tabControl.SelectedTabPage = this; m_tabControl.invalidate(); } }
/// <summary> /// 触摸移动方法 /// </summary> /// <param name="touchInfo">触摸信息</param> public override void onTouchMove(FCTouchInfo touchInfo) { base.onTouchMove(touchInfo); if (m_parentMenu != null) { m_parentMenu.onMenuItemTouchMove(this, touchInfo); } }
/// <summary> /// 触摸点击方法 /// </summary> /// <param name="touchInfo">触摸信息</param> public override void onClick(FCTouchInfo touchInfo) { base.onClick(touchInfo); if (m_linkVisited) { m_visited = true; } }
/// <summary> /// 点击方法 /// </summary> /// <param name="touchInfo">触摸信息</param> public override void onClick(FCTouchInfo touchInfo) { if (!Checked) { Checked = !Checked; } callTouchEvents(FCEventID.CLICK, touchInfo); invalidate(); }
/// <summary> /// 控件项鼠标抬起事件 /// </summary> /// <param name="sender">调用者</param> /// <param name="mp">坐标</param> /// <param name="button">按钮</param> /// <param name="clicks">点击次数</param> /// <param name="delta">滚轮值</param> private void toolBoxItemTouchUp(object sender, FCTouchInfo touchInto) { if (m_dragingItem.Visible) { m_dragingItem.Visible = false; onCreateControl(m_dragingItem.Text); Native.invalidate(); } }
/// <summary> /// 触摸抬起方法 /// </summary> /// <param name="touchInfo">触摸信息</param> public override void onTouchUp(FCTouchInfo touchInfo) { base.onTouchUp(touchInfo); Cursor = FCCursors.Arrow; m_resizeState = 0; if (m_grid != null) { m_grid.invalidate(); } }
/// <summary> /// 触摸点击方法 /// </summary> /// <param name="touchInfo">触摸信息</param> public virtual void onClick(FCTouchInfo touchInfo) { if (m_calendar != null) { m_calendar.Mode = FCCalendarMode.Month; m_calendar.MonthDiv.selectYear(m_year); m_calendar.update(); m_calendar.invalidate(); } }
/// <summary> /// 单元格触摸抬起方法 /// </summary> /// <param name="cell">单元格</param> /// <param name="touchInfo">触摸信息</param> public override void onCellTouchUp(FCGridCell cell, FCTouchInfo touchInfo) { base.onCellTouchUp(cell, touchInfo); FCPoint mp = touchInfo.m_firstPoint; if (m_movingNode != null) { FCGridRow curRow = getRow(mp); //移动 if (curRow != null) { FCTreeNode curNode = curRow.getCell(0) as FCTreeNode; if (curNode.AllowDragIn && m_movingNode != curNode) { FCTreeNode curNodeParent = curNode.Parent; FCTreeNode movingNodeParent = m_movingNode.Parent; if (movingNodeParent != null) { movingNodeParent.removeNode(m_movingNode); } else { removeNode(m_movingNode); } //有父节点 if (curNodeParent != null) { if (movingNodeParent == curNodeParent) { curNodeParent.insertNode(curNodeParent.getNodeIndex(curNode), m_movingNode); } else { curNode.appendNode(m_movingNode); } } //无父节点 else { if (movingNodeParent == curNodeParent) { insertNode(getNodeIndex(curNode), m_movingNode); } else { curNode.appendNode(m_movingNode); } } curNode.expend(); } } m_movingNode = null; update(); } }
/// <summary> /// 触摸点击事件 /// </summary> /// <param name="touchInfo">触摸信息</param> public override void onClick(FCTouchInfo touchInfo) { base.onClick(touchInfo); if (m_calendar != null) { FCCalendarMode mode = m_calendar.Mode; //日 if (mode == FCCalendarMode.Day) { if (m_toLast) { m_calendar.goLastMonth(); } else { m_calendar.goNextMonth(); } } //月 else if (mode == FCCalendarMode.Month) { MonthDiv monthDiv = m_calendar.MonthDiv; if (monthDiv != null) { int year = monthDiv.Year; if (m_toLast) { monthDiv.selectYear(year - 1); } else { monthDiv.selectYear(year + 1); } } } //年 else if (mode == FCCalendarMode.Year) { YearDiv yearDiv = m_calendar.YearDiv; if (yearDiv != null) { int year = yearDiv.StartYear; if (m_toLast) { yearDiv.selectStartYear(year - 12); } else { yearDiv.selectStartYear(year + 12); } } } m_calendar.invalidate(); } }
/// <summary> /// 单元格触摸按下方法 /// </summary> /// <param name="cell">单元格</param> /// <param name="touchInfo">触摸信息</param> public override void onCellTouchDown(FCGridCell cell, FCTouchInfo touchInfo) { base.onCellTouchDown(cell, touchInfo); FCPoint mp = touchInfo.m_firstPoint; FCTreeNode node = cell as FCTreeNode; if (node != null) { int scrollH = 0; FCHScrollBar hscrollBar = HScrollBar; if (hscrollBar != null && hscrollBar.Visible) { scrollH = hscrollBar.Pos; } FCRect headerRect = node.TargetColumn.Bounds; headerRect.left += HorizontalOffset - scrollH; headerRect.top += VerticalOffset - scrollH; int left = headerRect.left; //复选框 if (m_checkBoxes) { int cw = m_checkBoxSize.cx; if (mp.x >= left && mp.x <= left + cw) { node.Checked = !node.Checked; return; } left += cw + 10; } //折叠节点 ArrayList <FCTreeNode> childNodes = node.getChildNodes(); if (childNodes != null && childNodes.size() > 0) { int nw = m_nodeSize.cx; if (mp.x >= left && mp.x <= left + nw) { if (node.Expended) { node.collapse(); } else { node.expend(); } update(); return; } } //移动 if (node.AllowDragOut) { m_movingNode = node; } } }
/// <summary> /// 按钮点击事件 /// </summary> /// <param name="sender">调用者</param> /// <param name="mp">坐标</param> /// <param name="button">按钮</param> /// <param name="click">点击次数</param> /// <param name="delta">滚轮滚动值</param> private void clickButton(object sender, FCTouchInfo touchInto) { if (touchInto.m_firstTouch && touchInto.m_clicks == 1) { FCView control = sender as FCView; if (m_window != null && control == m_window.CloseButton) { close(); } } }
/// <summary> /// 触摸点击方法 /// </summary> /// <param name="touchInfo">触摸信息</param> public virtual void onClick(FCTouchInfo touchInfo) { if (m_calendar != null) { CMonth month = m_calendar.Years.getYear(m_calendar.MonthDiv.Year).Months.get(m_month); m_calendar.Mode = FCCalendarMode.Day; m_calendar.SelectedDay = month.Days.get(1); m_calendar.update(); m_calendar.invalidate(); } }
/// <summary> /// 控件触摸滚轮滚动方法 /// </summary> /// <param name="touchInfo">触摸信息</param> public virtual void onControlTouchWheel(FCTouchInfo touchInfo) { FCGrid grid = Grid; if (m_control != null && grid != null) { FCTouchInfo newTouchInfo = touchInfo.clone(); newTouchInfo.m_firstPoint = grid.pointToControl(m_control.pointToNative(touchInfo.m_firstPoint)); newTouchInfo.m_secondPoint = grid.pointToControl(m_control.pointToNative(touchInfo.m_secondPoint)); grid.onTouchWheel(newTouchInfo); } }
/// <summary> /// 拷贝信息 /// </summary> /// <returns></returns> public FCTouchInfo clone() { FCTouchInfo touchInfo = new FCTouchInfo(); touchInfo.m_firstPoint = m_firstPoint; touchInfo.m_firstTouch = m_firstTouch; touchInfo.m_secondPoint = m_secondPoint; touchInfo.m_secondTouch = m_secondTouch; touchInfo.m_clicks = m_clicks; touchInfo.m_delta = m_delta; return(touchInfo); }
/// <summary> /// 控件项鼠标移动事件 /// </summary> /// <param name="sender">调用者</param> /// <param name="mp">坐标</param> /// <param name="button">按钮</param> /// <param name="clicks">点击次数</param> /// <param name="delta">滚轮值</param> private void toolBoxItemTouchMove(object sender, FCTouchInfo touchInto) { if (m_dragingItem.Visible) { FCView control = sender as FCView; FCPoint mp = touchInto.m_firstPoint; FCPoint location = control.pointToNative(mp); location.x += 10; location.y -= 16; m_dragingItem.Location = location; Native.invalidate(); } }
/// <summary> /// 触摸滚动方法 /// </summary> /// <param name="touchInfo">触摸信息</param> public override void onTouchWheel(FCTouchInfo touchInfo) { base.onTouchMove(touchInfo); if (touchInfo.m_delta > 0) { Add(); } else { reduce(); } invalidate(); }
/// <summary> /// 触摸滚轮方法 /// </summary> /// <param name="touchInfo">触摸信息</param> public override void onTouchWheel(FCTouchInfo touchInfo) { base.onTouchWheel(touchInfo); if (LinesCount <= 1) { if (m_dropDownMenu != null) { FCTouchInfo newTouchInfo = touchInfo.clone(); newTouchInfo.m_firstPoint = m_dropDownMenu.TouchPoint; newTouchInfo.m_secondPoint = m_dropDownMenu.TouchPoint; m_dropDownMenu.onTouchWheel(newTouchInfo); } } }
/// <summary> /// 触摸滚动方法 /// </summary> /// <param name="touchInfo">触摸信息</param> public override void onTouchWheel(FCTouchInfo touchInfo) { base.onTouchWheel(touchInfo); if (touchInfo.m_delta > 0) { lineUp(); invalidate(); } else if (touchInfo.m_delta < 0) { lineDown(); invalidate(); } }