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


C++ GetWindowBounds函数代码示例

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


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


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