这篇教程C++ GlobalToLocal函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GlobalToLocal函数的典型用法代码示例。如果您正苦于以下问题:C++ GlobalToLocal函数的具体用法?C++ GlobalToLocal怎么用?C++ GlobalToLocal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GlobalToLocal函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: HandleContentClick// --------------------------------------------------------------------------------------void HandleContentClick(WindowRef window, Point mouseLocation, EventModifiers modifiers){ ListHandle iconList; Rect iconListRect; Boolean isDoubleClick; Cell theCell; GetWindowProperty(window, kAppSignature, kIconListTag, sizeof(ListHandle), NULL, &iconList); GetListViewBounds(iconList, &iconListRect); iconListRect.right += kScrollBarWidth; SetPortWindowPort(window); GlobalToLocal(&mouseLocation); if (PtInRect(mouseLocation, &iconListRect)) { SInt16 pixelDepth; Boolean isColorDevice; GetWindowDeviceDepthAndColor(window, &pixelDepth, &isColorDevice); SetThemeBackground(kThemeBrushWhite, pixelDepth, isColorDevice); // if LClick causes the list selection to change, or the isDoubleClick = LClick(mouseLocation, modifiers, iconList); // scroll bar SetPt(&theCell, 0, 0); // to change, the affected cells are LGetSelect(true, &theCell, iconList); // immediately drawn (no update event) if ((theCell.v + 1) != gPanelNumber) changePanel(window, theCell.v + 1); }}
开发者ID:fruitsamples,项目名称:CarbonPorting,代码行数:34,
示例2: GetEventParameterpascal OSStatus pxWindowNative::doMouseUp(EventHandlerCallRef nextHandler, EventRef theEvent, void* userData){ pxWindowNative* w = (pxWindowNative*)userData; Point loc; UInt16 button; UInt32 modifier; GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &loc); SetPort(GetWindowPort(w->mWindowRef)); GlobalToLocal(&loc); GetEventParameter(theEvent, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button); GetEventParameter(theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier); unsigned long flags = 0; if (button == kEventMouseButtonPrimary) flags |= PX_LEFTBUTTON; else if (button == kEventMouseButtonSecondary) flags |= PX_RIGHTBUTTON; else if (button == kEventMouseButtonTertiary) flags |= PX_MIDDLEBUTTON; if (modifier & shiftKey) flags |= PX_MOD_SHIFT; if (modifier & optionKey) flags |= PX_MOD_ALT; if (modifier & controlKey) flags |= PX_MOD_CONTROL; w->onMouseUp(loc.h, loc.v, flags); return CallNextEventHandler (nextHandler, theEvent);}
开发者ID:dtbinh,项目名称:pxcore,代码行数:28,
示例3: m_DoubleTapActiontemplate <typename T> void MenuWidget<T>::ProcessDoubleTap(const InputEvent & InputEvent, Vector2n Position){ if (nullptr != m_DoubleTapAction) { m_DoubleTapAction(GlobalToLocal(Position), m_Entries); }}
开发者ID:shurcooL,项目名称:Conception,代码行数:7,
示例4: m_TapActiontemplate <typename T> void ListWidget<T>::ProcessTap(InputEvent & InputEvent, Vector2n Position){ if (nullptr != m_TapAction) { m_TapAction(GlobalToLocal(Position), m_List); }}
开发者ID:prinsmike,项目名称:Conception,代码行数:7,
示例5: DoMouseUp//------------------------------------------------------------------------pascal OSStatus DoMouseUp (EventHandlerCallRef nextHandler, EventRef theEvent, void* userData){ Point wheresMyMouse; UInt32 modifier; GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &wheresMyMouse); GlobalToLocal (&wheresMyMouse); GetEventParameter (theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifier); platform_support * app = reinterpret_cast<platform_support*>(userData); app->m_specific->m_cur_x = wheresMyMouse.h; if(app->flip_y()) { app->m_specific->m_cur_y = app->rbuf_window().height() - wheresMyMouse.v; } else { app->m_specific->m_cur_y = wheresMyMouse.v; } app->m_specific->m_input_flags = mouse_left | get_key_flags(modifier); if(app->m_ctrls.on_mouse_button_up(app->m_specific->m_cur_x, app->m_specific->m_cur_y)) { app->on_ctrl_change(); app->force_redraw(); } app->on_mouse_button_up(app->m_specific->m_cur_x, app->m_specific->m_cur_y, app->m_specific->m_input_flags); return CallNextEventHandler (nextHandler, theEvent);}
开发者ID:asmboom,项目名称:PixelFarm,代码行数:35,
示例6: wxMacWindowDragReceiveHandlerpascal OSErr wxMacWindowDragReceiveHandler(WindowPtr theWindow, void *handlerRefCon, DragReference theDrag){ MacTrackingGlobals* trackingGlobals = (MacTrackingGlobals*) handlerRefCon; if ( trackingGlobals->m_currentTarget ) { Point mouse,localMouse ; int localx,localy ; trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag ) ; GetDragMouse(theDrag, &mouse, 0L); localMouse = mouse; GlobalToLocal(&localMouse); localx = localMouse.h ; localy = localMouse.v ; //TODO : should we use client coordinates if ( trackingGlobals->m_currentTargetWindow ) trackingGlobals->m_currentTargetWindow->MacRootWindowToWindow( &localx , &localy ) ; if ( trackingGlobals->m_currentTarget->OnDrop( localx , localy ) ) { KeyMap keymap; GetKeys(keymap); bool optionDown = keymap[1] & 4; wxDragResult result = optionDown ? wxDragCopy : wxDragMove; trackingGlobals->m_currentTarget->OnData( localx , localy , result ) ; } } return(noErr);}
开发者ID:Duion,项目名称:Torsion,代码行数:30,
示例7: GetPortvoid GBWindow::AcceptUnclick(Point where, int clicksBefore) { GrafPtr savePort; GetPort(&savePort); SetPort(GetWindowPort(window)); GlobalToLocal(&where); view->DoUnclick(where.h, where.v, clicksBefore); SetPort(savePort);}
开发者ID:AgentE382,项目名称:grobots,代码行数:8,
示例8: device_dialog_filter_procstatic pascal Boolean device_dialog_filter_proc( DialogPtr dialog, EventRecord *event, short *item_hit){ GrafPtr old_port; short item_type; Handle item_handle; Rect item_rectangle; boolean handled= FALSE; GetPort(&old_port); SetPort(dialog); GetDItem(dialog, iDEVICE_AREA, &item_type, &item_handle, &item_rectangle); /* preprocess events */ switch(event->what) { case mouseDown: { Point where= event->where; GlobalToLocal(&where); switch (FindDItem(dialog, where)+1) { case iDEVICE_AREA: { GDHandle new_device= click_in_device_area(&device_dialog_globals.device_spec, &item_rectangle, where); if (new_device && new_device!=device_dialog_globals.device) { device_dialog_globals.device= new_device; BuildExplicitGDSpec(&device_dialog_globals.device_spec, new_device, device_dialog_globals.device_spec.flags, device_dialog_globals.device_spec.bit_depth, 0, 0); draw_device_area(&device_dialog_globals.device_spec, device_dialog_globals.device, &item_rectangle); *item_hit= iDEVICE_AREA; } handled= TRUE; break; } } break; } case updateEvt: if ((DialogPtr)event->message==dialog) { draw_device_area(&device_dialog_globals.device_spec, device_dialog_globals.device, &item_rectangle); } break; } SetPort(old_port); return handled ? TRUE : general_filter_proc(dialog, event, item_hit);}
开发者ID:DrItanium,项目名称:moo,代码行数:58,
示例9: doEventLoopvoid doEventLoop(){ EventRecord anEvent; WindowPtr evtWind; short clickArea; Rect screenRect; Point thePoint; Rect zoomFrom, zoomTo; zoomFrom.top = zoomTo.top = -1; while (!gDone) { if (WaitNextEvent( everyEvent, &anEvent, 0, nil )) { if (anEvent.what == mouseDown) { clickArea = FindWindow( anEvent.where, &evtWind ); if (clickArea == inDrag) { GetRegionBounds( GetGrayRgn(), &screenRect ); DragWindow( evtWind, anEvent.where, &screenRect ); } else if (clickArea == inContent) { if (evtWind != FrontWindow()) SelectWindow( evtWind ); else { thePoint = anEvent.where; GlobalToLocal( &thePoint ); //Handle click in window content here GetRect(&zoomFrom, &zoomTo); } } else if (clickArea == inGoAway) if (TrackGoAway( evtWind, anEvent.where )) gDone = true; } else if (anEvent.what == updateEvt) { evtWind = (WindowPtr)anEvent.message; SetPortWindowPort( evtWind ); BeginUpdate( evtWind ); //Call Draw Function here.... if (zoomFrom.top != -1) FrameRect(&zoomFrom); if (zoomTo.top != -1) FrameRect(&zoomTo); EndUpdate (evtWind); } } }}
开发者ID:fruitsamples,项目名称:ZoomRecter,代码行数:56,
示例10: doMyDeviceLoop// New doMyDeviceLoop, now works with multiple monitorsvoid doMyDeviceLoop(){ int depth; Rect gDeviceRect; Rect intersectingRect; GDHandle gDevice; //WindowRecord *windowRec = (WindowRecord *)gWindow; WindowPtr windowRec = gWindow; Rect windowRect; //= (**windowRec->contRgn).rgnBBox; RgnHandle rgnHandle = NewRgn(); GetWindowRegion(windowRec, kWindowContentRgn, rgnHandle); GetRegionBounds(rgnHandle, &windowRect); // Get the handle to the first device in the list. gDevice = GetDeviceList(); // Loop through all the devices in the list. while (gDevice != nil) { // Get the device's gdRect */ gDeviceRect = (**gDevice).gdRect; depth = (**(**gDevice).gdPMap).pixelSize; // Check if the app's window rect intersects the device's, and if it // does, set the clip region's rect to the intersection, then DRAW! if (SectRect( &windowRect, &gDeviceRect, &intersectingRect )) { // The intersectingRect is in global coords. Convert to local GlobalToLocal((Point *)&intersectingRect.top); GlobalToLocal((Point *)&intersectingRect.bottom); ClipRect( &intersectingRect ); doDraw( depth, &intersectingRect ); } // Get the next device in the list. gDevice = GetNextDevice( gDevice ); } DisposeRgn(rgnHandle);}
开发者ID:fruitsamples,项目名称:MyDeviceLoop,代码行数:43,
示例11: Quartz_Locatorstatic Rboolean Quartz_Locator(double *x, double *y, NewDevDesc *dd){ EventRecord event; SInt16 key; Boolean gotEvent; Boolean mouseClick = false; Point myPoint; WindowPtr window; SInt16 partCode; GrafPtr savePort; Cursor arrow ; QuartzDesc *xd = (QuartzDesc*)dd->deviceSpecific; int useBeep = asLogical(GetOption(install("locatorBell"), R_NilValue)); GetPort(&savePort); SetPortWindowPort(xd->window); SetThemeCursor(kThemeCrossCursor); while(!mouseClick) { gotEvent = WaitNextEvent( everyEvent, &event, 0, nil); CGContextFlush( GetContext(xd) ); if (event.what == mouseDown) { partCode = FindWindow(event.where, &window); if ((window == (xd->window)) && (partCode == inContent)) { myPoint = event.where; GlobalToLocal(&myPoint); *x = (double)(myPoint.h); *y = (double)(myPoint.v); if(useBeep) SysBeep(1); mouseClick = true; } } if (event.what == keyDown) { key = (event.message & charCodeMask); if (key == 0x1b){ /* exits when the esc key is pressed */ SetPort(savePort); SetThemeCursor(kThemeIBeamCursor); return FALSE; } } } SetPort(savePort); SetThemeCursor(kThemeIBeamCursor); return TRUE;}
开发者ID:Vladimir84,项目名称:rcc,代码行数:54,
示例12: MakeLocal/*** MAKE LOCAL ***/void MakeLocal( WindowRef window, Point globalPoint, Point *localPoint ){ GrafPtr oldPort; GetPort( &oldPort ); SetPortWindowPort( window ); localPoint->h = globalPoint.h; localPoint->v = globalPoint.v; GlobalToLocal( localPoint ); SetPort( oldPort );}
开发者ID:MaddTheSane,项目名称:ResKnife,代码行数:13,
示例13: get_mousestaticvoid get_mouse(Point *mouse, EventModifiers *modifiers){ EventRecord event; EventAvail(0, &event); *mouse = event.where; *modifiers = event.modifiers; GlobalToLocal(mouse);}
开发者ID:albertocabello,项目名称:gr,代码行数:12,
示例14: mac_clickeventlogvoid mac_clickeventlog(WindowPtr window, EventRecord *event){ Session *s = mac_windowsession(window); Point mouse; GrafPtr saveport; GetPort(&saveport); SetPort((GrafPtr)GetWindowPort(window)); mouse = event->where; GlobalToLocal(&mouse); LClick(mouse, event->modifiers, s->eventlog); SetPort(saveport);}
开发者ID:rdebath,项目名称:sgt,代码行数:13,
示例15: CheckValidbool nuiContainer::DispatchMouseCanceled(nuiWidgetPtr pThief, const nglMouseInfo& rInfo){ CheckValid(); nuiAutoRef; if (mTrashed) return false; bool hasgrab = HasGrab(rInfo.TouchId); nglMouseInfo info(rInfo); GlobalToLocal(info.X, info.Y); // Get a chance to preempt the mouse event before the children get it: PreClickCanceled(info); IteratorPtr pIt; for (pIt = GetLastChild(false); pIt && pIt->IsValid(); GetPreviousChild(pIt)) { nuiWidgetPtr pItem = pIt->GetWidget(); if (pItem) { pItem->DispatchMouseCanceled(pThief, rInfo); } } delete pIt; if (pThief != this) { GlobalToLocal(info.X, info.Y); PreClickCanceled(info); bool ret = MouseCanceled(info); ret |= ClickCanceled(info); ret = ret | (!mClickThru); return ret; } return false;}
开发者ID:hamedmohammadi,项目名称:nui3,代码行数:38,
示例16: Grabvoid nuiSlider::HookMouse(){ mClicked = true; mThumbClicked = true; mInteractiveValueChanged = true; Grab(); Invalidate(); mClickValue = mRange.GetValue(); nglMouseInfo info; GetTopLevel()->GetMouseInfo(info); mClickX = info.X; mClickY = info.Y; GlobalToLocal(mClickX, mClickY);}
开发者ID:YetToCome,项目名称:nui3,代码行数:14,
示例17: HandleMouseDownvoid HandleMouseDown(EventRecord *event){ short part; WindowRef window; MacWindow *macwin; Rect growRect={100,100,32000,32000}; long size; part=FindWindow(event->where, &window); macwin = (MacWindow*)GetWRefCon(window); switch(part) { case inMenuBar: mac_AdjustMenus(event->modifiers); mac_HandleMenuSelect(MenuSelect(event->where), event->modifiers); HiliteMenu(0); break; case inContent: SetPortWindowPort(window); SelectWindow(window); GlobalToLocal(&event->where); if(macwin) macwin->click(event->where, event->modifiers); break; case inDrag: DragWindow(window, event->where, &qd.screenBits.bounds); break; case inGrow: SetPortWindowPort(window); size=GrowWindow(window, event->where, &growRect); if( size ) { SizeWindow(window, size&0x0000FFFF, size>>16, 0); EraseRect(&GetWindowPort(window)->portRect); InvalRect(&GetWindowPort(window)->portRect); if( macwin ) macwin->message(MW_GROW, size); } break; case inGoAway: if( TrackGoAway(window, event->where) ){ if( macwin ){ macwin->goaway(macwin); } } break; //case inZoomIn: //case inZoomOut: // break; }}
开发者ID:OS2World,项目名称:MM-SOUND-TiMidity-MCD,代码行数:50,
示例18: HandleCustomMouseDownstatic void HandleCustomMouseDown(NavCBRecPtr callBackParms, CustomData *data){ EventRecord *evt = callBackParms->eventData.eventDataParms.event; Point where = evt->where; GlobalToLocal(&where); ControlRef control = FindControlUnderMouse(where, callBackParms->window, NULL); if (control != NULL) { HandleControlClick(control, where, evt->modifiers, (ControlActionUPP)-1L); NavCustomControl(callBackParms->context, kNavCtlBrowserRedraw, NULL); }}
开发者ID:Audacity-Team,项目名称:Audacity,代码行数:14,
示例19: DoClickInSrchvoid DoClickInSrch(EventRecord e){Point pt = e.where;short which; SetPort(srchWind); GlobalToLocal(&pt); which = ((pt.v/12)*4)+(pt.h/37); if(!((which==63) && (SR_Cnt>64))) if(which<SR_Cnt) { if(e.modifiers & cmdKey) WP_InsertAddr(SR[which]); else DoEditMem(SR[which]); }}
开发者ID:zenmumbler,项目名称:GrayBox,代码行数:15,
示例20: ActivateWindowbool nuiWindowManager::DispatchMouseClick(const nglMouseInfo& rInfo){ if (!IsEnabled()) return false; if (IsInsideFromRoot(rInfo.X, rInfo.Y)) { if (!mWindows.empty()) { std::list<nuiWindow*>::iterator it; std::list<nuiWindow*>::iterator begin = mWindows.begin(); it = mWindows.end(); do { it--; nuiWindow* win = *it; if (win->IsInsideFromRoot(rInfo.X, rInfo.Y)) { if (GetActiveWindow() != win) ActivateWindow(win); break; } } while (it!=begin); } IteratorPtr pIt; for (pIt = GetLastChild(); pIt && pIt->IsValid(); GetPreviousChild(pIt)) { nuiWidgetPtr pItem = pIt->GetWidget(); if (pItem && pItem->IsVisible() && pItem->IsEnabled()) { if (pItem->DispatchMouseClick(rInfo)) { delete pIt; return true; } } } delete pIt; nglMouseInfo info(rInfo); GlobalToLocal(info.X, info.Y); bool ret = MouseClicked(info); ret |= Clicked(info); return ret; } return false;}
开发者ID:JamesLinus,项目名称:nui3,代码行数:48,
示例21: wsp /** * Given a function /f$f(x)/f$ defined at the quadrature * points, this function determines the unknown global coefficients * /f$/boldsymbol{/hat{u}}^{/mathcal{H}}/f$ employing a discrete * Galerkin projection from physical space to coefficient * space. The operation is evaluated by the function #GlobalSolve using * the global mass matrix. * * The values of the function /f$f(x)/f$ evaluated at the * quadrature points /f$x_i/f$ should be contained in the * variable #m_phys of the ExpList object /a Sin. The resulting global * coefficients /f$/hat{u}_g/f$ are stored in the array #m_coeffs. * * @param inarray Discrete /f$f(x)/f$. * @param outarray Storage for result. * @param coeffstate */ void ContField1D::FwdTrans(const Array<OneD, const NekDouble> &inarray, Array<OneD, NekDouble> &outarray, CoeffState coeffstate) { // Inner product of forcing Array<OneD,NekDouble> wsp(m_ncoeffs); IProductWRTBase(inarray,wsp,eGlobal); // Solve the system GlobalLinSysKey key(StdRegions::eMass, m_locToGloMap); GlobalSolve(key,wsp,outarray); if(coeffstate == eLocal) { GlobalToLocal(outarray,outarray); } }
开发者ID:certik,项目名称:nektar,代码行数:34,
示例22: GlobalToLocal /** * Given the coefficients of an expansion, this function evaluates the * spectral/hp expansion /f$u^{/delta}(x)/f$ at the quadrature * points /f$x_i/f$. This operation is evaluated locally by the * function ExpList#BwdTrans. * * The coefficients of the expansion should be contained in the * variable #m_coeffs of the ExpList object /a In. The resulting * physical values at the quadrature points /f$u^{/delta}(x_i)/f$ are * stored in the array #m_phys. * * @param In An ExpList, containing the local * coefficients /f$/hat{u}_n^e/f$ in its array * #m_coeffs. */ void ContField1D::BwdTrans( const Array<OneD, const NekDouble> &inarray, Array<OneD, NekDouble> &outarray, CoeffState coeffstate) { Array<OneD, NekDouble> tmpinarray; if(coeffstate != eLocal) { tmpinarray = Array<OneD, NekDouble>(inarray); GlobalToLocal(inarray,tmpinarray); } else { tmpinarray = inarray; } BwdTrans_IterPerExp(tmpinarray,outarray); }
开发者ID:certik,项目名称:nektar,代码行数:33,
示例23: tmp1 /** * This is equivalent to the operation: * /f[/boldsymbol{M/hat{u}}_g/f] * where /f$/boldsymbol{M}/f$ is the global matrix of type specified by * /a mkey. After scattering the global array /a inarray to local * level, this operation is evaluated locally by the function * ExpList#GeneralMatrixOp. The global result is then obtained by a * global assembly procedure. * * @param mkey This key uniquely defines the type matrix * required for the operation. * @param inarray The vector /f$/boldsymbol{/hat{u}}_g/f$ of size * /f$N_{/mathrm{dof}}/f$. * @param outarray The resulting vector of size * /f$N_{/mathrm{dof}}/f$. */ void ContField1D::v_GeneralMatrixOp( const GlobalMatrixKey &gkey, const Array<OneD,const NekDouble> &inarray, Array<OneD, NekDouble> &outarray, CoeffState coeffstate) { if(coeffstate == eGlobal) { Array<OneD,NekDouble> tmp1(2*m_ncoeffs); Array<OneD,NekDouble> tmp2(tmp1+m_ncoeffs); GlobalToLocal(inarray,tmp1); GeneralMatrixOp_IterPerExp(gkey,tmp1,tmp2); Assemble(tmp2,outarray); } else { GeneralMatrixOp_IterPerExp(gkey,inarray,outarray); } }
开发者ID:certik,项目名称:nektar,代码行数:35,
示例24: DoClickInWPvoid DoClickInWP(EventRecord e){Point pt = e.where; SetPort(wpWind); GlobalToLocal(&pt); if(pt.v<12) return; if(pt.v<396) { pt.v-=12; if(pt.h<33) // left DoEditWPAddr((pt.v/12)+(wpCurPage*32)); if((pt.h>32) && (pt.h<66)) // middle DoEditWPVal((pt.v/12)+(wpCurPage*32)); if(pt.h>65) // right DoEditWPText((pt.v/12)+(wpCurPage*32)); } else wpCurPage = pt.h/33; WP_Update();}
开发者ID:zenmumbler,项目名称:GrayBox,代码行数:22,
示例25: DoClickInStatvoid DoClickInStat(EventRecord e){#ifdef GB_DEBUGRect boxes[6];Point pt = e.where; if(cart_data!=0L) { SetRect(&boxes[0], 40, 36, 74, 55); SetRect(&boxes[1], 132, 36, 166, 55); SetRect(&boxes[2], 230, 36, 264, 55); SetRect(&boxes[3], 40, 65, 74, 84); SetRect(&boxes[4], 132, 65, 166, 84); SetRect(&boxes[5], 230, 65, 264, 84); SetPort(statWind); GlobalToLocal(&pt); for(short x=0;x<6;x++) if(PtInRect(pt, &boxes[x])) { DoEditReg(x); Stat_ForceUpdate(); } }#endif}
开发者ID:zenmumbler,项目名称:GrayBox,代码行数:22,
注:本文中的GlobalToLocal函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GlobalUnlock函数代码示例 C++ GlobalSize函数代码示例 |