• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetMouse函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了GetMouse函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Bounds

void
QuaSymbolBridge::MouseDown(BPoint where)
{
	long		channel, quant;
	BRect		area = Bounds();

	ulong		mods = modifiers(); // Key mods???
	ulong		buts;
	BMessage	*msg;
	BPoint		pt;
	drawing_mode	cur_mode = DrawingMode();
	long		clicks;
	
	GetMouse(&pt, &buts);
	msg = Window()->CurrentMessage();
	
	if ((clicks=msg->FindInt32("clicks")) == 1) {
		if (buts & B_SECONDARY_MOUSE_BUTTON) {
			BPopUpMenu	*qMenu = new BPopUpMenu("env sel", true, FALSE);
			
			BPoint			orig = where;
			ConvertToScreen(&where);
			
			BMessage	*msg = new BMessage(SET_DISPLAY_MODE);
			msg->AddInt32("display mode", OBJECT_DISPLAY_SMALL);
			BMenuItem	*item = new BMenuItem("Small", msg);
			qMenu->AddItem(item);
			item->SetTarget(this);
		
			msg = new BMessage(SET_DISPLAY_MODE);
			msg->AddInt32("display mode", OBJECT_DISPLAY_BIG);
			item = new BMenuItem("Large", msg);
			qMenu->AddItem(item);
			item->SetTarget(this);
		
			qMenu->SetAsyncAutoDestruct(true);
			qMenu->Go(where, true, false, true);
		} else {
			msg = new BMessage(MOVE_OBJECT);
		 	msg->AddPointer("sym_object", this);
		 	
			if (mods & B_SHIFT_KEY) {
				((ObjectViewContainer *)Parent())->AddSelection(this);
			} else {
				((ObjectViewContainer *)Parent())->Select(this);
			}
		
			DragMessage(msg, area);
		}
	} else if (clicks > 1) {	// edit object
		Edit();
	} else {
	}
}
开发者ID:dakyri,项目名称:qua,代码行数:54,代码来源:SymObject.cpp


示例2: GetMouse

// MouseWheelChanged
bool
DragSortableListView::MouseWheelChanged(float x, float y)
{
	BPoint where;
	uint32 buttons;
	GetMouse(&where, &buttons, false);
	if (Bounds().Contains(where))
		return true;
	else
		return false;
}
开发者ID:DonCN,项目名称:haiku,代码行数:12,代码来源:ListViews.cpp


示例3: GetMouse

void TextScrollerView::MouseDown(BPoint point)
{
	tracking_mouse = true;
	uint32 buttons;
	GetMouse(&point,&buttons);
	previous_point = point;
	while (buttons) {
		float distance = (point.y - previous_point.y) / 10.0;
		if (distance > 0)
			distance = min_c(distance,5.0);
		else
			distance = max_c(distance,-5.0);

		LockLooper();
		text_view->ScrollBy(0,-distance);
		GetMouse(&point,&buttons);
		UnlockLooper();
		snooze(20 * 1000);
	}
	tracking_mouse = false;
}
开发者ID:puckipedia,项目名称:ArtPaint,代码行数:21,代码来源:AboutWindow.cpp


示例4: DragGraphWindow

INT DragGraphWindow (GRAPH_WINDOW *gw, EventRecord *theEvent, DOC_DRAG_EVENT *docDrag)
{
  WindowPtr theWindow;
  int TopOld, BottomOld, LeftOld, RightOld, Left, Right, Top, Bottom, DelLeft, DelRight, DelTop, DelBottom;
  Rect currentRect;
  Rect theDragRect;
  Point MouseLoc;

  theWindow = MAC_WIN(gw);

        #warning do we need kWindowContentRgn instead of kWindowStructureRgn?
  GetWindowBounds(theWindow, kWindowStructureRgn, &currentRect);
  /* store old corners of the window */
  TopOld     = currentRect.top;
  BottomOld  = currentRect.bottom;
  LeftOld    = currentRect.left;
  RightOld   = currentRect.right;

  /* set drag rect */
  GetMouse(&MouseLoc);
  LocalToGlobal(&MouseLoc);
  Left   = DragRect()->left       + MouseLoc.h - LeftOld;
  Right  = DragRect()->right      + MouseLoc.h - RightOld;
  Top    = DragRect()->top        + MouseLoc.v - TopOld;
  Bottom = DragRect()->bottom + MouseLoc.v - BottomOld;
  SetRect(&theDragRect,Left,Top,Right,Bottom);

  /* drag window */
  DragWindow (theWindow,theEvent->where,&theDragRect);

  /* report new size */
        #warning do we need kWindowContentRgn instead of kWindowStructureRgn?
  GetWindowBounds(theWindow, kWindowStructureRgn, &currentRect);
  Left   = currentRect.left;
  Right  = currentRect.right;
  Top    = currentRect.top;
  Bottom = currentRect.bottom;
  DelLeft         = Left  - LeftOld;
  DelRight        = Right - RightOld;
  DelTop          = Top   - TopOld;
  DelBottom       = Bottom- BottomOld;

  if (DelLeft==0 && DelRight==0 && DelTop==0 && DelBottom)
    return (NO_POS_CHANGE);

  docDrag->Global_LL[0] = gw->Global_LL[0] += DelLeft;
  docDrag->Global_LL[1] = gw->Global_LL[1] += DelBottom;
  docDrag->Global_UR[0] = gw->Global_UR[0] += DelRight;
  docDrag->Global_UR[1] = gw->Global_UR[1] += DelTop;

  return (POS_CHANGE);
}
开发者ID:rolk,项目名称:ug,代码行数:52,代码来源:MacGraph.c


示例5: GetMouse

void Mover::MouseMoved(BPoint p,uint32 transit,const BMessage *bla)
{
    if (moving)
    {
        uint32 dummy;
        GetMouse(&p,&dummy,false);
        p = ConvertToScreen(p);
        BMessage moved(MOVER_MESSAGE);
        moved.AddPointer(MM_VIEW,this);

        float coord;
        if (vertical)
            coord = p.x-clickPoint.x;
        else
            coord = p.y-clickPoint.y;
        moved.AddFloat(MM_COORD,coord);

        // est-on dans les limites?
        bool l_InLimits = true;
        if (!vertical)
        {
            if ( (coord < limits.top) || (coord > limits.bottom))
                l_InLimits = false;
        }
        else
        {
            if ( (coord < limits.left) || (coord > limits.right))
                l_InLimits = false;
        }

        if (l_InLimits)
            Window()->PostMessage(&moved);
    }
    else
        switch(transit)
        {
        case B_ENTERED_VIEW:
            if(vertical)
                be_app->SetCursor(verticalMouse);
            else
                be_app->SetCursor(horizontalMouse);
            break;

        case B_EXITED_VIEW:
        case B_OUTSIDE_VIEW:
            be_app->SetCursor(B_HAND_CURSOR);
            break;

        default:
            break;
        }
}
开发者ID:mmadia,项目名称:behappy-svn_clone,代码行数:52,代码来源:Mover.cpp


示例6: GetMouse

void
TMagnify::NudgeMouse(float x, float y)
{
	BPoint loc;
	uint32 button;

	GetMouse(&loc, &button);
	ConvertToScreen(&loc);
	loc.x += x;
	loc.y += y;

	set_mouse_position((int32)loc.x, (int32)loc.y);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:13,代码来源:Magnify.cpp


示例7: GetMouse

void
TipsterText::MouseDown(BPoint pt)
{
	BPoint temp;
	uint32 buttons;
	GetMouse(&temp, &buttons);

	if (Bounds().Contains(temp)) {
		BMessage message(M_UPDATE_TIP);
		
		fMessenger->SendMessage(&message);
	}
}
开发者ID:hannahyp,项目名称:Tipster,代码行数:13,代码来源:TipsterText.cpp


示例8: MakeFocus

void PulseView::MouseDown(BPoint point) {
	BPoint cursor;
	uint32 buttons;
	MakeFocus(true);
	GetMouse(&cursor, &buttons, true);

	if (buttons & B_SECONDARY_MOUSE_BUTTON) {
		ConvertToScreen(&point);
		// Use the asynchronous version so we don't interfere with
		// the window responding to Pulse() events
		popupmenu->Go(point, true, false, true);
	}
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:13,代码来源:PulseView.cpp


示例9: GetMouse

bool CObjectRotateCamera::Update()
{
    CMouseManager* mouse = GetMouse();
    bool down[2] = {mouse->IsPressed(0), mouse->IsPressed(1)};
    int x = mouse->GetX();
    int y = mouse->GetY();

    int dx = x - m_lastx;
    int dy = y - m_lasty;
    
    bool needUpdate = false;

    if (!GetKeyboard()->IsPressed(VK_SHIFT) && m_lastDown[0] && down[0] && (abs(dx) + abs(dy) > 0))
    {
        m_anglex += dx * 0.01f; // * elapsedTime;
        m_anglez += dy * 0.01f;// * elapsedTime;

        m_anglex = NormAngle(m_anglex);
        m_anglez = NormAngle(m_anglez);
        Point3 eye = Angle2Pos(m_anglex, m_anglez);
        SetEye(eye.x, eye.y, eye.z);         
        needUpdate = true;
    }

    if (GetMouse()->GetWheel() != 0)
    {
        m_radius *= max(0.01f, 1 - GetMouse()->GetWheel() * 0.0003f);
        Point3 eye = Angle2Pos(m_anglex, m_anglez);
        SetEye(eye.x, eye.y, eye.z);
        needUpdate = true;
    }

    m_lastDown[0] = down[0];
    m_lastDown[1] = down[1];
    m_lastx = x;
    m_lasty = y;
   
    return needUpdate;
}
开发者ID:redclock,项目名称:GIEngine,代码行数:39,代码来源:ObjectRotateCamera.cpp


示例10: GetGWorld

void MCScreenDC::querymouse(int2 &x, int2 &y)
{
	CGrafPtr oldport;
	GDHandle olddevice;
	GetGWorld(&oldport, &olddevice);
	MoveWindow(invisibleWin, 0, 0, False); // OS X moves this.
	SetGWorld(GetWindowPort(invisibleWin), GetMainDevice());
	Point mloc;
	GetMouse(&mloc);      //get local mouse position
	SetGWorld(oldport, olddevice);
	x = mloc.h;
	y = mloc.v;
}
开发者ID:Bjoernke,项目名称:livecode,代码行数:13,代码来源:osxdce.cpp


示例11: SetMouseEventMask

void PictureViewer::MouseDown(BPoint a) {
  mouseDown = true;  
  oldMousePos = a;  
  SetMouseEventMask(1);


  uint32 buttons;
  int32 action = 0;
  BPoint ad;
  GetMouse(&ad, &buttons );
  
  if ( buttons == B_PRIMARY_MOUSE_BUTTON )  action = setup->LeftMouseAction();
  if ( buttons == B_SECONDARY_MOUSE_BUTTON )  action = setup->RightMouseAction();
  if ( buttons == B_TERTIARY_MOUSE_BUTTON )  action = setup->MiddleMouseAction();

  if (action == P_OPENNEW) {
       if (thePic != NULL) {
          if (theRef != NULL)  be_roster->Launch(theRef);
          mouseDown = false;
          return;
       }
  }

  if (action == P_CLIPPING) 
  {
    if (  (setup->ViewingMode() == PEEK_IMAGE_SCALED_NICELY)   ||
          (setup->ViewingMode() == PEEK_IMAGE_SCALE_TO_WINDOW) ||
          (setup->ViewingMode() == PEEK_IMAGE_SCALE_TO_WINDOW)
       ) return;
       
       if (thePic != NULL) 
       {
          if (clipping) DrawClipping();
          busyClipping = true;
          clipping = true;
          clippingRegion.Set( ad.x, ad.y, ad.x, ad.y );
       }
  }

  if (action == P_FULLSCREEN) {
      ((WindowPeek*)Window())->SetFullScreen( ! setup->FullScreen() );    
      return;
  }

  if (action == P_HIDEFILES) {
      ((WindowPeek*)Window())->SetCompactMode( ! setup->CompactMode()   );
      return;
  }


}
开发者ID:HaikuArchives,项目名称:Peek,代码行数:51,代码来源:pictureViewer.cpp


示例12: GetMouse

void TPanelWindowView::MouseDown( BPoint point )
{
	uint32 buttons;
	GetMouse( &point, &buttons );

	if ( !fIsDraggingFromOutside )
	{
		if ( modifiers() & B_SHIFT_KEY )
		{
			int count = 5;
			while ( count )
			{
				count --;
				BPoint pw;
				uint32 mods;
				GetMouse( &pw, &mods );
				if ( !mods )
					break;
				if ( !(modifiers() & B_SHIFT_KEY ) )
					break;
				if ( pw != point )
				{
//					TODO: fix this, we want this on separate thread so drawing doesnt block
//					thread_id tid = spawn_thread( _rearrange_tabs_thread_entry, "ReArrangeTabsThread", B_NORMAL_PRIORITY, this );
//					resume_thread(tid);
					ReArrangeTabsThread();

					return;
				}
				snooze( 500000 / 5 );
			}
		}

		TInnerPanel *panel = PanelAt( point );
		if ( panel )
			panel->MouseDown(point, buttons);
	}
}
开发者ID:HaikuArchives,项目名称:DockBert,代码行数:38,代码来源:PanelWindowView.cpp


示例13: mac_eventloop

static void mac_eventloop(void) {
    Boolean gotevent;
    EventRecord event;
    RgnHandle cursrgn;
    Point mousenow, mousethen;
    KeyState *ks;
    WindowPtr front;

    cursrgn = NewRgn();
    GetMouse(&mousethen);
    for (;;) {
    	mac_adjustcursor(cursrgn);
	gotevent = WaitNextEvent(everyEvent, &event, LONG_MAX, cursrgn);
	mac_adjustcursor(cursrgn);
	front = mac_frontwindow();
	if (front != NULL) {
	    ks = mac_windowkey(front);
	    if (ks->collecting_entropy) {
		GetMouse(&mousenow);
		if (mousenow.h != mousethen.h || mousenow.v != mousethen.v) {
		    ks->entropy[ks->entropy_got++] = *(unsigned *)&mousenow;
		    ks->entropy[ks->entropy_got++] = TickCount();
		    if (ks->entropy_got >= ks->entropy_required)
			ks->collecting_entropy = 0;
		    SetControlValue(ks->progress, ks->entropy_got);
		    mousethen = mousenow;
		}
		SetEmptyRgn(cursrgn);
	    }
	}
	    
	if (gotevent)
	    mac_event(&event);
	if (borednow)
	    cleanup_exit(0);
    }
    DisposeRgn(cursrgn);
}
开发者ID:LapsedAcademicsInc,项目名称:putty,代码行数:38,代码来源:macpgen.c


示例14: GetCursorPos

void GetCursorPos(MOUSE_POINT& point)
{
	#ifdef _MSC_VER
		POINT p;
		GetCursorPos (&p);	
		point.x = p.x;
		point.y = p.y;
	#else
		Point p;
		GetMouse (&p);
		point.x = p.h;
		point.y = p.v;
	#endif
}
开发者ID:brettminnie,项目名称:BDBGame,代码行数:14,代码来源:OpenGlUtil.cpp


示例15: delete

// MouseDown
void
TestView::MouseDown(BPoint where)
{
	// clear previous stroke
	int32 count = fMouseSamples.CountItems();
	for (int32 i = 0; i < count; i++)
		delete (BPoint*)fMouseSamples.ItemAtFast(i);
	fMouseSamples.MakeEmpty();
	FillRect(Bounds(), B_SOLID_LOW);

	// sample new stroke
	uint32 buttons;
	GetMouse(&where, &buttons);
	MovePenTo(where);
	while (buttons) {

		StrokeLine(where);
		fMouseSamples.AddItem(new BPoint(where));

		snooze(20000);
		GetMouse(&where, &buttons);
	}
}
开发者ID:mmanley,项目名称:Antares,代码行数:24,代码来源:main.cpp


示例16: GetMouse

void CGUISlider::AfterUpdate( float elapsedTime )
{
    m_bChanged = false;
    if (m_bPushed)
    {
        m_bPushed = GetMouse()->IsPressed(0);
        m_value = ComputeValue();
        if (m_value != m_lastValue)
        {
            m_bChanged = true;
            m_lastValue = m_value;
        }
    }
}
开发者ID:redclock,项目名称:GIEngine,代码行数:14,代码来源:GameUI.cpp


示例17: PyMac_PRECHECK

static PyObject *Evt_GetMouse(PyObject *_self, PyObject *_args)
{
    PyObject *_res = NULL;
    Point mouseLoc;
#ifndef GetMouse
    PyMac_PRECHECK(GetMouse);
#endif
    if (!PyArg_ParseTuple(_args, ""))
        return NULL;
    GetMouse(&mouseLoc);
    _res = Py_BuildValue("O&",
                         PyMac_BuildPoint, mouseLoc);
    return _res;
}
开发者ID:0xcc,项目名称:python-read,代码行数:14,代码来源:_Evtmodule.c


示例18: GetMouse

void FontDrawView::MouseDown(BPoint where)
{
	BPoint pt;
	uint32 buttons;

	GetMouse(&pt,&buttons);
	if(buttons == B_PRIMARY_MOUSE_BUTTON)
		oldpoint=where;

	if(buttons == B_SECONDARY_MOUSE_BUTTON)
	{	fontlocation=where;
		Draw(Bounds());
	}
}
开发者ID:HaikuArchives,项目名称:BePhotoMagic,代码行数:14,代码来源:TextToolView.cpp


示例19: GetCursorPosition

static void
GetCursorPosition( const WindowInfo *window, int pos[2] )
{
	Point mouse_pos;
	float window_rect[4];

	GetMouse( &mouse_pos );
	CGSGetScreenRectForWindow( window->connection, window->drawable, window_rect );

	pos[0] = mouse_pos.h - (int) window_rect[0];
	pos[1] = (int) window_rect[3] - (mouse_pos.v - (int) window_rect[1]);

	/*crDebug( "%i %i", pos[0], pos[1] );*/
}
开发者ID:boompig,项目名称:chromium,代码行数:14,代码来源:context.c


示例20: DrawImageAdv

///////////////////
// Draw the scrollbar
void CScrollbar::Draw(SDL_Surface * bmpDest)
{
	int x=0;
	int length;
    
	// Top arrow
	if(bTopButton)
		x=15;
	DrawImageAdv(bmpDest, gfxGUI.bmpScrollbar, x,0, iX,iY, 15,14);

	// Bottom arrow
	x=0;
	if(bBotButton)
		x=15;
	DrawImageAdv(bmpDest, gfxGUI.bmpScrollbar, x,14, iX,iY+iHeight-14, 15,14);

	// Main bit
	DrawRectFill(bmpDest, iX,iY+14, iX+iWidth, iY+iHeight-14, tLX->clScrollbarBack);
	DrawVLine(bmpDest, iY+14, iY+iHeight-14, iX,tLX->clScrollbarBackLight);
	DrawVLine(bmpDest, iY+14, iY+iHeight-14, iX+iWidth,tLX->clScrollbarBackLight);

	// Slider
	if(iMax > iItemsperbox && iMax > 0) {
		length = (int)((float)iItemsperbox/(float)iMax * iHeight-30);
        length = MAX(length, 12);
        
		int pos = iScrollPos;
		if(pos+length > iHeight-30)
			pos=iHeight-30-length;
		if (pos < 0)  
			pos = 0;

		DrawRectFill(bmpDest, iX+2, iY+15+pos, iX+iWidth-1, iY+15+pos+length, tLX->clScrollbarFront);

        // Shine
        DrawVLine(bmpDest, iY+15+pos, iY+15+pos+length, iX+1, tLX->clScrollbarHighlight);
        DrawHLine(bmpDest, iX+1, iX+iWidth-1, iY+15+pos, tLX->clScrollbarHighlight);
        // Dark
        DrawVLine(bmpDest, iY+15+pos, iY+15+pos+length, iX+iWidth-1, tLX->clScrollbarShadow);
        DrawHLine(bmpDest, iX+1, iX+iWidth-1, iY+15+pos+length, tLX->clScrollbarShadow);
	}

	// Slight hack
	if( !GetMouse()->Button ) {
		bTopButton=false;
		bBotButton=false;
	}
		
}
开发者ID:iamnilay3,项目名称:openlierox,代码行数:51,代码来源:CScrollbar.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetMousePos函数代码示例发布时间:2022-05-30
下一篇:
C++ GetMoney函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap