main
function to create and run the application.
Declared in: AppKit/NSApplication.h
Synopsis:
int NSApplicationMain(
int argc, const char *argv[])
Description:
The NSApplicationMain
function creates the application, loads the main nib file from the
application's main bundle, and runs the application. You typically only call this function once,
from your application's main
function, which is usually generated automatically.
Declared in: AppKit/NSGraphics.h
Synopsis:
const NSWindowDepth *NSAvailableWindowDepths(
void)
Description:
NSAvailableWindowDepths
returns a null-terminated array of NSWindowDepth values that
specify which window depths are currently available. Window depth values are defined by the
constants NSTwoBitGrayDepth, NSEightBitGrayDepth, and so on.
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSBeep(
void)
Description: This function plays the system beep. Users can select a sound to be played as the system beep. On a Macintosh, for example, you can change sounds with the Sound control panel.
Declared in: AppKit/NSGraphics.h
Synopsis:
NSWindowDepth NSBestDepth(
NSString *colorSpace, int bps, int bpp, BOOL planar, BOOL *exactMatch)
Description:
NSBestDepth
returns a window depth deep enough for the given number of colors in colorSpace,
bits per sample specified by bps, bits per pixel specified by bpp, and whether planar as specified
by planar. Upon return, the variable pointed to by exactMatch is YES if the window depth can
accommodate all of the values specified by the parameters, NO if it can't.
Declared in: AppKit/NSGraphics.h
Synopsis:
int NSBitsPerPixelFromDepth(
NSWindowDepth depth)
Description:
NSBitsPerPixelFromDepth
returns the number of bits per pixel for the window depth specified
by depth.
See also:
NSBitsPerSampleFromDepth
Declared in: AppKit/NSGraphics.h
Synopsis:
int NSBitsPerSampleFromDepth(
NSWindowDepth depth)
Description:
NSBitsPerSampleFromDepth
returns the number of bits per sample (bits per pixel in each color
component) for the window depth specified by depth.
See also:
NSBitsPerPixelFromDepth
Declared in: AppKit/NSGraphics.h
Synopsis:
NSString *NSColorSpaceFromDepth
(
NSWindowDepth depth)
Description: Returns the color space name for the specified depth. For example, the returned color space name can be NSCalibratedRGBColorSpace, NSDeviceCMYKColorSpace, or so on.
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSConvertGlobalToWindowNumber
(
int
globalNum,
unsigned
int *
winNum)
Description: In rare cases, two or more applications may need to refer to the same window. To pass a window number to another application, an application uses the global window number, which has been automatically assigned by the Window Server, rather than the local window number, which is assigned by the application.
An application uses the NSConvertGlobalToWindowNumber
function to convert a window number from global to local. Given a global window number in globalNum, it returns the corresponding local window number in the location specified by winNum.
See also:
NSConvertWindowNumberToGlobal
Declared in: AppKit/NSFont.h
Synopsis:
int NSConvertGlyphsToPackedGlyphs
(NSGlyph *glBuf, int count,
NSMultibyteGlyphPacking packing, char *packedGlyphs)
Description: This function takes a buffer of glyphs, specified in the glBuf parameter, and packs them into a condensed character array. The character array is returned in the packedGlyphs parameter, which should have enough space for at least ((4 * count) + 1) bytes to guarantee that the packed glyphs fit. The count parameter specifies the number of glyphs in glBuf. The packing parameter specifies how the glyphs are currently packed.
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSConvertWindowNumberToGlobal
(
int winNum, unsigned int *globalNum)
Description: In rare cases, two or more applications may need to refer to the same window. To pass a window number to another application, an application uses the global window number, which has been automatically assigned by the Window Server, rather than the local window number, which is assigned by the application.
NSConvertWindowNumberToGlobal
takes the local window number and places the corresponding global window number in the variable specified by globalNum. This global number can then be passed to other applications that need access to the window.
See also:
NSConvertGlobalToWindowNumber
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSCopyBitmapFromGState(
int
srcGState,
NSRect
srcRect,
NSRect
destRect)
Description: This function copies the pixels in the rectangle srcRect to the rectangle destRect. The source rectangle is defined in the graphics state designated by srcGState. The destination is defined in the current graphics state.
See also:
NSCopyBits
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSCopyBits(
int
srcGState,
NSRect
srcRect,
NSPoint
destPoint)
Description: This function copies the pixels in the rectangle specified by srcRect to the location specified by destPoint. The source rectangle is defined in the graphics state designated by srcGState. If srcGState is NSNullObject, the current graphics state is assumed. The destPoint destination is defined in the current graphics state.
See also:
NSCopyBitmapFromGState
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSCountWindows(
int *count)
Description:
NSCountWindows
counts the number of on-screen windows belonging to the application; it
returns the number by reference in the count parameter.
See also:
NSWindowList
Declared in: AppKit/NSPasteboard.h
Synopsis:
NSString
*NSCreateFileContentsPboardType(
NSString *fileType)
Description:
NSCreateFileContentsPboardType
returns an NSString to a pasteboard type representing a
file's contents based on the supplied string fileType. fileType should generally be the extension part
of a file name. The conversion from a named file type to a pasteboard type is simple; no mapping
to standard pasteboard types is attempted.
See also:
NSCreateFilenamePboardType
, NSGetFileType
, NSGetFileTypes
Declared in: AppKit/NSPasteboard.h
Synopsis:
NSString
*NSCreateFilenamePboardType(
NSString *fileType)
Description:
NSCreateFilenamePboardType
returns an NSString to a pasteboard type representing a file
name based on the supplied string fileType.
See also:
NSCreateFileContentsPboardType
, NSGetFileType
, NSGetFileTypes
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSDottedFrameRect
(NSRect aRect)
Description: << Description forthcoming >>
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSDrawBitmap(
const NSRect rect, int pixelsWide, int pixelsHigh, int bitsPerSample, int samplesPerPixel, int bitsPerPixel, int bytesPerRow, BOOL isPlanar, BOOL hasAlpha, NSColorSpace colorSpace, const unsigned char *const data[5])
Description:
The NSDrawBitmap
function renders an image from a bitmap, binary data that describes the
pixel values for the image (this function replaces NSImageBitmap
).
NSDrawBitmap
renders a bitmap image using an appropriate PostScript operator-image
, colorimage
, or alphaimage
. It puts the image in the rectangular area specified by its first argument, rect; the rectangle is specified in the current coordinate system and is located in the current window. The next two arguments, pixelsWide and pixelsHigh, give the width and height of the image in pixels. If either of these dimensions is larger or smaller than the corresponding dimension of the destination rectangle, the image will be scaled to fit.
The remaining arguments to NSDrawBitmap
describe the bitmap data, as explained in the following paragraphs.
bitsPerSample is the number of bits per sample for each pixel and samplesPerPixel is the number of samples per pixel. bitsPerPixel is based on samplesPerPixel and the configuration of the bitmap: if the configuration is planar, then the value of bitsPerPixel should equal the value of bitsPerSample; if the configuration isn't planar (is meshed instead), bitsPerPixel should equal bitsPerSample * samplesPerPixel.
bytesPerRow is calculated in one of two ways, depending on the configuration of the image data (data configuration is described below). If the data is planar, bytesPerRow is (7 + (pixelsWide * bitsPerSample)) / 8. If the data is meshed, bytesPerRow is (7 + (pixelsWide * bitsPerSample * samplesPerPixel)) / 8.
A sample is data that describes one component of a pixel. In an RGB color system, the red, green, and blue components of a color are specified as separate samples, as are the cyan, magenta, yellow, and black components in a CMYK system. Color values in a gray scale are a single sample. Alpha values that determine transparency and opaqueness are specified as a coverage sample separate from color. In bitmap images with alpha, the color (or gray) components have to be premultiplied with the alpha. This is the way images with alpha are displayed, this is the way they are read back, and this is the way they are stored in TIFFs.
isPlanar refers to the way data is configured in the bitmap. This flag should be set YES if a separate data channel is used for each sample. The function provides for up to five channels, data1, data2, data3, data4, and data5. It should be set NO if sample values are interwoven in a single channel (meshed); all values for one pixel are specified before values for the next pixel.
Figure 1 illustrates these two ways of configuring data.
Figure 1 . Planar and Meshed Configurations
As shown in the illustration, color samples (rgb) precede the coverage sample (alpha) in both configurations.
Gray-scale windows store pixel data in planar configuration; color windows store it in meshed configuration. NSDrawBitmap
can render meshed data in a planar window, or planar data in a meshed window. However, it's more efficient if the image has a depth (bitsPerSample) and configuration (isPlanar) that matches the window.
hasAlpha indicates whether the image contains alpha. If it does, the number of samples should be 1 greater than the number of color components in the model (e.g., 4 for RGB).
colorSpace can be NS_CustomColorSpace, indicating that the image data is to be interpreted according to the current color space in the PostScript graphics state. This allows for imaging using custom color spaces. The image parameters supplied as the other arguments should match what the color space is expecting.
If the image data is planar, data[0] through data[samplesPerPixel-1] point to the planes; if the data is meshed, only data[0] needs to be set.
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSDrawButton(
const NSRect aRect, const NSRect clipRect)
void NSDrawGrayBezel(
const NSRect aRect, const NSRect clipRect)
void NSDrawGroove(
const NSRect aRect, const NSRect clipRect)
void NSDrawWhiteBezel(
const NSRect aRect, const NSRect clipRect)
NSRect NSDrawTiledRects(
NSRect aRect, const NSRect clipRect, const NSRectEdge *sides,
const float *grays, int count)
void NSFrameRect(
const NSRect aRect)
void NSFrameRectWithWidth(
const NSRect aRect, NSCoord frameWidth)
Description:
These functions draw rectangles with borders. NSDrawButton
draws the rectangle used to signify
a user-interface button, NSDrawTiledRects
is a generic function that can be used to draw
different types of borders, and the other functions provide ready-made bezeled, grooved, or line
borders. These borders can be used to outline an area or to give rectangles the effect of being
recessed from or elevated above the surface of the screen, as shown in Figure 2.
Figure 2 . Rectangle Borders
Each function's first argument specifies the rectangle within which the border is to be drawn in the current coordinate system. Since these functions are often used to draw the border of a View, this rectangle will typically be that View's bounds rectangle. Some of the functions also take a clipping rectangle; only those parts of aRect that lie within the clipping rectangle will be drawn.
As its name suggests, NSDrawWhiteBezel
fills in its rectangle with white; NSDrawButton
, NSDrawGrayBezel
, and NSDrawGroove
use
light gray. These functions are designed for rectangles that are defined in unscaled, unrotated coordinate systems (that is, where the y-axis is vertical, the x-axis is horizontal, and a unit along either axis is equal to one screen pixel). The coordinate system can be either flipped or unflipped. The sides of the rectangle should lie on pixel boundaries.
NSFrameRect
and NSFrameRectWithWidth
draw a frame around the inside of a rectangle in the current color. NSFrameRect
draws a frame with a width equal to 1.0 in the current coordinate system; NSFrameRectWithWidth
allows you to set the width of the frame. Since the frame is drawn inside the rectangle, it will be visible even if drawing is clipped to the rectangle (as it would be if the rectangle were a View object). These functions work best if the sides of the rectangle lie on pixel boundaries.
In addition to its aRect and clipRect arguments, NSDrawTiledRects
takes three more arguments, which determine how thick the border is and what gray levels are used to form it. NSDrawTiledRects
works through the Foundation framework's NSDivideRect
function to take successive 1.0-unit-wide slices from the sides of the rectangle specified by the sides argument. Each slice is then drawn using the corresponding gray level from grays. NSDrawTiledRects
makes and draws these slices count number of times. NSDivideRect
returns a pointer to the rectangle after the slice has been removed; therefore, if a side is used more than once, the second slice is made inside the first. This also makes it easy to fill in the rectangle inside of the border.
In the following example, NSDrawTiledRects
draws a bezeled border consisting of a 1.0-unit-wide white line at the top and on the left side, and a 1.0-unit-wide dark-gray line inside a 1.0-unit-wide black line on the other two sides. The rectangle inside this border is filled in using light gray.
int mySides[] = {NX_YMIN, NX_XMAX, NX_YMAX, NX_XMIN,
_YMIN, NX_XMAX};
float myGrays[] = {NS_BLACK, NS_BLACK, NS_WHITE, NS_WHITE,
NS_DARKGRAY, NS_DARKGRAY};
NSRect*aRect;
NSDrawTiledRects(aRect, (NSRect *)0, mySides, myGrays, 6);
PSsetgray(NS_LIGHTGRAY);
PSrectfill(aRect->origin.x, aRect->origin.y,
aRect->size.width, aRect->size.height);
As shown, mySides
is an array that specifies sides of a rectangle; for example, NX_YMIN selects the side parallel to the x-axis with the smallest y-coordinate value. myGrays
is an array that specifies the successive gray levels to be used in drawing parts of the border.
NSDrawTiledRects
returns a pointer to the rectangle that lies within the border.
Declared in: AppKit/NSGraphics.h
Synopsis:
NSRect NSDrawColorTiledRects
(NSRect boundsRect, NSRect clipRect, const NSRectEdge *sides, NSColor **colors, int count)
Description: << Description forthcoming >>
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSDrawDarkBezel
(NSRect aRect, NSRect clipRect)
Description: << Description forthcoming >>
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSDrawLightBezel
(NSRect aRect, NSRect clipRect)
Description: << Description forthcoming >>
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSEraseRect(
const NSRect aRect)
Description:
As its name suggests, NSEraseRect
erases the rectangle referred to by its argument, filling it with
white. It does not alter the current color.
See also:
NSHighlightRect, NSRectClip
, NSRectClipList
, NSRectFill
, NSRectFillList
,
NSRectFillListWithColors
, NSRectFillListWithGrays
, NSUnionRect (Foundation Kit)
Declared in: AppKit/NSGraphics.h
Synopsis:
unsigned int NSEventMaskFromType(
NSEventType type)
Description:
NSEventMaskFromType
returns the event mask corresponding to the specified type (an
enumerated constant). The returned mask is equal to 1 left-shifted by type bits.
Declared in: AppKit/NSDataLinkManager.h
Synopsis:
void NSFrameLinkRect(
NSRect aRect, BOOL isDestination)
Description:
NSFrameLinkRect
draws a distinctive link outline just outside the rectangle specified by aRect.
To draw an outline around a destination link, isDestination should be YES, otherwise it should be
NO.
See also:
NSLinkFrameThickness
Declared in: AppKit/NSPanel.h
Synopsis:
id NSGetAlertPanel(
NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ...)
Description:
NSGetAlertPanel
returns an NSAlert panel that can be used to set up a modal session. A modal
session is useful for allowing the user to interrupt the program. During a modal session, you can
perform activities while the panel is displayed and check at various points in your program
whether the user has clicked one of the panel's buttons. The arguments for this function are the
same as those for the NSRunAlertPanel
function, but unlike that function, no button is displayed
if defaultButton is nil
.
To set up a modal session, send the Application object a beginModalSession:for:
message with the panel returned by NSGetAlertPanel
as its second argument. When you want to check if the user has clicked one of the panel's buttons, use runModalSession:
. To end the modal session, use endModalSession:
. When you're finished with the panel created by NSGetAlertPanel
, you must free it by passing it to NSReleaseAlertPanel
.
See also:
NSGetCriticalAlertPanel
, NSGetInformationalAlertPanel
, NSReleaseAlertPanel
,
NSRunAlertPanel
, NSRunCriticalAlertPanel
, NSRunInformationalAlertPanel
Declared in: AppKit/NSPanel.h
Synopsis:
id NSGetCriticalAlertPanel(
NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ...)
Description:
NSGetCriticalAlertPanel
returns an NSAlert panel that can be used to set up a modal session.
Unlike the NSRunCriticalAlertPanel
function, no button is displayed if defaultButton is nil
.
When you're finished with the panel created by NSGetCriticalAlertPanel
, you must free it by
passing it to NSReleaseAlertPanel
.
The arguments for this function are the same as those for the NSRunAlertPanel
function. For more information on using a panel in a modal session, see NSGetAlertPanel
.
See also:
NSGetAlertPanel
, NSGetInformationalAlertPanel
, NSReleaseAlertPanel
,
NSRunAlertPanel
, NSRunCriticalAlertPanel
, NSRunInformationalAlertPanel
Declared in: AppKit/NSPasteboard.h
Synopsis:
NSString *NSGetFileType(
NSArray *
pboardType)
Description:
NSGetFileType
is the inverse of both NSCreateFileContentsPboardType
and
NSCreateFilenamePboardType
. When passed a pasteboard type as returned by those functions,
it returns the extension or file name from which the type was derived. It returns nil
if pboardType
isn't a pasteboard type created by those functions.
See also:
NSCreateFileContentsPboardType
, NSCreateFilenamePboardType
, NSGetFileTypes
Declared in: AppKit/NSPasteboard.h
Synopsis:
NSArray *NSGetFileTypes(
NSArray *
pboardType)
Description:
NSGetFileTypes
accepts a null-terminated array of pointers to pasteboard types and returns a
null-terminated array of the unique extensions and file names from the file-content and file-name
types found in the input array. It returns nil
if the input array contains no file-content or file-name
types. The returned array is allocated and must be freed by the caller. The pointers in the return
array point into strings passed in the input array.
See also:
NSCreateFileContentsPboardType
, NSCreateFilenamePboardType
, NSGetFileType
Declared in: AppKit/NSPanel.h
Synopsis:
id NSGetInformationalAlertPanel(
NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ...)
Description:
NSGetInformationalAlertPanel
returns an NSAlert panel that can be used to set up a modal
session. Unlike the NSRunInformationalAlertPanel
function, no button is displayed if
defaultButton is nil
. When you're finished with the panel created by
NSGetInformationalAlertPanel
, you must free it by passing it to NSReleaseAlertPanel
.
The arguments for this function are the same as those for the NSRunAlertPanel
function. For more information on using a panel in a modal session, see NSGetAlertPanel
.
See also:
NSGetAlertPanel
, NSGetCriticalAlertPanel
, NSReleaseAlertPanel
, NSRunAlertPanel
,
NSRunCriticalAlertPanel
, NSRunInformationalAlertPanel
Declared in: AppKit/Application.h
Synopsis:
int NSGetWindowServerMemory(
DPSContext context, int *virtualMemory, int *windowBackingMemory, NSString **windowDumpStream)
Description:
NSGetWindowServerMemory
calculates the amount of Window Server memory being used at
the moment by the given Window Server context. If nil
is passed for the context, the current
context is used. The amount of PostScript virtual memory used by the current context is returned
in the int
pointed to by virtualMemory; the amount of window backing store used by windows
owned by the current context is returned in the int
pointed to by windowBackingMemory. The sum
of these two numbers is the amount of the Window Server's memory that this context is
responsible for.
To calculate these numbers, NSGetWindowServerMemory
uses the PostScript language operators dumpwindows
and vmstatus
. It takes some time to execute; thus, calling this function in normal operation is not recommended.
If a non-nil value is passed in for windowDumpStream, the information returned from the dumpwindows
operator is echoed to the specified stream. This can be useful for finding out more about which windows are using up your storage.
Normally, NSGetWindowServerMemory
returns 0. If nil
is passed for context and there's no current DPS context, this function returns -1.
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSHighlightRect(
const NSRect aRect)
Description:
NSHighlightRect
uses the compositerect
operator to highlight the rectangle referred to by its
argument. Light gray becomes white, and white becomes light gray. This function must be called
twice, once to highlight the rectangle and once to unhighlight it; the rectangle should not be left
in its highlighted state. When not drawing on the screen, the compositing operation is replaced by
one that fills the rectangle with light gray.
See also:
NSHighlightRect, NSRectClip
, NSRectClipList
, NSRectFill
, NSRectFillList
,
NSRectFillListWithColors
, NSRectFillListWithGrays
, NSUnionRect (Foundation Kit)
Declared in: AppKit/NSInterfaceStyle.h
Synopsis:
NSInterfaceStyle NSInterfaceStyleForKey(
NSString *key, NSResponder *responder)
Description:
You call the NSInterfaceStyleForKey
function to determine an interface style based on a key and
a responder, either of which may be nil
. An NSInterfaceStyle value specifies the style in which an
interface item, such as a button or a scrollbar, should be drawn. For example, a value of
NSMacintoshInterfaceStyle indicates an item should be drawn in the Macintosh style. The enum
values defined for NSInterfaceStyle are NSNoInterfaceStyle, NSNextStepInterfaceStyle,
NSWindows95InterfaceStyle, and NSMacintoshInterfaceStyle. Note that
NSInterfaceStyleForKey
never returns NSNoInterfaceStyle.
The interface style value returned by NSInterfaceStyleForKey
depends on several factors. If responder is not nil
and if responder specifies an interface style other than NSNoInterfaceStyle, NSInterfaceStyleForKey
returns the responder's style, and key is ignored.
Otherwise, if key is not nil
and there is an interface style for key specified by the defaults system, NSInterfaceStyleForKey
returns the interface style for key from the defaults system.
Finally, if key is nil
, or if there is no interface style for key specified by the defaults system, NSInterfaceStyleForKey
returns the global interface style specified by the defaults system.
The defaults system allows an application to customize its behavior to match a user's preferences.You can read about the defaults system in the documentation for NSUserDefaults.
Declared in: AppKit/NSDataLinkManager.h
Synopsis:
float NSLinkFrameThickness(
void)
Description:
NSLinkFrameThickness
returns the thickness of the link outline around linked data so that the
outline can be properly erased by the application, or for other purposes.
See also:
NSFrameLinkRect
Declared in: AppKit/NSGraphics.h
Synopsis:
int NSNumberOfColorComponents(
NSString *colorSpaceName)
Description:
NSNumberOfColorComponents
returns the number of color components in the color space
whose name is provided by colorSpaceName.
Declared in: AppKit/Listener.h
Synopsis:
BOOL NSPerformService(
NSString *itemName, NSPasteboard *pboard)
Description:
NSPerformService
allows an application to programmatically invoke a service found in its
services menu. itemName is a Services menu item, in any language. If the requested service is
from a submenu of the Services menu, itemName must contain a slash (for example,
"Mail/Selection"). The Pasteboard pboard must contain the data required by the service, and when
the function returns, pboard will contain the data supplied by the service provider.
NSPerformService
returns YES if the service is successfully performed, NO otherwise.
Declared in: AppKit/NSGraphics.h
Synopsis:
BOOL NSPlanarFromDepth(
NSWindowDepth depth)
Description:
NSPlanarFromDepth
returns YES if the specified window depth is planar and NO if it is not.
Declared in: AppKit/NSGraphics.h
Synopsis:
NSColor *NSReadPixel(NSPoint
passedPoint)
Description:
NSReadPixel
returns the color of the pixel at the given location. The location argument is taken
in the current coordinate system-in other words, you must lock focus on the View that contains
the pixel that you wish to query, and then pass the coordinate for the pixel in the View's coordinate
system.
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSRectClip(
NSRect aRect)
Description:
NSRectClip
intersects the current clipping path with the rectangle referred to by its argument,
aRect, to determine a new clipping path. This function works through the rectclip
operator. After
computing the new clipping path, the current path is reset to empty.
See also:
NSEraseRect
, NSHighlightRect
, NSRectClipList
, NSRectFill
, NSRectFillList
,
NSRectFillListWithColors
, NSRectFillListWithGrays
, NSUnionRect (Foundation Kit)
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSRectClipList(
const NSRect *rects, int count)
Description:
NSRectClipList
takes an array of count number of rectangles, constructs a path that's the graphic
union of those rectangles, and intersects that path with the current clipping path. This function
works through the rectclip
operator. After computing the new clipping path, the current path is
reset to empty.
See also:
NSEraseRect
, NSHighlightRect
, NSRectClip, NSRectFill
, NSRectFillList
,
NSRectFillListWithColors
, NSRectFillListWithGrays
, NSUnionRect (Foundation Kit)
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSRectFillList(
const NSRect aRect)
Description:
NSRectFill
fills the rectangle referred to by its argument with the current color. It works through
the rectfill
operator.
See also:
NSEraseRect
, NSHighlightRect
, NSRectClip, NSRectClipList
, NSRectFillList
,
NSRectFillListWithColors
, NSRectFillListWithGrays
, NSUnionRect (Foundation Kit)
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSRectFillList(
const NSRect *rects, int count)
Description:
NSRectFillList
fills a list of count rectangles with the current color. It works through the rectfill
operator.
See also:
NSEraseRect
, NSHighlightRect
, NSRectClip, NSRectClipList
, NSRectFill
,
NSRectFillListWithColors
, NSRectFillListWithGrays
, NSUnionRect (Foundation Kit)
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSRectFillListWithColors(
const NSRect *rects, NSColor **colors, int count)
Description:
NSRectFillListWithColors
takes a list of count rectangles and a matching list of count color
values. The first rectangle is filled with the first color, the second rectangle with the second color,
and so on. There must be an equal number of rectangles and color values. The rectangles should
not overlap; the order in which they'll be filled can't be guaranteed. This function alters the current
color of the current graphics state, setting it unpredictably to one of the values passed in colors.
See also:
NSEraseRect
, NSHighlightRect
, NSRectClip, NSRectClipList
, NSRectFill
, NSRectFillList
,
NSRectFillListWithGrays
, NSUnionRect (Foundation Kit)
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSRectFillListWithGrays(
const NSRect *rects, const float *grays, int count)
Description:
NSRectFillListWithGrays
takes a list of count rectangles and a matching list of count gray
values. The first rectangle is filled with the first gray, the second rectangle with the second gray,
and so on. There must be an equal number of rectangles and gray values. The rectangles should
not overlap; the order in which they'll be filled can't be guaranteed. This function alters the current
color of the current graphics state, setting it unpredictably to one of the values passed in grays.
See also:
NSEraseRect
, NSHighlightRect
, NSRectClip, NSRectClipList
, NSRectFill
, NSRectFillList
,
NSRectFillListWithColors
, NSUnionRect (Foundation Kit)
Declared in: AppKit/NSApplication.h
Synopsis:
void NSRegisterServicesProvider(
id provider, NSString *name)
Description:
NSRegisterServicesProvider
registers provider as a service provider and associates it with the
specified name. name should be unique; it is the name by which the service is advertised to service
requestors.
NSApplications shouldn't use this function. Instead, they should use NSApplication's setServicesProvider:
method, passing a non-nil argument.
See also:
NSSetShowsServicesMenuItem
, NSShowsServicesMenuItem
,
NSUnRegisterServicesProvider
Declared in: AppKit/NSPanel.h
Synopsis:
void NSReleaseAlertPanel(
id alertPanel)
Description:
When you're finished with a panel created by a function such as NSGetAlertPanel
,
NSGetCriticalAlertPanel
, or NSGetInformationalAlertPanel
, you must free it by passing it to
NSReleaseAlertPanel
.
See also:
NSGetAlertPanel
, NSRunAlertPanel
, NSRunCriticalAlertPanel
Declared in: AppKit/NSPanel.h
Synopsis:
int NSRunAlertPanel(
NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ...)
Description:
NSRunAlertPanel
creates an attention panel that alerts the user to some consequence of a
requested action; the panel may also let the user cancel or modify the action. NSRunAlertPanel
runs the panel in a modal event loop.
The first argument is the title of the panel, which should be at most a few words long. The default title is "Alert". The next argument is the message that's displayed in the panel. It can use printf
-style formatting characters; any necessary arguments should be listed at the end of the function's argument list (after the otherButton argument). For more information on formatting characters, see the Rhapsody man page for printf
.
There are arguments to supply titles for up to three buttons, which will be displayed in a row across the bottom of the panel. The panel created by NSRunAlertPanel
must have at least one button, which will have the symbol for the Return key; if you pass a nil title to the other two buttons, they won't be created. If nil
is passed as the defaultButton, "OK" will be used as its title.
NSRunAlertPanel
not only creates the panel, it puts the panel on screen and runs it using the runModalFor:
method defined in the Application class. This method sets up a modal event loop that causes the panel to remain on screen until the user clicks one of its buttons. NSRunAlertPanel
then removes the panel from the screen list and returns a value that indicates which of the three buttons the user clicked: NS_ALERTDEFAULT, NS_ALERTALTERNATE, or NS_ALERTOTHER. (If an error occurred while creating the panel, NS_ALERTERROR is returned.) For efficiency, NSRunAlertPanel
creates the panel the first time it's called and reuses it on subsequent calls, reconfiguring it if necessary.
See also:
NSGetAlertPanel
, NSGetCriticalAlertPanel
, NSGetInformationalAlertPanel
,
NSReleaseAlertPanel
, NSRunCriticalAlertPanel
, NSRunInformationalAlertPanel
Declared in: AppKit/NSPanel.h
Synopsis:
int NSRunCriticalAlertPanel
(
NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ...)
Description:
NSRunCriticalAlertPanel
creates an attention panel that alerts the user to some critical
consequence of a requested action; the panel lets the user cancel the action and may allow the user
to modify the action. It then runs the panel in a modal event loop.
The arguments for this function are the same as those for the NSRunAlertPanel
function.
See also:
NSGetAlertPanel
, NSGetCriticalAlertPanel
, NSGetInformationalAlertPanel
,
NSReleaseAlertPanel
, NSRunAlertPanel
, NSRunInformationalAlertPanel
Declared in: AppKit/NSPanel.h
Synopsis:
int NSRunInformationalAlertPanel
(
NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ...)
Description:
NSRunInformationalAlertPanel
creates an informational attention panel that provides
information related to a requested action. It then runs the panel in a modal event loop.
The arguments for this function are the same as those for the NSRunAlertPanel
function.
See also:
NSGetAlertPanel
, NSGetCriticalAlertPanel
, NSGetInformationalAlertPanel
,
NSReleaseAlertPanel
, NSRunAlertPanel
, NSRunCriticalAlertPanel
Declared in: AppKit/NSApplication.h
Synopsis:
int NSSetShowsServicesMenuItem(
NSString * itemName, BOOL enabled)
Description:
NSSetShowsServicesMenuItem
is used by a service-providing application to specify whether
the Services menus of other applications will contain the itemName command; if so, users of those
applications will be able to request services through that command. If enabled is YES, the
Application Kit will build Services menus for other applications that include the itemName
command. If enabled is NO, item won't appear in any application's Services menu. itemName
should be the same, language-independent character string entered in the "Menu Item:" field of
the services file.
Service-providing applications should let users decide whether the Services menus of other applications they use should include the itemName command.
NSSetShowsServicesMenuItem
returns 0 if it's successful in enabling or disabling the itemName command, and a number other than 0 if not.
See also:
NSRegisterServicesProvider
, NSShowsServicesMenuItem
, NSUnRegisterServicesProvider
Declared in: AppKit/NSApplication.h
Synopsis:
BOOL NSShowsServicesMenuItem(
NSString * itemName)
Description:
NSShowsServicesMenuItem
returns YES if itemName is currently enabled, and NO if it's not.
itemName should be the same, language-independent character string entered in the "Menu Item:
" field of the services file.
See also:
NSRegisterServicesProvider
, NSSetShowsServicesMenuItem
,
NSUnRegisterServicesProvider
Declared in: AppKit/NSApplication.h
Synopsis:
void NSUnRegisterServicesProvider(
NSString *name)
Description:
NSUnRegisterServicesProvider
unregisters the object named by name as a service provider.
NSApplications shouldn't use this function. Instead, they should use NSApplication's setServicesProvider:
method, passing a nil
argument.
See also:
NSRegisterServicesProvider
, NSSetShowsServicesMenuItem
, NSShowsServicesMenuItem
Declared in: AppKit/NSApplication.h
Synopsis:
void NSUpdateDynamicServices(
void)
Description:
NSUpdateDynamicServices
is used by a service-providing application to re-register the services
it's willing to provide. To do this, you create a file with the extension ".service" and place it in the
application's path or ~/Library/Services
. The content of the file is identical to a normal service
file (see the "Other Features" section for a description of service file format). You then call this
function.
It is only necessary to call NSUpdateDynamicServices
if your program adds dynamic services to the system.
Declared in: AppKit/NSGraphics.h
Synopsis:
void NSWindowList(
int size, int list[])
Description:
NSWindowList
provides an ordered list of the application's on-screen windows. It fills the list
array with up to size window numbers; the order of windows in the array is the same as their order
in the Window Server's screen list (their front-to-back order on the screen). Use the count obtained
by NSCountWindows
to specify the size of the array for NSWindowList
.
See also:
NSCountWindows