Esempio n. 1
0
void HandleMouseDown(EventRecord *event)
{
	short	part;
	WindowRef	window;
	MacWindow   *macwin;
	Rect		growRect={100,100,32000,32000};
	long		size;
	
	part=FindWindow(event->where, &window);
	macwin = (MacWindow*)GetWRefCon(window);
	
	switch(part)
	{
	case inMenuBar:
		mac_AdjustMenus(event->modifiers);
		mac_HandleMenuSelect(MenuSelect(event->where), event->modifiers);
		HiliteMenu(0);
		break;
	case inContent:
		SetPortWindowPort(window);
		SelectWindow(window);
		GlobalToLocal(&event->where);
		if(macwin) macwin->click(event->where, event->modifiers);
		break;
	case inDrag:
		DragWindow(window, event->where, &qd.screenBits.bounds);
		break;
	case inGrow:
		SetPortWindowPort(window);
		size=GrowWindow(window, event->where, &growRect);
		if( size )
		{
			SizeWindow(window, size&0x0000FFFF, size>>16, 0);
			EraseRect(&GetWindowPort(window)->portRect);
			InvalRect(&GetWindowPort(window)->portRect);
			if( macwin ) macwin->message(MW_GROW, size);
		}
		break;
	case inGoAway:
		if( TrackGoAway(window, event->where) ){
			if( macwin ){
				macwin->goaway(macwin);
			}
		}
		break;
	//case inZoomIn:
	//case inZoomOut:
	//	break;
	}
}
Esempio n. 2
0
bool QuartzWindow::pre_draw(bool incremental) {
  if ( get_graphics_semaphore())  return false;
  if (!_is_open) return false;
  if (_was_closed) {
    TheSpy->deactivate();
    _was_closed = false;
    return false;
  }
  if ( myContext == NULL ) {
    // Self does this for Self windows, so only do it for Spy windows--that's why it's here and not in open
    SetPortWindowPort(my_window());
    QDBeginCGContext( GetWindowPort(my_window()), &myContext);
    setupCTM();
    CGContextSetTextMatrix(myContext, CGAffineTransformMake( 1, 0, 0, -1, 0, 0));
    CGContextSelectFont(myContext, 
      default_fixed_font_name(), default_fixed_font_size(), kCGEncodingMacRoman);
    CGContextSetShouldAntialias(myContext, false);
    
    EventTypeSpec es[] = { 
      {kEventClassWindow, kEventWindowBoundsChanged},
      {kEventClassWindow, kEventWindowClose}
    };
    OSStatus e = AddEventTypesToHandler(_my_spy_event_handler,  sizeof(es) / sizeof(es[0]),  es);
    if (e != noErr) fatal1("could not add types to handler %d\n", e);
  }
  if (_bounds_changed) {
    _bounds_changed = false;
    adjust_after_resize();
  }
  if (!incremental) {
    Rect r;  get_window_region_rect( kWindowContentRgn, &r);
    clear_rectangle(0, 0, r.right - r.left, r.bottom - r.top);
  }
  return true;
}
Esempio n. 3
0
StateLayer::StateLayer(ViewLayer& view)
{
  mappings[&view] = this;
  _view = &view;
  _project = new Project();
  assembly::Assembly& assembly = _project->getAssembly();

  _selectionModel = new SelectionModel();

  _view->constructShots(assembly);
  _view->populateConceptSelectCombo(assembly.getOntology());
  _view->rendererBoundsChanged();

  scenegraph::Shot& shot = view.getRootShot();

  _renderingState = new RenderingState(shot);
  _defaultPerspective = new SearchPerspective();

  _currentPerspective = _defaultPerspective;
  _currentInteractionState = new SelectState(*_renderingState);

  _currentPerspective->activate(*_view);

  WindowRef window = _view->getWindow();
  ActivateWindow(window, true);
  SetPortWindowPort(window);
  ShowWindow(window);
  SelectWindow(window);
  ActivateWindow(window, true);

  _selectedLayer = 0;
  _creationType = 0;
}
Esempio n. 4
0
File: mdi.cpp Progetto: beanhome/dev
void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
{
#if wxOSX_USE_CARBON // TODO REMOVE
    if ( inWindowRef )
    {
//        bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
//        if ( inActivate != isHighlighted )
#ifndef __LP64__
        GrafPtr port ;
        GetPort( &port ) ;
        SetPortWindowPort( inWindowRef ) ;
#endif
        HiliteWindow( inWindowRef , inActivate ) ;
        ControlRef control = NULL ;
        ::GetRootControl( inWindowRef , &control ) ;
        if ( control )
        {
            if ( inActivate )
                ::ActivateControl( control ) ;
            else
                ::DeactivateControl( control ) ;
        }
#ifndef __LP64__
        SetPort( port ) ;
#endif
    }
#elif defined(wxOSX_USE_COCOA)
    wxUnusedVar(inActivate);
    wxUnusedVar(inWindowRef);
// TODO: implement me!
#endif
}
Esempio n. 5
0
void DoVolume()
{
	short		lastAmp=mac_amplitude;
	//SndCommand	theCmd;
	Point		p;
	
	SetPortWindowPort(win.ref);
	GetMouse(&p);
	/*GlobalToLocal(&p);*/
	if( PtInRect(p, &rVol) && FrontWindow()==win.ref )
	{
		
		mac_amplitude=255*((double)rVol.bottom-10-p.v)/(rVol.bottom-rVol.top-20);
		if( mac_amplitude<0 ) mac_amplitude=0;
		if( mac_amplitude>255 ) mac_amplitude=255;
		
		if( lastAmp!=mac_amplitude )
		{
			//theCmd.cmd=ampCmd;
			//theCmd.param1=mac_amplitude;
			//SndDoImmediate(gSndCannel, &theCmd);
			mac_setVolume(mac_amplitude);
			InvalRect(&rVol);
		}
	}
}		
Esempio n. 6
0
/* draw image to frame */
static void icvDrawImage( CvWindow* window )
{
    Assert( window != 0 );
    if( window->imageRef == 0 ) return;
    
    CGContextRef myContext;
    CvTrackbar* t; 
    CGRect rect;
    Rect portrect;
    int width = window->imageWidth;
    int height = window->imageHeight;
    
        GetWindowPortBounds(window->window, &portrect);
    
    if( window->flags & CV_WINDOW_AUTOSIZE ) 
	{ 
        CGPoint origin = {0,0}; 
        CGSize size = {portrect.right-portrect.left, portrect.bottom-portrect.top-window->trackbarheight};
        rect.origin = origin; rect.size = size;
    } 
	else 
	{
        CGPoint origin = {0, portrect.bottom - height - window->trackbarheight};
        CGSize size = {width, height};
        rect.origin = origin; rect.size = size;
    }
    
    /* To be sybnchronous we are using this, better would be to susbcribe to the draw event and process whenever requested, we might save SOME CPU cycles*/
    SetPortWindowPort (window->window);
    QDBeginCGContext (GetWindowPort (window->window), &myContext);
    CGContextSetInterpolationQuality (myContext, kCGInterpolationLow); 
    CGContextDrawImage(myContext,rect,window->imageRef);
    CGContextFlush(myContext);// 4
    QDEndCGContext (GetWindowPort(window->window), &myContext);// 5
}
Esempio n. 7
0
void createWindow()
{
	int		width, height;
	int		left, top;
	Rect	rect;
	Rect	tempRect1;
	BitMap	bitMap;
	
	GetPortBounds(gGWorld, &tempRect1);
	
	width = 58 + (tempRect1.right - tempRect1.left) * 2;
	height = 230 + tempRect1.bottom - tempRect1.top;
	
	
	tempRect1 = GetQDGlobalsScreenBits(&bitMap)->bounds;
	
	left = (((tempRect1.right - tempRect1.left) - width) / 2);
	top = (((tempRect1.bottom - tempRect1.top) - height) / 2) + 20;

	SetRect( &rect, left, top, left + width, top + height );
	gWindow = NewCWindow( 0L, &rect, "\pQuickDraw Special Effects", true, noGrowDocProc,
							(WindowPtr)-1L, true, 0 );
							
	SetPortWindowPort( gWindow );
}
Esempio n. 8
0
void init_ListWin()
{
	short	rowNum= (**gPlaylist).dataBounds.bottom;

	SetPortWindowPort(win.ref);
	LDelRow(0, 0, gPlaylist);
}
Esempio n. 9
0
//	Creates an overlay window which will move with its parent.  This technique is typical for doing things like drawing on top of movies,
//	creating selection rectangles, drawing on top of GL windows, etc.
static	void	CreateOverlayWindow( WindowRef window )
{
	OSStatus					err;
	Rect						windowRect;
	WindowStorage				*windowStorage		= (WindowStorage*) GetWRefCon( window );
    WindowAttributes			overlayAttributes	= kWindowNoShadowAttribute | kWindowIgnoreClicksAttribute | kWindowNoActivatesAttribute | kWindowStandardHandlerAttribute;
	static	EventHandlerUPP		overlayWindowEventHandlerUPP;
	const EventTypeSpec	windowEvents[]	=
	    {
			{ kEventClassWindow, kEventWindowBoundsChanged },
			{ kEventClassWindow, kEventWindowShown },
			{ kEventClassWindow, kEventWindowClose }
		};

    SetPortWindowPort( window );
	GetWindowPortBounds( window, &windowRect );
	LocalToGlobalRect( &windowRect );											//	Window to be size of window it lies on
	err	= CreateNewWindow( kOverlayWindowClass, overlayAttributes, &windowRect, &windowStorage->overlayWindow );	
	if ( err != noErr ) goto Bail;

	SetWindowGroup( windowStorage->overlayWindow, GetWindowGroup(window) );		//	Put them in the same group so that their window layers are consistent

	if ( overlayWindowEventHandlerUPP == NULL ) overlayWindowEventHandlerUPP	= NewEventHandlerUPP( OverlayWindowEventHandlerProc );
	err	= InstallWindowEventHandler( windowStorage->overlayWindow, overlayWindowEventHandlerUPP, GetEventTypeCount(windowEvents), windowEvents, windowStorage, NULL );

	ShowWindow( windowStorage->overlayWindow );
Bail:
	return;
}
Esempio n. 10
0
static void draw_window_contents(
	WindowPtr wp)
{
	GrafPtr old_port;

	GetPort(&old_port);
	SetPortWindowPort(wp);

	/* Any specific updating stuff.... */
	
#ifdef OP_PLATFORM_MAC_CARBON_FLAG
	{
		Rect	windowBounds;
		GetWindowPortBounds(wp, &windowBounds);
		EraseRect(&windowBounds);
	}
	#else
		EraseRect(&wp->portRect);
	#endif
	
	update_log(wp);

	SetPort(old_port);

	return;
}
Esempio n. 11
0
void cPict::draw(){
	RGBColor store_color;
	Rect rect = frame;
	GrafPtr cur_port;
	GetPort(&cur_port);
	SetPortWindowPort(parent->win);
	
	if(!visible){ // Erase it
		InsetRect(&rect, -3, -3);
		tileImage(rect,bg_gworld,bg[parent->bg]);
		return;
	}
	if(picNum < 0) { // Just fill with black
		GetForeColor(&store_color);
		ForeColor(blackColor);
		PaintRect(&rect);
		RGBForeColor(&store_color);
		return;
	}
	GetBackColor(&store_color);
	BackColor(whiteColor);
	
	drawPict()[picType](picNum,rect);
	if(drawFramed) drawFrame(2,0);
	SetPort(cur_port);
}
Esempio n. 12
0
static void mac_ctl_refresh_trc()
{
	int		i;
	Rect	r;
	RGBColor	black={0,0,0},
				darkGray={0x2000,0x2000,0x2000};

	if( !win.show ) return;
	SetPortWindowPort(win.ref);
	for( i=0; i<16; i++ ){
		DrawInstrumentName(i, instr_comment[i].comm);
	}
	
#define MAX_NOTE_NUM 120
	r.top=		UPPER_MERGIN;
	r.left=		LEFT_MERGIN;
	r.bottom=	r.top+CHANNEL_HIGHT*16;
	r.right=	r.left+CHANNEL_WIDTH*MAX_NOTE_NUM;
	RGBForeColor(&darkGray);
	PaintRect(&r);
	
		//draw separater line
	RGBForeColor(&black);
	for(i=1; i<16; i++){	//horizontal
		MoveTo(LEFT_MERGIN, UPPER_MERGIN+CHANNEL_HIGHT*i-1);
		Line(CHANNEL_WIDTH*MAX_NOTE_NUM-1, 0);
	}
	for(i=12; i<MAX_NOTE_NUM; i+=12){	//vertical
		MoveTo(LEFT_MERGIN+CHANNEL_WIDTH*i-1, UPPER_MERGIN);
		Line(0, CHANNEL_HIGHT*16-1);
	}
}
Esempio n. 13
0
// --------------------------------------------------------------------------------------
void CalculateBalloonHelpRects(WindowRef prefsWindow)
{
	GrafPtr savedPort;
	ListHandle iconList;
	Point tips[3];
	Rect hotRects[3], userPaneBounds;
	ControlRef rootControl, userPane;
	
	GetPort(&savedPort);
	SetPortWindowPort(prefsWindow);
	
	GetWindowProperty(prefsWindow, kAppSignature, kIconListTag, sizeof(ListHandle), NULL, 
						&iconList);
	SetPt(&tips[0], kPlatinumWindowEdgeSpacing + kListWidth, kPlatinumWindowEdgeSpacing + 10);
	SetRect(&hotRects[0], (*iconList)->rView.left, (*iconList)->rView.top, 
			(*iconList)->rView.right, (*iconList)->rView.bottom);	// set the icon list tip 
																	// and hot rectangle
	
	SetPt(&tips[1], 203, 219);			// set the static text tip and hot rectangle
	SetRect(&hotRects[1], 149, 213, 213, 229);	// these coordinates are all arbitrary
	
	GetRootControl(prefsWindow, &rootControl);			// the only thing embedded in the 
	GetIndexedSubControl(rootControl, 1, &userPane);	// root control is the user panes and 
	SetRect(&userPaneBounds, (*userPane)->contrlRect.left, (*userPane)->contrlRect.top, 
			(*userPane)->contrlRect.right, (*userPane)->contrlRect.bottom);		// they're 
																		// all the same size
	SetPt(&tips[2], userPaneBounds.right - 10, userPaneBounds.top + 10);
	SetRect(&hotRects[2], userPaneBounds.left, userPaneBounds.top, userPaneBounds.right, 
			userPaneBounds.bottom);		// set the user pane tip and hot rectangle
	
	SetWindowProperty(prefsWindow, kAppSignature, kBalloonTipsTag, 3 * sizeof(Point), tips);
	SetWindowProperty(prefsWindow, kAppSignature, kHotRectsTag, 3 * sizeof(Rect), hotRects);
	
	SetPort(savedPort);
}
Esempio n. 14
0
void createWindow()
{
	Rect 	wBounds;
	BitMap	bitMap;
	Rect 	tempRect1;
	int		top, left, width, height;
	
	GetQDGlobalsScreenBits(&bitMap);
	
	width = ((bitMap.bounds.right - bitMap.bounds.left) / 2);
	height = ((bitMap.bounds.bottom - bitMap.bounds.top) / 2);

	left = (((bitMap.bounds.right - bitMap.bounds.left) - width) / 2);
	top = (((bitMap.bounds.bottom - bitMap.bounds.top) - height) / 2);
	
	/* Create a window to display the final offscreen image. */
	
	//SetRect( &wBounds, WLEFT, WTOP, WLEFT + WWIDTH, WTOP + WHEIGHT );
	SetRect( &wBounds, left, top, left + width, top + height );
	
	gWindow = NewCWindow( 0L, &wBounds, "\pSnapshot Test", false, documentProc,
							(WindowPtr)-1L, true, 0L );
							
	//SetRect( &gBounds, 0, 0, gWindow->portRect.right - gWindow->portRect.left,
	//				gWindow->portRect.bottom - gWindow->portRect.top );
	GetPortBounds(GetWindowPort(gWindow), &tempRect1);
	SetRect( &gBounds, 0, 0, tempRect1.right - tempRect1.left, 
	 tempRect1.bottom - tempRect1.top);
							
	//SetPort( gWindow );
	SetPortWindowPort( gWindow );
}
Esempio n. 15
0
int main()
{
	
	Rect bounds = {44,12,330,500}/*,zoomFrom,zoomTo*/;
	//Rect	tempRect1;	//used for carbonization
		
	InitStuff();
	gWindow = NewWindow(nil,&bounds,"\pDrag Two Rects to Zoom",true,documentProc,(WindowPtr)-1L,true,0);
	//SetPort(window);
	SetPortWindowPort(gWindow);
	
	/*do {
		if (GetRects(&zoomFrom,&zoomTo))
			ZoomRect(kZoomLarger,&zoomFrom,&zoomTo);
		//EraseRect(&window->portRect);
		EraseRect(GetPortBounds(GetWindowPort(window), &tempRect1));
	}
	while (!gDone);*/
	
	doEventLoop();
	
	FlushEvents(everyEvent,0);
        
        return 0;
}
Esempio n. 16
0
// --------------------------------------------------------------------------------------
void HandleContentClick(WindowRef window, Point mouseLocation, EventModifiers modifiers)
{
    ListHandle iconList;
    Rect iconListRect;
    Boolean isDoubleClick;
    Cell theCell;

    GetWindowProperty(window, kAppSignature, kIconListTag, sizeof(ListHandle), NULL,
                      &iconList);

    GetListViewBounds(iconList, &iconListRect);

    iconListRect.right += kScrollBarWidth;

    SetPortWindowPort(window);
    GlobalToLocal(&mouseLocation);

    if (PtInRect(mouseLocation, &iconListRect))
    {
        SInt16 pixelDepth;
        Boolean isColorDevice;

        GetWindowDeviceDepthAndColor(window, &pixelDepth, &isColorDevice);
        SetThemeBackground(kThemeBrushWhite, pixelDepth, isColorDevice);
        // if LClick causes the list selection to change, or the
        isDoubleClick = LClick(mouseLocation, modifiers, iconList);		// scroll bar
        SetPt(&theCell, 0, 0);					// to change, the affected cells are
        LGetSelect(true, &theCell, iconList);	// immediately drawn (no update event)

        if ((theCell.v + 1) != gPanelNumber)
            changePanel(window, theCell.v + 1);
    }
}
void doEventLoop()
{
	EventRecord event;
	WindowPtr   window;
	short       clickArea;
	Rect        screenRect;
	RgnHandle	rgnHandle = NewRgn();

	for (;;)
	{
		if (WaitNextEvent( everyEvent, &event, 0, nil ))
		{
			if (event.what == mouseDown)
			{
				clickArea = FindWindow( event.where, &window );
				
				if (clickArea == inDrag)
				{
					//screenRect = (**GetGrayRgn ()).rgnBBox;
					GetRegionBounds(GetGrayRgn(), &screenRect);
					DragWindow( window, event.where, &screenRect );
				}
				else if (clickArea == inContent)
				{
					if (window != FrontWindow())
						SelectWindow( window );
				}
				else if (clickArea == inGoAway)
					if (TrackGoAway( window, event.where ))
						return;
			}
			else if (event.what == updateEvt)
			{
				window = (WindowPtr)event.message;	
				//SetPort( window );
				SetPortWindowPort( window );
				
				BeginUpdate( window );
				drawPixelImageData();
				EndUpdate( window );
				QDFlushPortBuffer(GetWindowPort(window), GetPortVisibleRegion(GetWindowPort(window), rgnHandle));
			}
			else if (event.what == activateEvt) 
			{
				/*if (event.modifiers & activeFlag) {
					window = (WindowPtr)event.message;
					SetPortWindowPort(window);
					drawPixelImageData();
					QDFlushPortBuffer(GetWindowPort(window), GetPortVisibleRegion(GetWindowPort(window), rgnHandle));
				}*/
				/*if (event.modifiers & activeFlag)
					PostEvent(updateEvt, (unsigned long)gWindow);*/
			}
		}
	}
	
	DisposeRgn(rgnHandle);
}
Esempio n. 18
0
void doEventLoop()
{
	EventRecord anEvent;
	WindowPtr   evtWind;
	short       clickArea;
	Rect        screenRect;
	Point		thePoint;
	Rect		zoomFrom, zoomTo;
	
	zoomFrom.top = zoomTo.top = -1;

	while (!gDone)
	{
		if (WaitNextEvent( everyEvent, &anEvent, 0, nil ))
		{
			if (anEvent.what == mouseDown)
			{
				clickArea = FindWindow( anEvent.where, &evtWind );
				
				if (clickArea == inDrag)
				{
					GetRegionBounds( GetGrayRgn(), &screenRect );
					DragWindow( evtWind, anEvent.where, &screenRect );
				}
				else if (clickArea == inContent)
				{
					if (evtWind != FrontWindow())
						SelectWindow( evtWind );
					else
					{
						thePoint = anEvent.where;
						GlobalToLocal( &thePoint );
						//Handle click in window content here
						GetRect(&zoomFrom, &zoomTo);
					}
				}
				else if (clickArea == inGoAway)
					if (TrackGoAway( evtWind, anEvent.where ))
						gDone = true;
			}
			else if (anEvent.what == updateEvt)
			{
				evtWind = (WindowPtr)anEvent.message;	
				SetPortWindowPort( evtWind );
				
				BeginUpdate( evtWind );
				//Call Draw Function here....
				if (zoomFrom.top != -1)
					FrameRect(&zoomFrom);
				if (zoomTo.top != -1)
					FrameRect(&zoomTo);
				EndUpdate (evtWind);
			}
		}
	}
}
Esempio n. 19
0
void x_push_done()      {

  CGrafPtr window_port;

  SetPortWindowPort(g_main_window);
  window_port = GetWindowPort(g_main_window);

  QDFlushPortBuffer(window_port, 0);

}
Esempio n. 20
0
void DrawButton()
{
	SetPortWindowPort(win.ref);
	PlotCIcon(&rPlay, skin_state==PLAYING || skin_state==PAUSE? iconPlay:button[0] );
	PlotCIcon(&rStop, button[1]);
	PlotCIcon(&rPause, skin_state==PAUSE? iconPause:button[2] );
	PlotCIcon(&rPrevious, button[3]);
	PlotCIcon(&rForward, button[4]);
	PlotCIcon(&rEject, button[5]);
}
Esempio n. 21
0
static Rboolean Quartz_Locator(double *x, double *y, NewDevDesc *dd)
{
    EventRecord event;
    SInt16 key;
    Boolean gotEvent;
    Boolean mouseClick = false;
    Point myPoint;
    WindowPtr window;
    SInt16 partCode;
    GrafPtr savePort;
    Cursor		arrow ;
    QuartzDesc *xd = (QuartzDesc*)dd->deviceSpecific;
	int useBeep = asLogical(GetOption(install("locatorBell"), 
						      R_NilValue));
	
    GetPort(&savePort);

    SetPortWindowPort(xd->window);
    SetThemeCursor(kThemeCrossCursor);

    while(!mouseClick) {
	
    
	gotEvent = WaitNextEvent( everyEvent, &event, 0, nil);

    CGContextFlush( GetContext(xd) );
   
	if (event.what == mouseDown) {
	    partCode = FindWindow(event.where, &window);
	    if ((window == (xd->window)) && (partCode == inContent)) {
			myPoint = event.where;
			GlobalToLocal(&myPoint);
			*x = (double)(myPoint.h);
			*y = (double)(myPoint.v);
			if(useBeep)
			 SysBeep(1);
			mouseClick = true;
	    }
	}

	if (event.what == keyDown) {
	    key = (event.message & charCodeMask);
	    if (key == 0x1b){ /* exits when the esc key is pressed */
			SetPort(savePort);
			SetThemeCursor(kThemeIBeamCursor);
			return FALSE;
	    }
	}
    }

    SetPort(savePort);
	SetThemeCursor(kThemeIBeamCursor);
    return TRUE;
}
Esempio n. 22
0
void mac_trc_update_voices()
{
	char	buf[20];
	static	int	prev=-1;

	if( !mac_TraceWindow.show ) return;
	SetPortWindowPort(win.ref);
	
	snprintf(buf, 20, "Voice %3d/%3d   ", current_voices, voices);
	RGBForeColor(&black);
	MoveTo(450,24); DrawText(buf, 0, strlen(buf));
}
Esempio n. 23
0
static void update_title()
{
	char	buf[256]="";

	if( !mac_TraceWindow.show ) return;
	SetPortWindowPort(win.ref);
	if( mac_n_files>0 && nPlaying<=mac_n_files && fileList[nPlaying].mfn &&
										fileList[nPlaying].mfn->title )
		snprintf(buf, 256, "Title: %s", fileList[nPlaying].mfn->title);
	RGBForeColor(&black);
	MoveTo(2,24); DrawText(buf, 0, strlen(buf));
}
Esempio n. 24
0
// implementation of windows
void NCarbonWindowManager::DrawWindowContentRect(const NWindow* window, NSurface *srcSurface, const NRect & rDrawArea) const
{
	WindowRef macWindow = GetMacWindowFromNWindow(window);
	GrafPtr oldPort;

	GetPort(&oldPort);
	SetPortWindowPort(macWindow);

	srcSurface->Draw(GetWindowPort(macWindow), rDrawArea);
	
	SetPort(oldPort);
}
Esempio n. 25
0
/*** MAKE LOCAL ***/
void MakeLocal( WindowRef window, Point globalPoint, Point *localPoint )
{
	GrafPtr oldPort;
	GetPort( &oldPort );
	SetPortWindowPort( window );
	
	localPoint->h = globalPoint.h;
	localPoint->v = globalPoint.v;
	GlobalToLocal( localPoint );

	SetPort( oldPort );
}
Esempio n. 26
0
/*** MAKE GLOBAL ***/
void MakeGlobal( WindowRef window, Point localPoint, Point *globalPoint )
{
	GrafPtr oldPort;
	GetPort( &oldPort );
	SetPortWindowPort( window );
	
	globalPoint->h = localPoint.h;
	globalPoint->v = localPoint.v;
	LocalToGlobal( globalPoint );

	SetPort( oldPort );
}
Esempio n. 27
0
/*============================================
	SUMiscUtils::GetWindowGlobalBounds
==============================================*/
void SUMiscUtils::GetWindowGlobalBounds( WindowPtr inWindow, Rect &oRect )
{
	StSaveGWorld	aSaver;
	
	SetPortWindowPort( inWindow );
#if PP_Target_Carbon
	::GetWindowPortBounds(inWindow, &oRect);
#else
	oRect = inWindow->portRect;
#endif
	::LocalToGlobal( (Point*) &oRect );
	::LocalToGlobal( 1 + (Point*) &oRect );
}
Esempio n. 28
0
void mac_trc_update_all_info()
{
	Rect r;
	
	SetPortWindowPort(win.ref);
	SetRect(&r, 0,0, win.ref->portRect.right,UPPER_MERGIN);
	EraseRect(&r);
	
	mac_trc_update_voices();
	update_filename();
	update_title();
	mac_trc_update_time(-1,-1);
}
Esempio n. 29
0
nsresult
nsNativeBrowserWindow::InitNativeWindow()
{
    // this is where we get a chance to set up the window refCon
    NS_PRECONDITION(nsnull != mWindow, "Null window in InitNativeWindow");
    
    WindowPtr       wind = (WindowPtr)mWindow->GetNativeData(NS_NATIVE_DISPLAY);
    if (!wind) return NS_ERROR_NULL_POINTER;

    SetPortWindowPort(wind);
    ::SetWRefCon(wind, (long)this);
    return NS_OK;
}
Esempio n. 30
0
ALIST_API ControlPartCode ALSetFocus(ControlPartCode focusPart, ALHandle hAL)
{	ControlPartCode	result;
	Boolean			oldFocus;
	CGrafPtr			savePort;
	WindowPtr		winRef;

	if (hAL == nil || *hAL == nil)
		return kControlFocusNoPart;

	// Keep track of the old state of things.
	oldFocus = (BTST((*hAL)->flags, alFFocused) != 0);

	switch (focusPart) {
	case kControlFocusNoPart:		// Turn off all focusing.
		BCLR((*hAL)->flags, alFFocused);
		result = kControlFocusNoPart;
		break;
	case kControlFocusNextPart:		// Switch the state from off/on to on/off.
	case kControlFocusPrevPart:
		if (BTST((*hAL)->flags, alFFocused)) {
			// Turn off the focus.
			BCLR((*hAL)->flags, alFFocused);
			result = kControlFocusNoPart;
		} else {
			// Turn on the focus.
			BSET((*hAL)->flags, alFFocused);
			result = kControlListBoxPart;
		}
		break;
	case kControlListBoxPart:			// Turn on focusing.
		BSET((*hAL)->flags, alFFocused);
		result = kControlListBoxPart;
		break;
	default:	// simply return the state of focus
			result = (BTST((*hAL)->flags, alFFocused)) ? kControlListBoxPart : kControlFocusNoPart;
			break;
	}

	// If the focus changed, redraw if the alFDrawFocus feature is turned on.
	if ( BTST((*hAL)->features, alFDrawFocus) && oldFocus != (BTST((*hAL)->flags, alFFocused) != 0)) {
	  GDHandle        saveDevice;
	  
	  GetGWorld(&savePort, &saveDevice);
	  ALGetInfo(alWindow, &winRef, hAL);
	  SetPortWindowPort(winRef);
	  _ALDrawListBorder(hAL);
	  SetGWorld(savePort, saveDevice);
	}

	return result;
} // ALSetFocus