当前位置: 首页>>代码示例>>C++>>正文


C++ GlobalToLocal函数代码示例

本文整理汇总了C++中GlobalToLocal函数的典型用法代码示例。如果您正苦于以下问题:C++ GlobalToLocal函数的具体用法?C++ GlobalToLocal怎么用?C++ GlobalToLocal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GlobalToLocal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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,代码来源:PrefsWindow.c

示例2: GetEventParameter

pascal 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,代码来源:pxWindowNative.cpp

示例3: m_DoubleTapAction

template <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,代码来源:MenuWidget.hpp

示例4: m_TapAction

template <typename T> void ListWidget<T>::ProcessTap(InputEvent & InputEvent, Vector2n Position)
{
	if (nullptr != m_TapAction)
	{
		m_TapAction(GlobalToLocal(Position), m_List);
	}
}
开发者ID:prinsmike,项目名称:Conception,代码行数:7,代码来源:ListWidget.hpp

示例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,代码来源:agg_platform_support.cpp

示例6: wxMacWindowDragReceiveHandler

pascal 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,代码来源:dnd.cpp

示例7: GetPort

void 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,代码来源:GBWindow.cpp

示例8: device_dialog_filter_proc

static 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,代码来源:device_dialog.c

示例9: doEventLoop

void 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,代码来源:ZoomRecter.c

示例10: doMyDeviceLoop

// New doMyDeviceLoop, now works with multiple monitors
void 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,代码来源:MyDeviceLoop.c

示例11: Quartz_Locator

static 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,代码来源:devQuartz.c

示例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,代码来源:Utility.cpp

示例13: get_mouse

static
void get_mouse(Point *mouse, EventModifiers *modifiers)
{
  EventRecord event;

  EventAvail(0, &event);

  *mouse = event.where;
  *modifiers = event.modifiers;

  GlobalToLocal(mouse);
}
开发者ID:albertocabello,项目名称:gr,代码行数:12,代码来源:mac.c

示例14: mac_clickeventlog

void 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,代码来源:macevlog.c

示例15: CheckValid

bool 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,代码来源:nuiContainer.cpp


注:本文中的GlobalToLocal函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。