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

C++ GetWindowBounds函数代码示例

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

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



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


示例2: setWindowTrackingRgn

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


示例3: 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


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


示例5: GetWindowBounds

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


示例6: exitEventHandler

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


示例7: cameraInitialize

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


示例8: s86proc

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


示例9: getWindowContentRegion

RgnHandle getWindowContentRegion(WindowRef window,RgnHandle contentRegion)
{
  Rect portBounds;
  GetWindowBounds(window, kWindowGlobalPortRgn, &portBounds);
  RectRgn(contentRegion, &portBounds);
  return contentRegion;
}
开发者ID:Bjoernke,项目名称:livecode,代码行数:7,代码来源:qtvideograbber.cpp


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


示例11: GetWindowBounds

void SkOSWindow::updateSize()
{
	Rect	r;
	
	GetWindowBounds((WindowRef)fHWND, kWindowContentRgn, &r);
	this->resize(r.right - r.left, r.bottom - r.top);
}
开发者ID:04005003,项目名称:platform_development,代码行数:7,代码来源:SkOSWindow_Mac.cpp


示例12: ResizeWindow

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


示例13: getmaincenter

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


示例14: _glfwPlatformGetWindowGeom

// Function added by ZBS 19 Apr 2004; brought to GLFW2.7.2 by TFB
void _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,代码来源:carbon_window.c


示例15: SaveWindowPos

void
SaveWindowPos(WindowPtr win)
{
	Rect r;


	GetWindowBounds(win, kWindowContentRgn, &r);
	SavePosition(GetWinKind(win), r.top, r.left);
}
开发者ID:BarclayII,项目名称:slashem-up,代码行数:9,代码来源:maccurs.c


示例16: SaveWindowPosition

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


示例17: palette_scenery_close

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


示例18: GetWindowBounds

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


示例19: HIViewGetFrame

IPopupMenu* 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,代码来源:IGraphicsCarbon.cpp


示例20: GetWindowBounds

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GetWindowDC函数代码示例发布时间:2022-05-30
下一篇:
C++ GetWindow函数代码示例发布时间: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