本文整理汇总了C++中MEvent类的典型用法代码示例。如果您正苦于以下问题:C++ MEvent类的具体用法?C++ MEvent怎么用?C++ MEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateColumnEntry
void EventDlg::UpdateColumnEntry(int iItem, int hcol, LPTSTR val)
{
UINT icol =ImpEditCol::m_fileheadermap[hcol]; // see this garbage? a result of poor design
CString s;
if (ImpEditCol::eMeasType == icol) // for string to numeric internal maps, handle the update differently
{
MEvent* pm = (MEvent*)m_List.GetItemData(iItem);
if (pm)
{
CString szDisplayableResult;
pm->UpdateMeasurementInfo(ImpEditCol::m_meacolmap[icol], val, szDisplayableResult);
m_List.SetItemText(iItem,ImpEditCol::eMeasType,tMeasurementTypeImage((tMeasurementType)pm->m_vr._iMPMeasurementType));
}
}
else
{
if (UpdateValue(iItem , icol, val, s)) // icol is ImpEd enum
{
m_List.SetItemText(iItem , icol, s);
}
}
}
示例2: doRelease
MStatus customAttrCtx::doRelease( MEvent & event )
//
// Description
// This method is called when a mouse button is released while this context is
// the current context.
//
{
// Let the parent class handle the event.
MStatus stat = MPxSelectionContext::doRelease( event );
// If an object is selected, process the event if the middle mouse button
// was lifted.
if ( !isSelecting() ) {
if (event.mouseButton() == MEvent::kMiddleMouse)
{
event.getPosition( endPos_x, endPos_y );
// Delete the move command if we have moved less then 2 pixels
// otherwise call finalize to set up the journal and add the
// command to the undo queue.
//
if ( abs(startPos_x - endPos_x) < 2 ) {
delete cmd;
view.refresh( true );
}
else {
stat = cmd->finalize();
view.refresh( true );
}
setCursor(MCursor::defaultCursor);
}
}
return stat;
}
示例3: doDrag
MStatus customAttrCtx::doDrag( MEvent & event )
//
// Description
// This method is called when a mouse button is dragged while this context is
// the current context.
//
{
MStatus stat;
// If an object has been selected, then process the drag. Otherwise, pass the
// event on up to the parent class.
if ((!isSelecting()) && (event.mouseButton() == MEvent::kMiddleMouse)) {
event.getPosition( endPos_x, endPos_y );
// Undo the command to erase the previously set delta value from the
// node, set a new delta value in the command and redo the command to
// set the values in the node.
cmd->undoIt();
cmd->setDelta(endPos_x - startPos_x);
stat = cmd->redoIt();
view.refresh( true );
}
else
stat = MPxSelectionContext::doDrag( event );
return stat;
}
示例4: ProcessEvent
bool Mint::ProcessEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
if(!m_pMainFrame) return false;
MEvent e;
int nResult = e.TranslateEvent(hwnd, message, wparam, lparam);
if(nResult&EVENT_MINT_TRANSLATED){
// Drag & Drop
if(m_pDragSourceObject!=NULL){
#define DRAm_VISIBLE_LENGTH 2 // µå·¡±× ¿ÀºêÁ§Æ®¸¦ º¸¿©Áֱ⠽ÃÀÛÇÏ´Â °£°Ý
if(e.nMessage==MWM_MOUSEMOVE){
MPOINT p = e.Pos;
//MPOINT p = MEvent::GetMousePos();
int px = m_GrabPoint.x - p.x;
if ( px < 0) px *= -1;
int py = m_GrabPoint.y - p.y;
if ( py < 0) py *= -1;
if( m_bVisibleDragObject==false &&
((px > DRAm_VISIBLE_LENGTH) || (py > DRAm_VISIBLE_LENGTH)))
m_bVisibleDragObject = true;
MWidget* pFind = FindWidget(p);
if(pFind!=NULL && pFind->IsDropable(m_pDragSourceObject)==true)
m_pDropableObject = pFind;
else
m_pDropableObject = NULL;
}
if(e.nMessage==MWM_LBUTTONUP){
MPOINT p = e.Pos;
MWidget* pFind = FindWidgetDropAble(p);
// MWidget* pFind = FindWidget(p);
if(pFind!=NULL && pFind->IsDropable(m_pDragSourceObject)==true)
pFind->Drop(m_pDragSourceObject, m_pDragObjectBitmap, m_szDragObjectString, m_szDragObjectItemString); // ÇØ´ç À§Á¬¿¡ µå·Ó
m_pDragSourceObject = NULL;
m_pMainFrame->ReleaseCapture();
return true;
}
}
// Àü¿ª À̺¥Æ® ó¸®
if (m_fnGlobalEventCallBack) {
if (m_fnGlobalEventCallBack(&e) == true) return true;
}
// ÀÏ¹Ý À̺¥Æ® ó¸®
if(m_pMainFrame->Event(&e)==true) return true;
// ¾øÀ¸¸é Accelerator ó¸®
if(m_pMainFrame->EventAccelerator(&e)==true) return true;
// Default Key(Enter, ESC) ó¸®
if(m_pMainFrame->EventDefaultKey(&e)==true) return true;
}
if(nResult&EVENT_PROCESSED) return true; // ¹«Á¶°Ç 󸮵Ê
return false;
}
示例5: OnComboSelection
LRESULT EventDlg::OnComboSelection(WPARAM nItem, LPARAM nSubItem)
{
CString sle = m_List.GetComboText(nItem, nSubItem);
MEvent* pm = (MEvent*)m_List.GetItemData(nItem);
if (pm)
{
CString szDisplayableResult;
pm->UpdateMeasurementInfo(ImpEditCol::m_meacolmap[nSubItem], sle, szDisplayableResult);
}
return 0;
}
示例6: doDrag
MStatus HairToolContext::doDrag( MEvent& event )
{
if(intersectionFound){
//Our Viewer
m_View = M3dView::active3dView();
//Get Screen click position
event.getPosition( m_storage[0], m_storage[1] );
screenPoints.push_back(vec2(m_storage[0], m_storage[1]));
//Camera stuff
MPoint origin = MPoint();
MVector direction = MVector();
m_View.viewToWorld(m_storage[0], m_storage[1], origin, direction);
float tValue = ((point - origin)*normal) / (direction * normal);
MPoint newPoint = tValue*direction + origin;
splinePoints.push_back(newPoint);
//Draw GL curve
m_View.beginXorDrawing(true, true, 1.0f, M3dView::kStippleDashed);
glBegin(GL_LINE_STRIP );
for ( unsigned i = 0; i < screenPoints.size() ; i++ ){
glVertex2i( screenPoints[i][0], screenPoints[i][1] );
}
glEnd();
m_View.endXorDrawing();
}
return MPxContext::doDrag(event);
}
示例7: doDrag
MStatus marqueeContext::doDrag( MEvent & event )
//
// Drag out the marquee (using OpenGL)
//
{
#if CUSTOM_XOR_DRAW
xorDraw XORdraw(&view);
XORdraw.beginXorDrawing();
#else
view.beginXorDrawing();
#endif
if (fsDrawn) {
// Redraw the marquee at its old position to erase it.
drawMarqueeGL();
}
fsDrawn = true;
// Get the marquee's new end position.
event.getPosition( last_x, last_y );
// Draw the marquee at its new position.
drawMarqueeGL();
#if CUSTOM_XOR_DRAW
XORdraw.endXorDrawing();
#else
view.endXorDrawing();
#endif
return MS::kSuccess;
}
示例8: doRelease
MStatus HairToolContext::doRelease( MEvent& event )
{
// only bother handling the release of a left mouse button.
if(event.mouseButton() != MEvent::kLeftMouse) {
return MPxContext::doRelease(event);
}
else if(!intersectionFound){
return MPxContext::doRelease(event);
}
else if(splinePoints.size() < 2){
return MPxContext::doRelease(event);
}
OverCoatNode::numOfSplinesCreated++;
MGlobal::executeCommand("print \" Intersection Detected \\n\"");
char curveCreation[8000];
sprintf(curveCreation, "curve", OverCoatNode::numOfSplinesCreated);
for(int i = 0; i < splinePoints.size(); i++){
char buffer[200];
sprintf(buffer, " -p %f %f %f", splinePoints[i].x, splinePoints[i].y, splinePoints[i].z);
strcat(curveCreation, buffer);
}
MString result;
MGlobal::executeCommand(curveCreation, result);
const char* curveName = result.asChar();
int splineCount;
sscanf(curveName, "curve%d", &splineCount);
char overCoatNodeCreation[200];
sprintf(overCoatNodeCreation, "createNode OverCoatNode -name OverCoatNode%d", splineCount);
MGlobal::executeCommand(overCoatNodeCreation);
char overCoatNodeSetAttrColor[200];
sprintf(overCoatNodeSetAttrColor, "setAttr OverCoatNode%d.color -type \"double3\" %f %f %f", splineCount, red, green, blue);
MGlobal::executeCommand(overCoatNodeSetAttrColor);
char overCoatNodeSetAttrThick[200];
sprintf(overCoatNodeSetAttrThick, "setAttr OverCoatNode%d.thick %f", splineCount, thick);
MGlobal::executeCommand(overCoatNodeSetAttrThick);
char overCoatNodeSetAttrBrush[200];
sprintf(overCoatNodeSetAttrBrush, "setAttr OverCoatNode%d.brush %d", splineCount, brush);
MGlobal::executeCommand(overCoatNodeSetAttrBrush);
char overCoatNodeSetAttrTrans[200];
sprintf(overCoatNodeSetAttrTrans, "setAttr OverCoatNode%d.transparency %f", splineCount, transparency);
MGlobal::executeCommand(overCoatNodeSetAttrTrans);
char overCoatNodeConnectAttr[200];
sprintf(overCoatNodeConnectAttr, "connectAttr curve%d.worldSpace OverCoatNode%d.spline", splineCount, splineCount);
MGlobal::executeCommand(overCoatNodeConnectAttr);
char overCoatNodeSetAttrSpacing[200];
sprintf(overCoatNodeSetAttrSpacing, "setAttr OverCoatNode%d.spacing %f", splineCount, spacing);
MGlobal::executeCommand(overCoatNodeSetAttrSpacing);
return MS::kSuccess;
}
示例9: doPress
MStatus customAttrCtx::doPress( MEvent & event )
//
// Description
// This method is called when a mouse button is pressed while this context is
// the current context.
//
{
// Let the parent class handle the event first in case there is no object
// selected yet. The parent class will perform any necessary selection.
MStatus stat = MPxSelectionContext::doPress( event );
// If an object has been selected, then process the event. Otherwise,
// ignore it as there is nothing to do.
if ( !isSelecting() ) {
if (event.mouseButton() == MEvent::kMiddleMouse)
{
setCursor(MCursor::handCursor);
view = M3dView::active3dView();
// Create an instance of the customAttrCmd tool command and initialize
// its delta value to 0. As the mouse drags, the delta value will change.
// when the mouse is lifted, a final command will be constructed with the
// most recently set delta value and axis specifications.
cmd = (customAttrCmd *)newToolCommand();
cmd->setDelta(0.0);
event.getPosition( startPos_x, startPos_y );
// Determine the channel box attribute which will be operated on by the
// dragging motion and set the state of the command accordingly.
unsigned int i;
MStringArray result;
MGlobal::executeCommand(
"channelBox -q -selectedMainAttributes $gChannelBoxName", result);
for (i=0; i<result.length(); i++)
{
if (result[i] == customAttributeString)
{
cmd->setDragX();
break;
}
}
}
}
return stat;
}
示例10: UpdateValue
bool EventDlg::UpdateValue(int iEntry, int iColumnID, LPCSTR pRawString, CString& szDisplayableResult) // column id is ImpEd enum
{
// get the list entry (MEvent)
// update the relevant field on the MEvent
// return false if the value does not match the allowed data ranges
// otherwise return true so that the text can be inserted with the correct formatting in the list row subitem
MEvent* pm = (MEvent*)m_List.GetItemData(iEntry);
if (pm)
{
pm->UpdateMeasurementInfo(ImpEditCol::m_meacolmap[iColumnID], pRawString, szDisplayableResult);
}
return true;
}
示例11: filterEvent
bool filterEvent(const MEvent& event, int type, bool thru)
{
switch(event.type()) {
case ME_NOTEON:
case ME_NOTEOFF:
if (type & MIDI_FILTER_NOTEON)
return true;
break;
case ME_POLYAFTER:
if (type & MIDI_FILTER_POLYP)
return true;
break;
case ME_CONTROLLER:
if (type & MIDI_FILTER_CTRL)
return true;
if (!thru && (MusEGlobal::midiFilterCtrl1 == event.dataA()
|| MusEGlobal::midiFilterCtrl2 == event.dataA()
|| MusEGlobal::midiFilterCtrl3 == event.dataA()
|| MusEGlobal::midiFilterCtrl4 == event.dataA())) {
return true;
}
break;
case ME_PROGRAM:
if (type & MIDI_FILTER_PROGRAM)
return true;
break;
case ME_AFTERTOUCH:
if (type & MIDI_FILTER_AT)
return true;
break;
case ME_PITCHBEND:
if (type & MIDI_FILTER_PITCH)
return true;
break;
case ME_SYSEX:
if (type & MIDI_FILTER_SYSEX)
return true;
break;
default:
break;
}
return false;
}
示例12: doPressCommon
void marqueeContext::doPressCommon( MEvent & event )
{
// Figure out which modifier keys were pressed, and set up the
// listAdjustment parameter to reflect what to do with the selected points.
if (event.isModifierShift() || event.isModifierControl() ) {
if ( event.isModifierShift() ) {
if ( event.isModifierControl() ) {
// both shift and control pressed, merge new selections
listAdjustment = MGlobal::kAddToList;
} else {
// shift only, xor new selections with previous ones
listAdjustment = MGlobal::kXORWithList;
}
} else if ( event.isModifierControl() ) {
// control only, remove new selections from the previous list
listAdjustment = MGlobal::kRemoveFromList;
}
} else {
listAdjustment = MGlobal::kReplaceList;
}
// Extract the event information
//
event.getPosition( start_x, start_y );
}
示例13: selection
MStatus SelectRingContext2::doPress( MEvent &event )
{
listAdjust = MGlobal::kReplaceList;
// Determine which modifier keys were pressed
if( event.isModifierShift() || event.isModifierControl() )
{
if( event.isModifierShift() )
{
if( event.isModifierControl() )
listAdjust = MGlobal::kAddToList; // Shift+Ctrl: Merge selection
else
listAdjust = MGlobal::kXORWithList; // Shift: Toggle selection (XOR)
}
else
{
if( event.isModifierControl() )
listAdjust = MGlobal::kRemoveFromList; // Ctrl: Remove selection
}
}
// Get the position of the mouse click
event.getPosition( pressX, pressY );
return MS::kSuccess;
}
示例14: SetOKButtonIfValidContent
void EventDlg::SetOKButtonIfValidContent(bool bAcceptanceCheck)
{
int good = 0;
for (int nItem = 0; nItem < m_List.GetItemCount(); nItem++)
{
if (!m_List.GetCheckbox(nItem,ImpEditCol::eCheck))
continue;
MEvent* pm = (MEvent*)m_List.GetItemData(nItem);
if (!pm)
continue;
if (pm->m_vr.ValidContent())
{
if ((!bAcceptanceCheck) || // don't care or
(bAcceptanceCheck && (!pm->GetAccepted()))) // catch those worth accepting
good++;
}
}
if (good < 1)
{
m_WaitingForFit = false;
GetDlgItem(IDOK)->EnableWindow(false);
SetDlgItemText(IDCANCEL, TEXT("Save Results"));
}
else
{
CString s;
s = "Fit Selected Measurement";
if (good > 1)
s.Append("s");
SetDlgItemText(IDOK, s);
GetDlgItem(IDOK)->EnableWindow(true);
SetDlgItemText(IDCANCEL, TEXT("Cancel"));
m_WaitingForFit = true;
}
}
示例15: doPress
MStatus moveContext::doPress( MEvent & event )
{
MStatus stat = MPxSelectionContext::doPress( event );
MSpace::Space spc = MSpace::kWorld;
// If we are not in selecting mode (i.e. an object has been selected)
// then set up for the translation.
//
if ( !isSelecting() ) {
event.getPosition( startPos_x, startPos_y );
view = M3dView::active3dView();
MDagPath camera;
stat = view.getCamera( camera );
if ( stat != MS::kSuccess ) {
cerr << "Error: M3dView::getCamera" << endl;
return stat;
}
MFnCamera fnCamera( camera );
MVector upDir = fnCamera.upDirection( spc );
MVector rightDir = fnCamera.rightDirection( spc );
// Determine the camera used in the current view
//
if ( fnCamera.isOrtho() ) {
if ( upDir.isEquivalent(MVector::zNegAxis,kVectorEpsilon) ) {
currWin = TOP;
} else if ( rightDir.isEquivalent(MVector::xAxis,kVectorEpsilon) ) {
currWin = FRONT;
} else {
currWin = SIDE;
}
}
else {
currWin = PERSP;
}
// Create an instance of the move tool command.
//
cmd = (moveCmd*)newToolCommand();
cmd->setVector( 0.0, 0.0, 0.0 );
}
return stat;
}