How a Window is Displayed

How a Window is Displayed

Displaying an NSWindow object begins with the drawing performed by its view objects, which accumulates in the window’s display buffer or appears immediately on the screen. Windows, like NSView objects, can be displayed unconditionally or merely marked as needing display, using the display andsetViewsNeedDisplay: methods, respectively. A displayIfNeeded message causes the window’s views to display only if they’ve been marked as needing display. Normally, any time a view is marked as needing display, the window makes note of this fact and automatically displays itself shortly thereafter. This automatic display is typically performed on each pass through the event loop, but can be turned off using thesetAutodisplay: method. If you turn off autodisplay for a window, you’re then responsible for displaying it whenever necessary.

A window’s views can be drawn concurrently. You can use the methods allowsConcurrentViewDrawing andsetAllowsConcurrentViewDrawing: to determine and set, respectively, whether or not a window draws its views concurrently. By default, a window’s views are drawn concurrently.

On each pass through the event loop, the application object invokes its updateWindows method, which sends an update message to each window. Subclasses of NSWindow can override this method to examine the state of the application and change their own state or appearance accordingly—enabling or disabling menus, buttons, and other controls based on the object that’s selected, for example.

In addition to displaying itself on the screen, a window can print itself in its entirety, just as a view can. Theprint: method runs the application’s Print panel and causes the window’s frame view to print itself.dataWithEPSInsideRect: behaves similarly. For additional information see Printing Programming Topics for Cocoa.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值