本文整理汇总了C++中hdMouseEvent::GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ hdMouseEvent::GetPosition方法的具体用法?C++ hdMouseEvent::GetPosition怎么用?C++ hdMouseEvent::GetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hdMouseEvent
的用法示例。
在下文中一共展示了hdMouseEvent::GetPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mouseDrag
void hdDragTrackerTool::mouseDrag(hdMouseEvent &event)
{
hdAbstractTool::mouseDrag(event);
if(event.LeftIsDown())
{
int x = event.GetPosition().x, y = event.GetPosition().y;
//Hack to avoid a weird bug that ocurrs when use double click very fast over figure and drag a same time, lastX
//and lastY values becomes big negatives numbers, if this happens, then reset it to click point
if(lastX < 0)
lastX = x;
if(lastY < 0)
lastY = y;
hasMovedValue = (abs (x - anchorX) > 4 || abs (y - anchorX) > 4);
if (hasMoved())
{
hdIFigure *tmp = NULL;
hdIteratorBase *iterator = event.getView()->getDrawing()->selectionFigures();
while(iterator->HasNext())
{
tmp = (hdIFigure *)iterator->Next();
tmp->moveBy(event.getView()->getIdx(), x - lastX, y - lastY);
event.getView()->notifyChanged();
}
delete iterator;
}
setLastCoords (x, y);
}
}
示例2: mouseDown
void hdSelectionTool::mouseDown(hdMouseEvent &event)
{
hdITool::mouseDown(event);
hdDrawingView *view = event.getView();
int x = event.GetPosition().x, y = event.GetPosition().y;
hdIHandle *handle = view->findHandle(view->getIdx(), x, y);
if(handle)
{
setDelegateTool(view, new hdHandleTrackerTool(view, handle));
}
else
{
hdIFigure *figure = view->getDrawing()->findFigure(view->getIdx(), x, y);
if(figure)
{
view->getDrawing()->bringToFront(figure);
setDelegateTool(event.getView(), figure->CreateFigureTool(view, new hdDragTrackerTool(view, figure)));
}
else
{
setDelegateTool(event.getView(), new hdCanvasMenuTool(view, new hdSelectAreaTool(view)) );
}
}
hdITool *delegateTool = getDelegateTool();
if (delegateTool)
delegateTool->mouseDown(event);
}
示例3: invokeStep
void hdPolyLineHandle::invokeStep(hdMouseEvent &event, hdDrawingView *view)
{
int x = event.GetPosition().x, y = event.GetPosition().y;
((hdPolyLineFigure *) getOwner())->setPointAt(view->getIdx(), indx, x, y);
view->notifyChanged();
}
示例4: mouseDown
void hdCreationTool::mouseDown(hdMouseEvent &event)
{
hdAbstractTool::mouseDown(event);
if(event.LeftDown())
{
event.getView()->getDrawing()->add(figurePrototype);
int x = event.GetPosition().x, y = event.GetPosition().y;
figurePrototype->moveTo(event.getView()->getIdx(), x, y);
event.getView()->getDrawing()->clearSelection();
event.getView()->getDrawing()->addToSelection(figurePrototype);
}
}
示例5: mouseDrag
void hdSelectAreaTool::mouseDrag(hdMouseEvent &event)
{
hdAbstractTool::mouseDrag(event);
if(event.LeftIsDown())
{
drawSelectionRect(event.getView());
int x = event.GetPosition().x, y = event.GetPosition().y;
selectionRect.x = anchorX;
selectionRect.y = anchorY;
selectionRect.SetBottomRight(wxPoint(x, y));
drawSelectionRect(event.getView());
event.getView()->ScrollToMakeVisible(event.GetPosition());
}
}
示例6: invokeStep
void ddSouthTableSizeHandle::invokeStep(hdMouseEvent &event, hdDrawingView *view)
{
int y = event.GetPosition().y;
ddTableFigure *table = (ddTableFigure *) getOwner();
wxFont font = *hdFontAttribute::defaultFont;
int colOffset = table->getColDefaultHeight(font);
int divBy = (table->getTotalColumns() - table->getColumnsWindow());
if(divBy <= 0)
divBy = table->getColumnsWindow();
hdGeometry g;
if ( g.ddabs(anchorY - y) > colOffset)
{
if((anchorY - y) > 0)
{
table->setColumnsWindow(view->getIdx(), table->getColumnsWindow() - 1);
}
else
{
table->setColumnsWindow(view->getIdx(), table->getColumnsWindow() + 1);
}
anchorY = y;
}
//hack to update relationship position when table size change
table->manuallyNotifyChange(view->getIdx());
view->notifyChanged();
}
示例7: invokeStart
void ddAddFkButtonHandle::invokeStart(hdMouseEvent &event, hdDrawingView *view)
{
if(getOwner()->ms_classInfo.IsKindOf(&ddTableFigure::ms_classInfo))
{
ddRelationshipFigure *fkConnection = new ddRelationshipFigure();
//Check figure available positions for diagrams, add at least needed to allow initialization of the class
int i, start;
start = fkConnection->displayBox().CountPositions();
for(i = start; i < (view->getIdx() + 1); i++)
{
fkConnection->AddPosForNewDiagram();
}
fkConnection->setStartTerminal(new ddRelationshipTerminal(fkConnection, false));
fkConnection->setEndTerminal(new ddRelationshipTerminal(fkConnection, true));
hdConnectionCreationTool *conn = new hdConnectionCreationTool(view, fkConnection);
view->setTool(conn);
// Simulate button down to start connection of foreign key
wxMouseEvent e(wxEVT_LEFT_DOWN);
e.m_x = event.GetPosition().x;
e.m_y = event.GetPosition().y;
e.SetEventObject(view);
hdMouseEvent evento(e, view);
conn->mouseDown(evento);
ddTableFigure *table = (ddTableFigure *) getOwner();
table->setSelectFkDestMode(true);
view->notifyChanged();
}
}
示例8: mouseDrag
void hdDragCreationTool::mouseDrag(hdMouseEvent &event)
{
if(event.LeftIsDown())
{
figurePrototype->displayBox().SetPosition(event.getView()->getIdx(), event.GetPosition());
}
}
示例9: mouseDown
void hdSelectAreaTool::mouseDown(hdMouseEvent &event)
{
hdAbstractTool::mouseDown(event);
if(!event.ShiftDown())
{
event.getView()->getDrawing()->clearSelection();
}
if(event.LeftDown())
{
int x = event.GetPosition().x, y = event.GetPosition().y;
selectionRect.x = x;
selectionRect.y = y;
selectionRect.width = 0;
selectionRect.height = 0;
drawSelectionRect(event.getView());
}
}
示例10: invokeEnd
void hdLineConnectionHandle::invokeEnd(hdMouseEvent &event, hdDrawingView *view)
{
int x = event.GetPosition().x, y = event.GetPosition().y;
hdPolyLineFigure *figure = (hdPolyLineFigure *) getOwner();
//eliminate all handles in the middle of a straight line
if( figure->pointCount(view->getIdx()) > 2 && getIndex() != 0 && getIndex() != (figure->pointCount(view->getIdx()) - 1) )
{
hdPoint p1 = figure->pointAt(view->getIdx(), getIndex() - 1);
hdPoint p2 = figure->pointAt(view->getIdx(), getIndex() + 1);
hdGeometry g;
if(g.lineContainsPoint(p1.x, p1.y, p2.x, p2.y, x, y))
{
figure->removePointAt(view->getIdx(), getIndex());
}
}
}
示例11: mouseDown
void hdMenuTool::mouseDown(hdMouseEvent &event)
{
//Linux hack for bug
int x = event.GetPosition().x, y = event.GetPosition().y;
setAnchorCoords(x, y);
if(menuFigure->menuEnabled() && event.RightDown())
{
wxMenu menu;
event.getView()->setMenuToolFigure(menuFigure);
menuFigure->createMenu(menu);
event.getView()->connectPopUpMenu(menu);
hdPoint p = event.GetPosition();
event.getView()->CalcScrolledPosition(p.x, p.y, &p.x, &p.y);
event.getView()->PopupMenu(&menu, p);
return;
}
getDefaultTool()->mouseDown(event);
}
示例12: mouseDown
void hdCanvasMenuTool::mouseDown(hdMouseEvent &event)
{
//Linux hack for bug
int x = event.GetPosition().x, y = event.GetPosition().y;
setAnchorCoords(x, y);
if(event.RightDown())
{
wxMenu menu;
event.getView()->setCanvasMenuTool(this);
createViewMenu(event.getView(), menu);
event.getView()->connectPopUpMenu(menu);
hdPoint p = event.GetPosition();
event.getView()->CalcScrolledPosition(p.x, p.y, &p.x, &p.y);
event.getView()->PopupMenu(&menu, p);
return;
}
defaultTool->mouseDown(event);
}
示例13: invokeStart
void ddScrollBarHandle::invokeStart(hdMouseEvent &event, hdDrawingView *view)
{
int idx = view->getIdx();
int y = event.GetPosition().y;
anchorY = y;
if( (y > (getDisplayBox(idx).GetPosition().y + 2)) && (y < (getDisplayBox(idx).GetPosition().y + 2 + 6)) ) //6 image height
table->columnsWindowUp(idx);
if( (y > (getDisplayBox(idx).GetPosition().y + getDisplayBox(idx).height - 2 - downBitmap.GetHeight()) ) && (y < (getDisplayBox(idx).GetPosition().y + getDisplayBox(idx).height - 2) ) )
table->columnsWindowDown(idx);
view->notifyChanged();
}
示例14: mouseDown
void hdDragTrackerTool::mouseDown(hdMouseEvent &event)
{
hdAbstractTool::mouseDown(event);
if(event.LeftDown())
{
int x = event.GetPosition().x, y = event.GetPosition().y;
setLastCoords(x, y);
if(event.m_shiftDown)
{
event.getView()->getDrawing()->toggleSelection(anchorFigure);
}
else if(!event.getView()->getDrawing()->isFigureSelected(anchorFigure))
{
event.getView()->getDrawing()->clearSelection();
event.getView()->getDrawing()->addToSelection(anchorFigure);
}
}
}
示例15: mouseDown
void hdSimpleTextTool::mouseDown(hdMouseEvent &event)
{
setAnchorCoords(event.GetPosition().x, event.GetPosition().y);
// Right click to get the contextual menu
if(txtFigure->menuEnabled() && event.RightDown())
{
wxMenu menu;
event.getView()->setSimpleTextToolFigure(txtFigure, true);
txtFigure->createMenu(menu);
event.getView()->connectPopUpMenu(menu);
hdPoint p = event.GetPosition();
event.getView()->CalcScrolledPosition(p.x, p.y, &p.x, &p.y);
event.getView()->PopupMenu(&menu, p);
return;
}
// Double click to rename an object
if(event.LeftDClick())
{
if(withoutDialog)
{
event.getView()->setSimpleTextToolFigure(txtFigure);
showEdit = true;
event.getView()->getSimpleTextToolEdit()->ChangeValue(txtFigure->getText()); //Same as SetValue but don't generated wxEVT_COMMAND_TEXT_UPDATED event
calculateSizeEntry(event.getView());
event.getView()->getSimpleTextToolEdit()->SetFocus();
event.getView()->getSimpleTextToolEdit()->Show();
event.getView()->getOkTxt()->Show();
event.getView()->getCancelTxt()->Show();
}
else
{
callDialog(event.getView());
}
return;
}
getDefaultTool()->mouseDown(event);
}