Exemple #1
0
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
    HIRect bounds ;
    HIWindowGetAvailablePositioningBounds(kCGNullDirectDisplay,kHICoordSpace72DPIGlobal,
            &bounds);
    if ( x )
        *x = bounds.origin.x;
    if ( y )
        *y = bounds.origin.y;
    if ( width )
        *width = bounds.size.width;
    if ( height )
        *height = bounds.size.height;
#else
    Rect r;
    GetAvailableWindowPositioningBounds( GetMainDevice() , &r );
    if ( x )
        *x = r.left;
    if ( y )
        *y = r.top;
    if ( width )
        *width = r.right - r.left;
    if ( height )
        *height = r.bottom - r.top;
#endif
}
Exemple #2
0
static void getMacAvailableBounds(short *top, short *left, short *bottom, short *right) 
{
	Rect outAvailableRect;
	
	GetAvailableWindowPositioningBounds ( GetMainDevice(), &outAvailableRect);
	
	*top = outAvailableRect.top;  
    *left = outAvailableRect.left;
    *bottom = outAvailableRect.bottom; 
    *right = outAvailableRect.right;
}
Exemple #3
0
static void window_create(IMAGE *img)
{
    WindowRef windowRef;
    Str255    windowTitle = "\pGhostscript Image";
    Rect      windowRect = {20,4,580,420};//, portRect;
    Rect      scrollbarRect = {0,0,0,0};

#if TARGET_API_MAC_CARBON
    GetAvailableWindowPositioningBounds(GetMainDevice(),&windowRect);
#endif

    /* Create a new suitablty positioned window */
    windowRect.top = windowRect.top * 2 + 2;
    windowRect.bottom -= 10;
    windowRect.left += 4;
    windowRect.right = ((windowRect.bottom - windowRect.top) * 3) / 4 + windowRect.left;

    if(!(windowRef = NewCWindow(NULL, &windowRect, windowTitle, true,
                                zoomDocProc, (WindowRef) -1, false, 0)))
        ExitToShell();

    img->windowRef = windowRef;

    SetWRefCon(img->windowRef, (SInt32)img);

    /* Create the window's scrollbars */
#if TARGET_API_MAC_CARBON
    if(gRunningOnX)
        ChangeWindowAttributes(windowRef,kWindowLiveResizeAttribute,0);

    CreateScrollBarControl(windowRef, &scrollbarRect, 0, 0, 0, 0,
                           true, gActionFunctionScrollUPP, &(img->scrollbarVertRef));

    CreateScrollBarControl(windowRef, &scrollbarRect, 0, 0, 0, 0,
                           true, gActionFunctionScrollUPP, &(img->scrollbarHorizRef));
#else
    img->scrollbarVertRef = NewControl(windowRef,&scrollbarRect,"\p",false,0,0,0,scrollBarProc,0);
    img->scrollbarHorizRef = NewControl(windowRef,&scrollbarRect,"\p",false,0,0,0,scrollBarProc,0);
#endif

    window_adjust_scrollbars(windowRef);
}
int getScreenWidth() {
	int result = 0;
#ifdef VAR_HAS_UI
  #ifdef ANDROID
//		GLint m_viewport[2];
//		glGetIntegerv(GL_MAX_VIEWPORT_DIMS, m_viewport);
//		result = m_viewport[0];
  #else
#ifdef osx
	 Rect outAvailableRect;
	 GetAvailableWindowPositioningBounds ( GetMainDevice(), &outAvailableRect);
	 result = outAvailableRect.right - outAvailableRect.left;
#else
	 Display *display = XOpenDisplay(NULL);
	 result = DisplayWidth(display,0);
	 XCloseDisplay(display);
#endif
#endif
#endif
	return result;
}
Exemple #5
0
void tool_wind_open(void)
{
	int							x,t,rspace,wid;
	Rect						wbox,box;
	ControlButtonContentInfo	icon_info;
	HMHelpContentRec			tag;
	EventTypeSpec				wind_events[]={{kEventClassControl,kEventControlHit}};

    GetAvailableWindowPositioningBounds(GetMainDevice(),&wbox);
	
	SetRect(&box,wbox.left,wbox.top,wbox.right,(wbox.top+28));
	CreateNewWindow(kFloatingWindowClass,kWindowStandardFloatingAttributes|kWindowStandardHandlerAttribute,&box,&toolwind);
	ChangeWindowAttributes(toolwind,kWindowNoConstrainAttribute,kWindowCloseBoxAttribute|kWindowFullZoomAttribute|kWindowCollapseBoxAttribute|kWindowResizableAttribute);
	
	/*
    SetRect(&box,2,2,26,26);
    
	for (t=0;t!=maxtool;t++) {
	
			// create button
			
		icon_info.contentType=kControlContentCIconRes;
		icon_info.u.resID=500+t;
		CreateBevelButtonControl(toolwind,&box,NULL,kControlBevelButtonSmallBevel,kControlBehaviorToggles,&icon_info,0,0,0,&tool_ctrl[t]);
	
			// create tooltip
			
		tag.version=kMacHelpVersion;
		tag.tagSide=kHMDefaultSide;
		SetRect(&tag.absHotRect,0,0,0,0);
		tag.content[kHMMinimumContentIndex].contentType=kHMCFStringContent;
		tag.content[kHMMinimumContentIndex].u.tagCFString=CFStringCreateWithCString(NULL,tool_tooltip_str[t],kCFStringEncodingMacRoman);
		tag.content[kHMMaximumContentIndex].contentType=kHMNoContent;
		
		HMSetControlHelpContent(tool_ctrl[t],&tag);

			// next button position
			
		OffsetRect(&box,24,0);
		if ((t==2) || (t==5) || (t==13) || (t==15) || (t==18)) OffsetRect(&box,5,0);
	}
	
		// remaining space
	
	rspace=wbox.right-(box.left+5);
	
		// group combo
		
	CreateNewMenu(group_combo_menu_id,kMenuAttrExcludesMarkColumn,&group_menu);
	InsertMenu(group_menu,kInsertHierarchicalMenu);
		
	wid=(rspace-5)/2;
	if (wid>200) wid=200;
	
	group_box=box;
	group_box.top++;
	group_box.bottom++;
	group_box.left+=5;
	group_box.right=group_box.left+wid;
	
	CreatePopupButtonControl(toolwind,&group_box,NULL,group_combo_menu_id,FALSE,0,0,0,&group_combo);
	
		// magnify slider

	wid=(rspace-5)/2;
	x=wbox.right-wid;
	
	SetRect(&box,x,5,(x+16),21);
	icon_info.contentType=kControlContentCIconRes;
	icon_info.u.resID=130;
	CreateIconControl(toolwind,&box,&icon_info,TRUE,&magnify_icon);
	
	tag.version=kMacHelpVersion;
	tag.tagSide=kHMDefaultSide;
	SetRect(&tag.absHotRect,0,0,0,0);
	tag.content[kHMMinimumContentIndex].contentType=kHMCFStringContent;
	tag.content[kHMMinimumContentIndex].u.tagCFString=CFStringCreateWithCString(NULL,"Magnify",kCFStringEncodingMacRoman);
	tag.content[kHMMaximumContentIndex].contentType=kHMNoContent;
		
	HMSetControlHelpContent(magnify_icon,&tag);
	
	SetRect(&box,(x+20),5,(x+(wid-6)),25);
	magnify_proc=NewControlActionUPP(tool_wind_magnify_action);
	CreateSliderControl(toolwind,&box,(magnify_factor-1),5,210,kControlSliderDoesNotPoint,0,TRUE,magnify_proc,&magnify_slider);
	*/
		// tool window events
		
	tool_wind_upp=NewEventHandlerUPP(tool_wind_event_callback);
	InstallEventHandler(GetWindowEventTarget(toolwind),tool_wind_upp,GetEventTypeCount(wind_events),wind_events,NULL,&tool_wind_event);

	ShowWindow(toolwind);
}
Exemple #6
0
uint4 MCScreenDC::getdisplays(MCDisplay const *& p_displays, bool p_effective)
{
	if (s_monitor_count == 0)
	{
		bool error = false;
	
		uint4 t_display_count;
		
		t_display_count = 0;
		for(GDHandle t_device = GetDeviceList(); t_device != NULL; t_device = GetNextDevice(t_device))
			if (TestDeviceAttribute(t_device, screenDevice) && TestDeviceAttribute(t_device, screenActive))
				t_display_count += 1;
			
		error = t_display_count == 0;
		
		MCDisplay *t_displays = NULL;
		if (!error)
			error = (t_displays = new MCDisplay[t_display_count]) == NULL;
			
		if (!error)
		{
			uint4 t_current_index = 1;
			for(GDHandle t_device = GetDeviceList(); t_device != NULL; t_device = GetNextDevice(t_device))
				if (TestDeviceAttribute(t_device, screenDevice) && TestDeviceAttribute(t_device, screenActive))
				{
					uint4 t_index;
					
					HLock((Handle)t_device);
					
					if (TestDeviceAttribute(t_device, mainScreen))
						t_index = 0;
					else
						t_index = t_current_index++;
						
					t_displays[t_index] . index = t_index;
						
					t_displays[t_index] . viewport . x = (*t_device) -> gdRect . left;
					t_displays[t_index] . viewport . y = (*t_device) -> gdRect . top;
					t_displays[t_index] . viewport . width = (*t_device) -> gdRect . right - (*t_device) -> gdRect . left;
					t_displays[t_index] . viewport . height = (*t_device) -> gdRect . bottom - (*t_device) -> gdRect . top;
				
					Rect t_workarea;
					GetAvailableWindowPositioningBounds(t_device, &t_workarea);
					t_displays[t_index] . workarea . x = t_workarea . left;
					t_displays[t_index] . workarea . y = t_workarea . top;
					t_displays[t_index] . workarea . width = t_workarea . right - t_workarea . left;
					t_displays[t_index] . workarea . height = t_workarea . bottom - t_workarea . top;
					
					HUnlock((Handle)t_device);
				}
		}
		
		if (error)
			delete[] t_displays;
		else
		{
			s_monitor_count = t_display_count;
			s_monitor_displays = t_displays;
		}
	}
	
	if (s_monitor_count == 0)
	{
		static MCDisplay t_display;
		Rect t_workarea;
		
		MCU_set_rect(t_display . viewport, 0, 0, getwidth(), getheight());
		GetAvailableWindowPositioningBounds(GetMainDevice(), &t_workarea);
		t_display . index = 0;
		t_display . workarea . x = t_workarea . left;
		t_display . workarea . y = t_workarea . top;
		t_display . workarea . width = t_workarea . right - t_workarea . left;
		t_display . workarea . height = t_workarea . bottom - t_workarea . top;
		p_displays = &t_display;
		
		return 1;
	}
	
	p_displays = s_monitor_displays;
	return s_monitor_count;
}