MacTech Network:   MacForge.net  |  Computer Memory  |  Register Domains  |  Printer Supplies  |  Cables  |  iPod Deals  |  Mac Deals  |  Mac Book Shelf


  MacTech Magazine

The journal of Macintosh technology

 
 
MacRentals

Magazine In Print
  About MacTech  
  Home Page  
  Subscribe  
  Archives DVD  
  Submit News  
  Submit a Tip!  
  Get a copy of MacTech RISK FREE  
Google
Entire Web
mactech.com
Mac Community
More...
MacTech Central
  by Category  
  by Company  
  by Product  
MacTech News
  MacTech News  
  Previous News  
  MacTech RSS  
Article Archives
  Show Indices  
  by Volume  
  by Author  
  Source Code FTP  
Inside MacTech
  Writer's Kit  
  Editorial Staff  
  Editorial Calendar  
  Back Issues  
  Advertising  
Contact Us
  Customer Service  
  MacTech Store  
  Legal/Disclaimers  
  Webmaster Feedback  
MACINTOSH C: A Hobbyist's Guide To Programming the Mac OS in C
Version 2.3

© 2000 K. J. Bricknell

Go to Contents

(Chapter 4B)

MORE ON WINDOWS -
MAC OS 8.5 WINDOW MANAGER

A link to the associated demonstration program listing is at the bottom of this page




Introduction

The Mac OS 8.5 Window Manager introduced the following:

  • Support for:

    • Floating windows.

      Note

      Although system support for floating windows was introduced with the Mac OS 8.5 Window Manager, Apple subsequently advised that there were significant bugs in the window activation area and that the Application Programming Interfaces (APIs) relating to floating windows should not be used until further notice.

      These bugs were eliminated in Mac OS 8.6. The upshot of all this is that, if your application uses floating windows, and if it is required to run under Mac OS 8.5 or earlier, your application will itself have to include the code necessary to support floating windows. (See Chapter 21 - Floating Windows - Mac OS 8.5 and Earlier.)

    • Window proxy icons.

    • Window path pop-up menus.

    • Transitional window animations and sounds.

  • New functions for:

    • Creating and storing windows.

    • Accessing window information.

    • Zooming, moving, re-sizing, and positioning windows.

    • Associating data with a window.

    • Adding and removing rectangles and regions to and from a window's update region.

    • Setting the colour or pattern of a window's content region.

Floating Windows

Floating windows are windows that stay in front of all of an application's document windows. They are typically used to display tool, pattern, colour, and other choices to be made available to the user. Examples of floating windows are shown at Fig 1.

Floating Windows

Front-To-Back Ordering of On-Screen Objects

The fact that floating windows always remain in front of an application's document windows leads naturally to a consideration of the correct front-to-back ordering of on-screen interface objects. Within an application, the correct front-to-back ordering is as follows:

  • Help balloons.

  • Menus.

  • System windows.

  • Modal and movable modal dialog and alert boxes.

  • Floating windows.

  • Document windows and modeless dialog boxes.
In terms of front-to-back ordering, floating windows, unlike document windows, are all basically equal. Unless they actually overlap each other, there is no visual cue of any front-to-back ordering as there is with normal windows (see Fig 1). Because of this equality, floating windows almost always appear in the active state. The exception is when a modal or movable modal dialog or alert box is presented to the user. When this occurs, the appearance of all floating windows changes to reflect the inactive state.

Window Activation

Window activation was the most significant aspect of implementing system support for floating windows. The pre-Mac OS 8.5 Window Manager is based on the principle that, at any one time, there can be one, and only one, active window. This "one active window" rule, however, cannot apply in the case of an application which uses floating windows. (See Fig 1, in which the two floating windows and the frontmost document window are active at the same time.) Accordingly, applications which require floating windows, and which are required to run under Mac OS 8.5 or earlier, must include code which, in effect, subverts the normal window activation activities of the Window Manager. (See Chapter 21 - Floating Windows - Mac OS 8.5 and Earlier.)

In Mac OS 8.5 and later, support for floating windows is built into the Window Manager, meaning that, amongst other things, the system now supports the activation of more than one window at a time.

Floating Window Types

The sixteen available window types for floating windows are shown at Figs 4 and 5 at Chapter 4 - Windows.

Opening, Closing, Showing, and Hiding Floating Windows

Floating windows may be created using the Mac OS 8.5 function CreateNewWindow (see below) with the constant kFloatingWindowClass passed in the windowClass parameter.

Floating windows should be created at application launch and should remain open until the application is closed. However, your application should provide the user with a means to hide or show each individual floating window as and when required. Ordinarily, it should do this by providing items in an appropriate menu which allow the user to toggle each floating window between the hidden and showing states.

A floating window's close box should simply hide the window, not close it. For that reason, the close box in floating windows should be conceived of as a "hide" box rather than as a go-away box.

Floating windows should be hidden by the owner application when that application receives a suspend event. This is to avoid user confusion arising from one application's floating windows being visible when another application is in the foreground. The application's floating windows should be shown again only when the application receives a subsequent resume event.

Mac OS 8.5 Functions Relating to Floating Windows

The following Mac OS 8.5 functions are relevant to floating windows:

Function Description
InitFloatingWindows Initialises the Window Manager and enables automatic front-to-back display ordering of all your application's windows. If your application uses floating windows, you must call InitFloatingWindows in lieu of InitWindows.

When InitFloatingWindows has been called, each of your application's windows is sorted into one of three window display layers: modal, floating, and document. For windows created with the Mac OS 8.5 function CreateNewWindow (see below), sorting is based on window class (see below). For windows created using the pre-Mac OS 8.5 functions, the sort order is based on window definition ID.

HideFloatingWindows Hides an application's floating windows.
ShowFloatingWindows Shows an application's floating windows.
AreFloatingWindowsVisible Indicates whether an application's floating windows are visible.

Window Proxy Icons

Window proxy icons are small icons displayed in the title bar of document windows. Ordinarily, a specific document file is associated with a specific window, and the proxy icon serves as a proxy for the document file's icon in the Finder.

Proxy icons:

  • May be dragged, in the same way that the document's icon in the Finder may be dragged, so as to move or copy the document file.

  • Provide visual feedback to the user on the current state of the document. For example, when the document has unsaved changes, your application should cause the proxy icon to be displayed in the disabled state, thus preventing the user from dragging it. (Unsaved documents should not be capable of being moved or copied.)

  • Provide visual feedback to the user indicating that the document window is a valid drag-and-drop target. In this case, your application should cause the proxy icon to appear in the highlighted state.
Fig 2 shows a typical window proxy icon for a document in the enabled, disabled, and highlighted states.

Window Proxy Icons

At Fig 2, note that, in the drag and drop operation depicted at the right, the window's content area is highlighted along with the proxy icon. Applications typically call the Drag Manager function ShowDragHilite to indicate, with this highlighting, that a window is a valid drag-and-drop target. Under Mac OS 8.5 and later, ShowDragHilite and HideDragHilite highlight and unhighlight the proxy icon as well as the content area.

Changing the State of a Proxy Icon

Applications typically keep track of the modification state of a document so as to, for example, inform users that they has made changes to the document which they might wish to save before closing the document's window. When a document has unsaved changes, your application should call SetWindowModified with true passed in the modified parameter to cause the proxy icon to appear in the disabled state. When the changes have been saved, your application should call SetWindowModified with false passed in the modified parameter to cause the proxy icon to appear in the enabled state.

Handling Mouse-Down Events in a Window Proxy Icon

When a mouse-down event occurs in your application's window, and when FindWindow returns the inProxyIcon result code, your application should simply call TrackWindowProxyDrag. TrackWindowProxyDrag handles all aspects of the drag process while the user drags the proxy icon.

File Synchronisation Function

It is always possible that, while a document file is open, the user may drag its Finder icon to another folder (including the Trash) or change the name of the file via the Finder icon. The application itself has no way of knowing that this has happened and will assume, unless it is informed otherwise, that the document's file is still at its original location with its original name. For this reason applications often include a frequently-called file synchronisation function which synchronises the application with the actual current location (and name) of its currently open document files.

A document's proxy icon is much more prominent to the user than the document's Finder icon. Thus, when proxy icons are used, there is an even a greater possibility that the user will move the file represented by the proxy icon to a different folder while the document is open. The provision of a file synchronisation function is therefore imperative when proxy icons are implemented.

File synchronisation functions should be called after every call to WaitNextEvent and, for each of the application's document windows, should update the application's internal data structures to match that of the document file as it exists on disk. The function should also ensure that, where necessary, the name of the document window is changed to match the current name of the document file on disk and close the document window if the document file has been moved to the Trash folder.

Mac OS 8.5 Functions Relating to Window Proxy Icons

The following Mac OS 8.5 functions are relevant to window proxy icons:

Function Description
SetWindowProxyCreatorAndType Sets the proxy icon for a window that lacks an associated file.

A new, untitled window needs a proxy icon to maintain visual consistency with other windows. Call this function when you want to establish a proxy icon for the window but the window's data has not yet been saved to a file.

SetWindowProxyFSSpec Associates a file with a window using a file system specification (FSSpec) structure, thus establishing a proxy icon for the window.
GetWindowProxyFSSpec Obtains a file system specification (FSSpec) structure for the file that is associated with a window.
SetWindowProxyAlias Associates a file with a window using a handle to an AliasRecord structure, thus establishing a proxy icon for the window.
GetWindowProxyAlias Obtains alias data for the file associated with the window.
SetWindowProxyIcon Overrides the default proxy icon for a window.
GetWindowProxyIcon Obtains a window's proxy icon.
RemoveWindowProxy Dissociates a file from a window.
TrackWindowProxyDrag Handles all aspects of the drag process when the user drags a proxy icon.

Note that SetPort should be called to set the relevant window's colour graphics port as the current port before calling SetWindowProxyCreatorAndType, SetWindowProxyFSSpec, SetWindowProxyAlias, and SetWindowProxyIcon.

Window Path Pop-Up Menus

If your application supports window path pop-up menus, when the user presses the Command key and clicks a window's title, your window displays a pop-up menu containing a standard file system path. The pop-up menu allows the user to open windows for folders along the file system path. An example of a window path pop-up menu is shown at Fig 3.

Window Path Pop-up Menu

Displaying and Handling a Window Path Pop-Up Menu

The window title includes both the proxy icon region and part of the drag region. Your application must be prepared to respond to a Command-click in either region by displaying a window path pop-up menu.

When FindWindow returns the inProxyIcon part code, and TrackWindowProxyDrag returns errUserWantsToDragWindow, your application should proceed on the assumption that the inDrag part code was returned by FindWindow.

When FindWindow returns the inDrag part code, your application should call IsWindowPathSelectClick to determine whether the mouse-down event should activate the window path pop-up menu. If IsWindowPathSelectClick returns true, WindowPathSelect should be called to display the menu.

If the user chooses a menu item for a folder, your application must ensure that the associated window is visible by calling an application-defined function which makes the Finder the frontmost process.

Transitional Window Animation and Sounds

Prior to Mac OS 8.5, the Window Manager supported the playing of a sound to accompany the transitional animation that occurs when a user clicks a window's collapse box. Mac OS 8.5 added support for animation and sounds to accompany the hiding and showing of windows.

The Mac OS 8.5 Window Manager function TransitionWindow may be used in lieu of the older functions HideWindow and ShowWindow to hide and show windows. TransitionWindow causes a transitional animation to be displayed, a transitional sound to be played, and the necessary update and activate events to be generated.

Creating and Storing Windows

Mac OS 8.5 provides the following functions for creating and storing windows:

Function Description
CreateNewWindow Creates a window from parameter data.
CreateWindowFromResource Creates a window from 'wind' resource data.
CreateWindowFromCollection Creates a window from collection data.
StoreWindowIntoCollection Stores data describing a window into a collection.

Use of the last three of these functions requires a basic understanding of collections, flattened collections and 'wind' resources.

Collections, Flattened Collections, and 'wind' Resources

Collections

A collection object (or, simply, a collection) is an abstract data type, defined by the Collection Manager, that allows you to store multiple pieces of related information.

A collection is like an array in that it contains a number of individually accessible items. However, unlike an array, a collection allows for a variable number of data items and variable-size items. A collection is also similar to a database, in that you can store information and retrieve it using a variety of search mechanisms.

The internal structure of a collection is private. This means that you must store information into a collection and retrieve information from it using Collection Manager functions.

Using the function StoreWindowIntoCollection, your application can store a window into a collection. This applies to any window, not just those created using Mac OS 8.5 Window Manager functions. You can also store data associated with the window (for example, text) into the same collection. This provides a quick and easy way for your application to save a simple document.

Using the Mac OS 8.5 function CreateWindowFromCollection, you can create a window from collection data. Note that CreateWindowFromCollection creates the window invisibly. After creating the window, you must call the function TransitionWindow to display the window.

Flattened Collections

Using the Collection Manager, you application can create a flattened collection from a collection. A flattened collection is a stream of address-independent data.

The 'wind' Resource

The 'wind' resource consists of an extensible flattened collection. Using the Resource Manager, your application can store a flattened collection, consisting of a window and its data, into a 'wind' resource.

Using the Mac OS 8.5 function CreateWindowFromResource, you can create a window from a 'wind' resource. Note that CreateWindowFromResource creates the window invisibly. After creating the window, you must call the function TransitionWindow to display the window.

The CreateNewWindow Function

The Mac OS 8.5 function CreateNewWindow creates a window based on the class and attributes you specify in the windowClass and attributes parameters. The following constants may be passed in these parameters.

Window Class Constants

Constant Value Description
kAlertWindowClass 1L Alert box window.
kMovableAlertWindowClass 2L Movable alert box window.
kModalWindowClass 3L Modal dialog box window.
kMovableModalWindowClass 4L Movable modal dialog box window.
kFloatingWindowClass 5L Floating window.

If your application assigns this constant to a window and calls the function InitFloatingWindows, the Window Manager ensures that the window has the proper floating behaviour. Supported with Mac OS 8.6 and later.

kDocumentWindowClass 6L Document window or modeless dialog box window.

Window Attribute Constants

Constant Bit Description
kWindowNoAttributes 0L No attributes.
kWindowCloseBoxAttribute 1L << 0 Has close box.
kWindowHorizontalZoomAttribute 1L << 1 Has horizontal zoom box.
kWindowVerticalZoomAttribute 1L << 2 Has vertical zoom box.
kWindowFullZoomAttribute kWindowVerticalZoomAttribute |
kWindowHorizontalZoomAttribute
Has full zoom box.
kWindowCollapseBoxAttribute 1L << 3 Has a collapse box.
kWindowResizableAttribute 1L << 4 Has size box.
kWindowSideTitlebarAttribute 1L << 5 Has side title bar. This attribute may be applied only to floating windows.
kWindowNoUpdatesAttribute 1L << 16 Does not receive update events.
kWindowNoActivatesAttribute 1L << 17 Does not receive activate events.
kWindowStandardDocumentAttributes kWindowCloseBoxAttribute |
kWindowFullZoomAttribute |
kWindowCollapseBoxAttribute |
kWindowResizableAttribute
Has standard document window attributes, that is, close box, full zoom box, collapse box and size box.
kWindowStandardFloatingAttributes kWindowCloseBoxAttribute |
kWindowCollapseBoxAttribute
Has standard floating window attributes, that is, close box and collapse box.

Note that CreateNewWindow creates the window invisibly. After creating the window, you must call the function TransitionWindow to display the window.

Accessing Window Information

Mac OS 8.5 includes the following functions for accessing window information:

Function Description
GetWindowClass Obtains the class of a window.
GetWindowAttributes Obtains the attributes of a window.
IsValidWindowPtr Reports whether a pointer is a valid window pointer.
FrontNonFloatingWindow Returns a pointer to the application's frontmost window that is not a floating window.

Zooming, Moving, Resizing, and Positioning Windows

Zooming Windows

The Mac OS 8.5 function ZoomWindowIdeal may be used instead of ZoomWindow to zoom a window, the advantage being that ZoomWindowIdeal zooms the window in accordance with the following human interface guidelines relating to a window's standard state:

  • A window should move as little as possible when zooming between the user state and standard state, to avoid distracting the user.

  • A window in its standard state should be positioned so that it is entirely on one screen.

  • If a window straddles more than one screen in the user state, when it is zoomed to the standard state it should be zoomed to the screen that contains the largest portion of the window's content region.

  • If the ideal size for the standard state is larger than the destination screen, the dimensions of the standard state should be that of the destination screen, minus a few pixels of boundary. If the destination screen is the main screen, space should also be left for the menu bar.

  • When a window is zoomed from the user state to the standard state, the top left corner of the window should remain anchored in place; however, if the standard state of the window cannot fit on the screen with the top left corner anchored, the window should be "nudged" so that the parts of the window in the standard state that would fall offscreen are, instead, just onscreen.
The ZoomWindowIdeal function calculates the window's ideal standard state, and updates the window's user state independently of the WStateData structure. (Previously, the window definition function was responsible for updating the user state.)

When ZoomWindowIdeal is used, the Mac OS 8 function IsWindowInStandardState must be used to determine the appropriate part code (inZoomIn or InZoomOut) to pass in ZoomWindowIdeal's partCode parameter.

The following two additional Mac OS 8.5 functions relating to window zooming allow your application to access the window's user-state in a Carbon-compliant manner.

Function Description
SetWindowIdealUserState Sets the size and position of a window in its user state. The size and position of the window are specified in global coordinates in the userState parameter.
GetWindowIdealUserState Obtains the size and position of a window in its user state. On return, the userState parameter contains the size and position in global coordinates.

Ordinarily, your application does not need to use these two functions. They are supplied for the sake of completeness.

Moving Windows

When your application wishes to move a window for a reason other than a user-instigated drag, it should use the Mac OS 8.5 function MoveWindowStructure or the earlier function MoveWindow.

MoveWindow repositions a window's content region, whereas MoveWindowStructure repositions a window's structure region. The introduction of the MoveWindowStructure function arises from the fact that, under the Appearance Manager, the size and shape of a window's frame may vary from appearance to appearance (see Chapter 6 - The Appearance Manager). This means that the total dimensions of the window (that is, the window's structure region) may also vary, causing the window's spatial relationship to the rest of the screen to change.

The Mac OS 8.5 function SetWindowBounds provides a means to set the size of a window in addition to simply repositioning it. The size and position of the window are specified in a rectangle passed in the globalBounds parameter. In addition, you may specify whether this rectangle represents the bounds of the content region or the bounds of the structure region by passing either kWindowContentRgn or kWindowStructureRgn in the regionCode parameter. The sister Mac OS 8.5 function GetWindowBounds obtains the size and position of the bounding rectangle of the specified window region.

Resizing Windows

The Mac OS 8.6 function ResizeWindow moves a grow image of the window's edges around the screen, following the user's cursor movements, and handles all user interaction until the mouse button is released. Unlike the function GrowWindow, there is no need to follow this call with a call to SizeWindow. Once resizing is complete, ResizeWindow draws the window in its new size.

Note

ResizeWindow is supported only under Mac OS 8.6 and later.

ResizeWindow informs your application of the new window bounds, so that, if necessary, your application can respond to any changes in the window's position. (This latter possibility arises from the fact that some appearances may allow the window to be resized from any corner, not just the bottom right, as a result of which the window may move on the screen and not simply change size.)

Positioning Windows

Generally speaking, a new window should be placed on the desktop where the user expects it to appear. For new document windows, this usually means just below and to the right of the last document window in which the user was working, although this is not necessarily the case on computers with multiple monitors.

The Mac OS 8.5 function RepositionWindow allows you to position a window relative to another window or a display screen. The required window positioning method may be specified by passing one of the following constants in the method parameter.

Window Positioning Constants

Constant Value Description
kWindowCenterOnMainScreen 0x00000001 Centre on the screen that contains the menu bar.
kWindowCenterOnParentWindow 0x00000002 Centre on the parent window. If the window to be centred is wider than the parent window, its left edge is aligned with the parent window's left edge.
kWindowCenterOnParentWindowScreen 0x00000003 Centre on the screen containing the parent window.
kWindowCascadeOnMainScreen 0x00000004 Place the window just below the menu bar at the left edge of the main screen. Place subsequent windows relative to the first window such that the frame of the preceding window remains visible behind the current window.
kWindowCascadeOnParentWindow 0x00000005 Place the window a distance below and to the right of the upper-left corner of the parent window such that the frame of the parent window remains visible behind the current window.
kWIndowCascadeOnParentWindowScreen 0x00000006 Place the window just below the menu bar at the left edge of the screen containing the parent window. Place subsequent windows on the screen relative to the first window such that the frame of the preceding window remains visible behind the current window.
kWindowAlertPositionOnMainScreen 0x00000007 Centre the window horizontally, and position it vertically on the screen that contains the menu bar such that about one-fifth of the screen is above it.
kWindowAlertPositionOnParentWindow 0x00000008 Centre the window horizontally, and position it vertically such that about one-fifth of the parent window is above it.
kWindowAlertPositionOnParentWindowScreen 0x00000009 Centre the window horizontally, and position it vertically such that about one-fifth of the screen containing the parent window is above it.

These constants should not be confused with the pre-Mac OS 8.5 positioning specification constants (see Chapter 4 - Windows), and should not be used where those older constants are required (for example, in 'WIND', 'DLOG', and 'ALRT' resources, and in the StandardAlert function).

Associating Data With Windows

The pre-Mac OS 8.5 function SetWRefCon allows your application to associate a pointer to data with a pointer to a window. An alternative method of associating data with windows is to use the standard mechanism provided by the Mac OS 8.5 Window Manager. (Both methods, incidentally, are Carbon-compliant.)

The Mac OS 8.5 Window Manager provides the following functions relating to associating data with windows:

Function Description
SetWindowProperty Associates an arbitrary piece of data with a window.
GetWindowProperty Obtains a piece of data associated with a window.
GetWindowPropertySize Obtains the size of a piece of data associated with a window.
RemoveWindowProperty Removes a piece of data associated with a window.

Adding To and Removing From the Update Region

The Mac OS 8.5 Window Manager provides enhanced functions for manipulating the update region. Unlike their pre-Mac OS 8.5 counterparts, the new functions allow the window on which they operate to be explicitly specified, meaning that they do not require the graphics port to be set prior to their use. The following are the Mac OS 8.5 functions for manipulating the update region:

Function Description
InvalWindowRect Adds a rectangle to the window's update region.
InvalWindowRgn Adds a region to the window's update region.
ValidWindowRect Removes a rectangle from the window's update region.
ValidWindowRgn Removes a region from the window's update region.

Setting Content Region Colour and Pattern

The Mac OS 8.5 Window Manager provides the following functions for setting the colour or pattern of a window's content region:

Function Description
SetWindowContentColor Sets the colour to which a window's content region is redrawn on receipt of an update event.
GetWindowContentColor Obtains the colour to which a window's content region is redrawn.
SetWindowContentPattern Sets the pattern to which a window's content region is redrawn on receipt of an update event.
GetWindowContentPattern Obtains the pattern to which a window's content region is redrawn.

These functions do not affect the colour graphics port's background colour or pattern.



Main Window Manager Constants, Data Types and Functions

In the following, those constants and functions supported only under Mac OS 8.6 and later appear in blue.

Constants

Window Class

KAlertWindowClass         = 1L
kMovableAlertWindowClass  = 2L
kModalWindowClass         = 3L
kMovableModalWindowClass  = 4L
kFloatingWindowClass      = 5L
kDocumentWindowClass      = 6L

Window Attributes

kWindowNoAttributes               = 0L
kWindowCloseBoxAttribute          = 1L << 0
kWindowHorizontalZoomAttribute    = 1L << 1
kWindowVerticalZoomAttribute      = 1L << 2
kWindowFullZoomAttribute          = kWindowVerticalZoomAttribute |
                                    kWindowHorizontalZoomAttribute
kWindowCollapseBoxAttribute       = 1L << 3
kWindowResizableAttribute         = 1L << 4
kWindowSideTitlebarAttribute      = 1L << 5
kWindowNoUpdatesAttribute         = 1L << 16
kWindowNoActivatesAttribute       = 1L << 17
kWindowStandardDocumentAttributes = kWindowCloseBoxAttribute |
                                    kWindowFullZoomAttribute |
                                    kWindowCollapseBoxAttribute |
                                    kWindowResizableAttribute)
kWindowStandardFloatingAttributes = kWindowCloseBoxAttribute |
                                    kWindowCollapseBoxAttribute

Window Positioning

kWindowCenterOnMainScreen                 = 0x00000001
kWindowCenterOnParentWindow               = 0x00000002
kWindowCenterOnParentWindowScreen         = 0x00000003
kWindowCascadeOnMainScreen                = 0x00000004
kWindowCascadeOnParentWindow              = 0x00000005
kWIndowCascadeOnParentWindowScreen        = 0x00000006
kWindowAlertPositionOnMainScreen          = 0x00000007
kWindowAlertPositionOnParentWindow        = 0x00000008
kWindowAlertPositionOnParentWindowScreen  = 0x00000009

Window Transition Action and Effect

kWindowShowTransitionAction       = 1
kWindowHideTransitionAction       = 2
kWindowZoomTransitionEffect       = 1

Data Types

Property Types

typedef OSType PropertyCreator;
typedef OSType PropertyTag;

Window Class and Attributes

typedef UInt32 WindowClass;
typedef UInt32 WindowAttributes;

Window Positioning

typedef UInt32 WindowPositionMethod;

Window Transitioning

typedef UInt32 WindowTransitionEffect;
typedef UInt32 WindowTransitionAction;

Functions

Floating Windows

OSStatus  InitFloatingWindows (void);
OSStatus  HideFloatingWindows(void);
OSStatus  ShowFloatingWindows(void);
Boolean   AreFloatingWindowsVisible(void);

Window Proxy Icons

OSStatus  SetWindowProxyCreatorAndType(WindowPtr window,OSType fileCreator,
          OSType fileType,SInt16 vRefNum);
OSStatus  SetWindowProxyFSSpec(WindowPtr window,const FSSpec *inFile);
OSStatus  GetWindowProxyFSSpec(WindowPtr window,FSSpec * outFile);
OSStatus  GetWindowProxyAlias(WindowPtr window,AliasHandle *alias);
OSStatus  SetWindowProxyAlias(WindowPtr window,AliasHandle alias);
OSStatus  SetWindowProxyIcon(WindowPtr window,IconRef icon);
OSStatus  GetWindowProxyIcon(WindowPtr window,IconRef * outIcon);
OSStatus  RemoveWindowProxy(WindowPtr window);
OSStatus  TrackWindowProxyDrag(WindowPtr window,Point startPt);

Window Path Pop-Up Menus

Boolean   IsWindowPathSelectClick (WindowPtr window,EventRecord *event);
OSStatus  WindowPathSelect(WindowPtr  window,MenuHandle menu,SInt32 *outMenuResult);

Transitional Window Animations and Sounds

SStatus  TransitionWindow(WindowPtr window,WindowTransitionEffect effect,
         WindowTransitionAction action,const Rect *rect)

Creating and Storing Windows

OSStatus  CreateNewWindow(WindowClass windowClass,WindowAttributes attributes,
          const Rect *bounds,WindowPtr *outWindow);
OSStatus  CreateWindowFromResource(SInt16 resID,WindowPtr *outWindow);
OSStatus  CreateWindowFromCollection(Collectioncollection,WindowPtr *outWindow);
OSStatus  StoreWindowIntoCollection(WindowPtr window,Collection collection);

Accessing Window Information

OSStatus  GetWindowClass(WindowPtr window,WindowClass *outClass);
OSStatus  GetWindowAttributes (WindowPtr window,WindowAttributes *outAttributes);
Boolean   IsValidWindowPtr(GrafPtr  grafPort);
WindowPtr FrontNonFloatingWindow(void);

Zooming, Moving, Resizing, and Positioning Windows

OSStatus  ZoomWindowIdeal(WindowPtr window,SInt16 partCode,Point *ioIdealSize);
Boolean   IsWindowInStandardState(WindowPtr window,Point *idealSize,
          Rect *idealStandardState);
OSStatus  SetWindowIdealUserState(WindowPtr window,Rect *userState);
OSStatus  GetWindowIdealUserState(WindowPtr window,Rect *userState);
OSStatus  MoveWindowStructure(WindowPtr window,short hGlobal,short vGlobal);
OSStatus  SetWindowBounds(WindowPtr window,WindowRegionCode regionCode,
          const Rect *globalBounds);
OSStatus  GetWindowBounds(WindowPtr window,WindowRegionCode regionCode,
          Rect *globalBounds);
Boolean   ResizeWindow(WindowPtr window,Point startPoint,const Rect *sizeConstraints,
          Rect *newContentRect);
OSStatus  RepositionWindow(WindowPtr window,WindowPtr parentWindow,
          WindowPositionMethod method);

Associating Data With Windows

OSStatus  SetWindowProperty(WindowPtr window,PropertyCreator propertyCreator,
          PropertyTag propertyTag,UInt32 propertySize,void *propertyBuffer);
OSStatus  GetWindowProperty(WindowPtr window,PropertyCreator propertyCreator,
          PropertyTag propertyTag,UInt32 bufferSize,UInt32 *actualSize,
          void *propertyBuffer);
OSStatus  GetWindowPropertySize(WindowPtr window,PropertyCreator creator,PropertyTag tag,
          UInt32 *size);
OSStatus  RemoveWindowProperty(WindowPtr window,PropertyCreator propertyCreator,
          PropertyTag propertyTag);

Adding To and Removing From the Update Region

OSStatus  InvalWindowRect(WindowPtr window,const Rect *bounds);
OSStatus  InvalWindowRgn(WindowPtr window,RgnHandle region);
OSStatus  ValidWindowRect(WindowPtr window,const Rect *bounds);
OSStatus  ValidWindowRgn(WindowPtr window,RgnHandle region);

Setting Content Region Colour and Pattern

OSStatus  SetWindowContentColor(WindowPtr window,RGBColor *color);
OSStatus  GetWindowContentColor(WindowPtr window,RGBColor *color);
OSStatus  GetWindowContentPattern(WindowPtr window,PixPatHandle outPixPat);
OSStatus  SetWindowContentPattern(WindowPtr window,PixPatHandle pixPat);

Go to Demo



Click here to find out more about our best subscription bundle deal ever!
2 years of the magazine, and the all new MacTech DVD ... at 70% off!



Click on the cover to
see this month's issue!

TRIAL SUBSCRIPTION
Get a RISK-FREE subscription to the only technical Mac magazine!
 
 


MacTech Magazine. www.mactech.com
Toll Free 877-MACTECH, Outside US/Canada: 805-494-9797

Register Low Cost (ok dirt cheap!) Domain Names in the MacTech Domain Store. As low as $1.99!
Save on brand compatible and name brank ink jet and laser supplies.
Save on long distance * Upgrade your Computer
Movies with No Late Fees!

See local info about Westlake Village
SJ * BRJ * BJ * OJ * NITS
Staff Site Links



All contents are Copyright 1984-2007 by Xplain Corporation. All rights reserved.

MacTech is a registered trademark of Xplain Corporation. Xplain, Video Depot, Movie Depot, Palm OS Depot, Explain It, MacDev, MacDev-1, THINK Reference, NetProfessional, NetProLive, JavaTech, WebTech, BeTech, LinuxTech, Apple Expo, MacTech Central and the MacTutorMan are trademarks or service marks of Xplain Corporation. Sprocket is a registered trademark of eSprocket Corporation. Other trademarks and copyrights appearing in this printing or software remain the property of their respective holders.