本文整理汇总了C++中GetMouse函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMouse函数的具体用法?C++ GetMouse怎么用?C++ GetMouse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetMouse函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 {
}
}
示例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;
}
示例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;
}
示例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, ¤tRect);
/* 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, ¤tRect);
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);
}
示例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;
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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);
}
}
示例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);
}
示例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
}
示例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);
}
}