这篇教程C++ GetWindowBounds函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetWindowBounds函数的典型用法代码示例。如果您正苦于以下问题:C++ GetWindowBounds函数的具体用法?C++ GetWindowBounds怎么用?C++ GetWindowBounds使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetWindowBounds函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetWindowBounds/* * given an index and a pointer to an AttractedChannel structure, this routine * checks if there is another channel window in the neighbourhood and if it's there, * true is returned and neigh is filled with a reference to the neighbour channel and a flag * that specifies if its window is on the left or on the right */bool CARBON_GUI::attract_channels(int chIndex,AttractedChannel *neigh) { Rect bounds; if(!channel[chIndex]) return false; GetWindowBounds(channel[chIndex]->window,kWindowGlobalPortRgn,&bounds); for ( int i = 0;i < MAX_CHANNELS;i++) { if(i!=chIndex) { if(channel[i]) { Rect space; GetWindowBounds(channel[i]->window,kWindowStructureRgn,&space); if(!channel[i]->attached() && bounds.top > space.top-50 && bounds.top < space.top+50) { if(bounds.right > space.left-155 && bounds.right < space.left-90) { neigh->position=ATTACH_RIGHT; neigh->channel = channel[i]; return true; } if(bounds.left < space.right+155 && bounds.left > space.right+90) { neigh->position=ATTACH_LEFT; neigh->channel=channel[i]; return true; } } } } } return false;}
开发者ID:dyne,项目名称:MuSE,代码行数:32,
示例2: setWindowTrackingRgnvoid setWindowTrackingRgn(int windowIndex) { Rect rgnRect; RgnHandle rgn = NewRgn(); MouseTrackingRegionID id; windowDescriptorBlock *windowBlock = windowBlockFromIndex(windowIndex); if (!windowBlock) return; if (windowBlock->windowTrackingRef) { GetWindowBounds(windowBlock->handle, kWindowContentRgn, &rgnRect); SetRectRgn( rgn, rgnRect.left, rgnRect.top, rgnRect.right, rgnRect.bottom ); ChangeMouseTrackingRegion(windowBlock->windowTrackingRef,rgn, NULL); DisposeRgn( rgn ); return; } GetWindowBounds(windowBlock->handle, kWindowContentRgn, &rgnRect); SetRectRgn( rgn, rgnRect.left, rgnRect.top, rgnRect.right, rgnRect.bottom ); id.signature = 'FAST'; id.id = windowIndex; OSStatus err = CreateMouseTrackingRegion(windowBlock->handle, rgn, NULL, kMouseTrackingOptionsGlobalClip, id, NULL, NULL, &windowBlock->windowTrackingRef); if ( noErr == err ) { RetainMouseTrackingRegion( windowBlock->windowTrackingRef); err = SetMouseTrackingRegionEnabled( windowBlock->windowTrackingRef, TRUE ); } DisposeRgn( rgn ); }
开发者ID:Geal,项目名称:Squeak-VM,代码行数:33,
示例3: DragGraphWindowINT 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);}
开发者ID:rolk,项目名称:ug,代码行数:52,
示例4: childBoundsChanged void childBoundsChanged (juce::Component* child) { setSize (child->getWidth(), child->getHeight()); child->setTopLeftPosition (0, 0);#if JUCE_WIN32 resizeHostWindow (hostWindow, titleW, titleH, this); owner->updateSize();#else Rect r; GetWindowBounds ((WindowRef) hostWindow, kWindowContentRgn, &r); HIRect p; zerostruct (p); HIViewConvertRect (&p, parentView, 0); // find the X position of our view in case there's space to the left of it r.right = r.left + jmax (titleW, ((int) p.origin.x) + getWidth()); r.bottom = r.top + getHeight() + titleH; SetWindowBounds ((WindowRef) hostWindow, kWindowContentRgn, &r); owner->updateSize(); owner->Invalidate();#endif }
开发者ID:NonPlayerCharactor,项目名称:juce_pitcher,代码行数:25,
示例5: GetWindowBoundsbool CompDateAxis::GetWindowDateBounds(wxDateTime &date0, wxDateTime &date1){ double winMin, winMax; GetWindowBounds(winMin, winMax); int firstDateIndex = (int) winMin; int lastDateIndex = RoundHigh(winMax) - 1; if (lastDateIndex < firstDateIndex) { lastDateIndex = firstDateIndex; } wxDateSpan span; if (!GetMinSpan(span)) { return false; } wxDateTime date; if (!GetFirstDate(date)) { return false; } date0 = date; for (int n = 0; n < firstDateIndex; n++) { date0 += span; } date1 = date; for (int n = 0; n < lastDateIndex; n++) { date1 += span; } return true;}
开发者ID:lukecian,项目名称:wxfreechart,代码行数:32,
示例6: exitEventHandlervoid Window::setCarbonWindow( WindowRef window ){ LBVERB << "set Carbon window " << window << std::endl; if( _impl->carbonWindow == window ) return; if( _impl->carbonWindow ) exitEventHandler(); _impl->carbonWindow = window; if( !window ) return; if( getIAttribute( WindowSettings::IATTR_HINT_DRAWABLE ) == OFF ) return; initEventHandler(); Rect rect; Global::enterCarbon(); if( GetWindowBounds( window, kWindowContentRgn, &rect ) == noErr ) { PixelViewport pvp( rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top ); if( getIAttribute( WindowSettings::IATTR_HINT_DECORATION ) != OFF ) pvp.y -= EQ_AGL_MENUBARHEIGHT; setPixelViewport( pvp ); } Global::leaveCarbon();}
开发者ID:hernando,项目名称:Equalizer,代码行数:33,
示例7: cameraInitializevoid cameraInitialize(GLCamera *theCam, WindowPtr winPtr){ Rect winPort; GLdouble viewparms[] = {-0.5, 0.5, // Left Right -0.5, 0.5, // Bottom Top 0.5, 100.0}; // zNear zFar GLdouble *viewVol = theCam->viewVolume; GetWindowBounds(winPtr, kWindowContentRgn, &winPort); theCam->w = winPort.right - winPort.left; theCam->h = winPort.bottom - winPort.top; theCam->aspectRatio = theCam->h / theCam->w; theCam->fov = 3.141517/2; // pi/2 theCam->hFrac = tan(theCam->fov * 0.5); theCam->vFrac = tan(theCam->fov * 0.5 * theCam->aspectRatio); glViewport(0, 0, (GLsizei) theCam->w, (GLsizei) theCam->h); cameraSetViewParameters(theCam, viewparms); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); cameraMove(theCam, 0.0, 0.0, -4.0); glMatrixMode(GL_PROJECTION); glLoadIdentity();#if 1//USE_PERSPECTIVE glFrustum(viewVol[0], viewVol[1], viewVol[2], viewVol[3], viewVol[4], viewVol[5]);#else glOrtho(viewVol[0], viewVol[1], viewVol[2], viewVol[3], viewVol[4], viewVol[5]);#endif glMatrixMode(GL_MODELVIEW);}
开发者ID:fruitsamples,项目名称:Carbon_GLSnapshot,代码行数:34,
示例8: s86procstatic pascal OSStatus s86proc(EventHandlerCallRef myHandler, EventRef event, void* userData) { OSStatus err = eventNotHandledErr; HIPoint pos; Point p; Rect ctrlbounds, winbounds; PicHandle pict; if (GetEventClass(event)==kEventClassControl && GetEventKind(event)==kEventControlClick ) { err = noErr; GetEventParameter(event, kEventParamMouseLocation, typeHIPoint, NULL, sizeof(HIPoint), NULL, &pos); GetControlBounds((ControlRef)userData, &ctrlbounds); GetWindowBounds(soundWin, kWindowContentRgn, &winbounds); p.h = (short)pos.x; p.h -= (ctrlbounds.left + winbounds.left); p.h /= 8; if ((p.h < 2) || (p.h >= 10)) { return(err); } p.h -= 2; snd86 ^= (1 << p.h); set86s(); setbmp(dipswbmp_getsnd86(snd86), &pict); SetControlData((ControlRef)userData, kControlNoPart, kControlPictureHandleTag, sizeof(PicHandle), &pict); Draw1Control((ControlRef)userData); } (void)myHandler; (void)userData; return err;}
开发者ID:amuramatsu,项目名称:np2-mod,代码行数:30,
示例9: getWindowContentRegionRgnHandle getWindowContentRegion(WindowRef window,RgnHandle contentRegion){ Rect portBounds; GetWindowBounds(window, kWindowGlobalPortRgn, &portBounds); RectRgn(contentRegion, &portBounds); return contentRegion;}
开发者ID:Bjoernke,项目名称:livecode,代码行数:7,
示例10: ShowWindow// ---------------------------------------------------------------------------void OSXWindowImpl::show(){ ShowWindow(mWindowRef); GetWindowBounds(mWindowRef,kWindowContentRgn,&mRect); if (window) window->resize( mRect.right - mRect.left, mRect.bottom - mRect.top );}
开发者ID:jefferis,项目名称:rgl,代码行数:8,
示例11: GetWindowBoundsvoid SkOSWindow::updateSize(){ Rect r; GetWindowBounds((WindowRef)fHWND, kWindowContentRgn, &r); this->resize(r.right - r.left, r.bottom - r.top);}
开发者ID:04005003,项目名称:platform_development,代码行数:7,
示例12: ResizeWindowvoid ResizeWindow(WindowRef pWindow, int w, int h){ Rect gr; // Screen. GetWindowBounds(pWindow, kWindowContentRgn, &gr); gr.right = gr.left + w; gr.bottom = gr.top + h; SetWindowBounds(pWindow, kWindowContentRgn, &gr);}
开发者ID:Brado231,项目名称:Faderport_XT,代码行数:8,
示例13: getmaincenterstatic void getmaincenter(Point *cp) { Rect rct; GetWindowBounds(hWndMain, kWindowContentRgn, &rct); cp->h = (rct.right + rct.left) / 2; cp->v = (rct.bottom + rct.top) / 2;}
开发者ID:FREEWING-JP,项目名称:np2pi,代码行数:8,
示例14: _glfwPlatformGetWindowGeom// Function added by ZBS 19 Apr 2004; brought to GLFW2.7.2 by TFBvoid _glfwPlatformGetWindowGeom( int *x, int *y, int *w, int *h ) { Rect bounds; GetWindowBounds( _glfwWin.MacWindow, kWindowGlobalPortRgn, &bounds ); *x = bounds.left; *y = bounds.top; *w = bounds.right - bounds.left; *h = bounds.bottom - bounds.top;}
开发者ID:mikanradojevic,项目名称:sdkpub,代码行数:9,
示例15: SaveWindowPosvoidSaveWindowPos(WindowPtr win){ Rect r; GetWindowBounds(win, kWindowContentRgn, &r); SavePosition(GetWinKind(win), r.top, r.left);}
开发者ID:BarclayII,项目名称:slashem-up,代码行数:9,
示例16: SaveWindowPositionvoid SaveWindowPosition (WindowRef window, int which){ Rect rct; GetWindowBounds(window, kWindowContentRgn, &rct); windowPos[which].h = rct.left; windowPos[which].v = rct.top; windowSize[which].width = (float) (rct.right - rct.left); windowSize[which].height = (float) (rct.bottom - rct.top );}
开发者ID:OV2,项目名称:snes9x-libsnes,代码行数:10,
示例17: palette_scenery_closevoid palette_scenery_close(int *x,int *y){ Rect box; GetWindowBounds(palette_scenery_wind,kWindowGlobalPortRgn,&box); *x=box.left; *y=box.top; DisposeWindow(palette_scenery_wind);}
开发者ID:prophile,项目名称:dim3,代码行数:10,
示例18: GetWindowBoundsvoid OSVRTrackedDevice::GetRecommendedRenderTargetSize(uint32_t* width, uint32_t* height){ /// @todo calculate overfill factor properly double overfillFactor = 1.0; int32_t x, y; uint32_t w, h; GetWindowBounds(&x, &y, &w, &h); *width = w * overfillFactor; *height = h * overfillFactor;}
开发者ID:DjDyll,项目名称:SteamVR-OSVR,代码行数:10,
示例19: HIViewGetFrameIPopupMenu* IGraphicsCarbon::CreateIPopupMenu(IPopupMenu* pMenu, IRECT* pAreaRect){ // Get the plugin gui frame rect within the host's window HIRect rct; HIViewGetFrame(this->mView, &rct); // Get the host's window rect within the screen Rect wrct; GetWindowBounds(this->mWindow, kWindowContentRgn, &wrct); #ifdef RTAS_API int xpos = wrct.left + this->GetLeftOffset() + pAreaRect->L; int ypos = wrct.top + this->GetTopOffset() + pAreaRect->B + 5; #else HIViewRef contentView; HIViewFindByID(HIViewGetRoot(this->mWindow), kHIViewWindowContentID, &contentView); HIViewConvertRect(&rct, HIViewGetSuperview((HIViewRef)this->mView), contentView); int xpos = wrct.left + rct.origin.x + pAreaRect->L; int ypos = wrct.top + rct.origin.y + pAreaRect->B + 5; #endif MenuRef menuRef = CreateMenu(pMenu); if (menuRef) { int32_t popUpItem = 1; int32_t PopUpMenuItem = PopUpMenuSelect(menuRef, ypos, xpos, popUpItem); short result = LoWord(PopUpMenuItem) - 1; short menuIDResult = HiWord(PopUpMenuItem); IPopupMenu* resultMenu = 0; if (menuIDResult != 0) { MenuRef usedMenuRef = GetMenuHandle(menuIDResult); if (usedMenuRef) { if (GetMenuItemRefCon(usedMenuRef, 0, (URefCon*)&resultMenu) == noErr) { resultMenu->SetChosenItemIdx(result); } } } CFRelease(menuRef); return resultMenu; } else { return 0; }}
开发者ID:Brado231,项目名称:Faderport_XT,代码行数:55,
示例20: GetWindowBoundsvoid BaseApp::setCursorPos(const int x, const int y){ Rect structureBounds; GetWindowBounds(window, kWindowStructureRgn, &structureBounds); CGPoint point; point.x = x + structureBounds.left; point.y = y + structureBounds.bottom - height;// CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, point); CGWarpMouseCursorPosition(point);}
开发者ID:DanielNeander,项目名称:my-3d-engine,代码行数:11,
示例21: GetMacWindowFromNWindowvoid NCarbonWindowManager::StartDragWindow(NWindow* windToDrag, NPoint2D & ptStart){ WindowRef macWindow = GetMacWindowFromNWindow(windToDrag); Point pt = ptStart.AsQDPoint(); Rect rNewRect; DragWindow(macWindow, pt, NULL); GetWindowBounds(macWindow, kWindowContentRgn, &rNewRect); windToDrag->SetPosition(rNewRect.left, rNewRect.top);}
开发者ID:zenmumbler,项目名称:GrayBoxZ,代码行数:11,
示例22: _glfwMacDWSetMouseCursorPosvoid _glfwMacDWSetMouseCursorPos( int x, int y ){ Rect content; GetWindowBounds(_glfwWin.MacWindow, kWindowContentRgn, &content); _glfwInput.MousePosX = x + content.left; _glfwInput.MousePosY = y + content.top; CGDisplayMoveCursorToPoint( kCGDirectMainDisplay, CGPointMake( _glfwInput.MousePosX, _glfwInput.MousePosY ) );}
开发者ID:x-y-z,项目名称:SteerSuite-CUDA,代码行数:12,
示例23: SaveWindowSizevoidSaveWindowSize(WindowPtr win){ short width, height; Rect r; GetWindowBounds(win, kWindowContentRgn, &r); width = r.right - r.left; height = r.bottom - r.top; SaveSize(GetWinKind (win), height, width);}
开发者ID:BarclayII,项目名称:slashem-up,代码行数:12,
示例24: ResizeWindowvoid ResizeWindow(WindowRef pWindow, int w, int h){ Rect gr; // Screen. GetWindowBounds(pWindow, kWindowContentRgn, &gr); gr.right = gr.left + w; gr.bottom = gr.top + h; //SetWindowBounds(pWindow, kWindowContentRgn, &gr); // Is this needed to resize carbon window? // Some tests //InvalWindowRect(pWindow,&gr); //QDFlushPortBuffer(GetWindowPort(pWindow), NULL); //HIWindowFlush(pWindow);}
开发者ID:Youlean,项目名称:WDL-Youlean,代码行数:13,
示例25: UNREFERENCED_PARAMETERvoid ErrorPopUpScreen::Draw(float totalTime, float elapsedTime){ UNREFERENCED_PARAMETER(totalTime); UNREFERENCED_PARAMETER(elapsedTime); auto screenManager = Manager(); auto spriteBatch = screenManager->GetSpriteBatch(); auto spriteFont = screenManager->GetSpriteFont(); auto blendStates = screenManager->GetCommonStates(); auto viewportBounds = screenManager->GetScreenBounds(); float viewportWidth = float(viewportBounds.right); float viewportHeight = float(viewportBounds.bottom); auto scaleMatrix = DX::GetScaleMatrixForWindow(screenManager->GetWindowBounds()); // calculate position and size of error message XMFLOAT2 errorMsgPosition = XMFLOAT2(0, viewportHeight / 2.0f); XMVECTORF32 errorMsgColor = Colors::Yellow; XMFLOAT2 origin = XMFLOAT2(0, spriteFont->GetLineSpacing() / 2.0f); XMVECTOR size = spriteFont->MeasureString(m_errorMessage.c_str()); errorMsgPosition.x = viewportWidth / 2.0f - XMVectorGetX(size) / 2.0f; // create a rectangle representing the screen dimensions of the error message background rectangle long rectangleWidth = long(std::min(std::max(XMVectorGetX(size) + 100.0f, 600.0f), viewportWidth)); long rectangleHeight = long(spriteFont->GetLineSpacing() * 6.0f); long rectangleLeft = long(viewportWidth / 2.0f) - (rectangleWidth / 2); long rectangleTop = long(errorMsgPosition.y + spriteFont->GetLineSpacing()) - (rectangleHeight / 2); RECT backgroundRectangle = { rectangleLeft, rectangleTop, rectangleLeft + rectangleWidth, rectangleTop + rectangleHeight }; spriteBatch->Begin(SpriteSortMode_Deferred, blendStates->NonPremultiplied(), nullptr, nullptr, nullptr, nullptr, scaleMatrix); // draw a background color for the rectangle spriteBatch->Draw(m_backgroundTexture->GetResourceViewTemporary(), backgroundRectangle, BackgroundColor); // draw error message in the middle of the screen spriteFont->DrawString(spriteBatch.get(), m_errorMessage.c_str(), errorMsgPosition, errorMsgColor, 0, origin); // draw continuation prompt winrt::hstring continuePrompt = L"Press (A) to Continue"; if (!InputState::IsAnyGamepadConnected()) { continuePrompt = L"Press Enter to Continue"; } errorMsgPosition.y += spriteFont->GetLineSpacing(); size = spriteFont->MeasureString(continuePrompt.c_str()); errorMsgPosition.x = viewportWidth / 2.0f - XMVectorGetX(size) / 2.0f; spriteFont->DrawString(spriteBatch.get(), continuePrompt.c_str(), errorMsgPosition, Colors::Yellow, 0, origin); spriteBatch->End();}
开发者ID:facybenbook,项目名称:xbox-live-samples,代码行数:49,
示例26: GetWindowBoundsvoid SkOSWindow::updateSize(){ Rect r; GetWindowBounds((WindowRef)fHWND, kWindowContentRgn, &r); this->resize(r.right - r.left, r.bottom - r.top);#if 0 HIRect frame; HIViewRef imageView = (HIViewRef)getHVIEW(); HIViewRef parent = HIViewGetSuperview(imageView); HIViewGetBounds(imageView, &frame); SkDebugf("------ %d bounds %g %g %g %g/n", r.right - r.left, frame.origin.x, frame.origin.y, frame.size.width, frame.size.height);#endif}
开发者ID:AliFarahnak,项目名称:XobotOS,代码行数:17,
示例27: GetWindowBoundsvoid NCarbonWindowManager::HandleMacUpdate(WindowRef aWind){ // get dirty rect Rect r; GetWindowBounds(aWind, kWindowContentRgn, &r); OffsetRect(&r, -r.left, -r.top); NRect rToUpdate(r); // get NWindow NWindow *nWind = NULL; NUInt32 wRef = GetWRefCon(aWind); if(NObject::CheckValidNObject(wRef)) nWind = (NWindow*)wRef; // tell window to redraw afflicted area if(nWind) nWind->UpdateRect(rToUpdate);}
开发者ID:zenmumbler,项目名称:GrayBoxZ,代码行数:18,
示例28: renderspu_SystemGetWindowGeometryvoidrenderspu_SystemGetWindowGeometry(WindowInfo *window, GLint *x, GLint *y, GLint *w, GLint *h){ CRASSERT(window); CRASSERT(window->window); OSStatus status = noErr; Rect r; status = GetWindowBounds(window->window, kWindowStructureRgn, &r); CHECK_CARBON_RC_RETURN_VOID (status, "Render SPU (renderspu_SystemGetWindowGeometry): GetWindowBounds Failed"); *x = (int) r.left; *y = (int) r.top; *w = (int) (r.right - r.left); *h = (int) (r.bottom - r.top);}
开发者ID:gvsurenderreddy,项目名称:virtualbox,代码行数:18,
注:本文中的GetWindowBounds函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetWindowDC函数代码示例 C++ GetWindow函数代码示例 |