MoreOSL/MoreOSLHelpers.h

/*
    File:       MoreOSLHelpers.h
 
    Contains:   Property getters and setters for standard system objects.
 
    Written by: Quinn
 
    Copyright:  Copyright © 2000 by Apple Computer, Inc., all rights reserved.
 
                You may incorporate this Apple sample source code into your program(s) without
                restriction. This Apple sample source code has been provided "AS IS" and the
                responsibility for its operation is yours. You are not permitted to redistribute
                this Apple sample source code as "Apple sample source code" after having made
                changes. If you're going to re-distribute the source, we require that you make
                it clear in the source that the code was descended from Apple sample source
                code, but that you've made changes.
 
    Change History (most recent first):
 
         <2>     20/3/00    Quinn   Added comments.
         <1>      6/3/00    Quinn   First checked in.
*/
 
#pragma once
 
/////////////////////////////////////////////////////////////////
 
// MoreIsBetter Setup
 
#include "MoreSetup.h"
 
// Mac OS Interfaces
 
#include <AEDataModel.h>
#include <MacWindows.h>
 
/////////////////////////////////////////////////////////////////
 
#ifdef __cplusplus
extern "C" {
#endif
 
// Big Picture
// -----------
// The goal of this module is to provide property getters and setters for
// standard properties of standard system objects (currently the application
// and windows).  A complex application will probably want to reimplement
// most of these routines for itself, but I had to write the code for
// TestMOSL, so I thought IÕd share it.
 
// IMPORTANT:
// These routines assume that they are running on Mac OS 8.5 or later and that
// youÕre application is using the Mac OS 8.5 toolbox.  If these are not both
// true, bad things will happen.
 
extern pascal OSStatus MOSLCApplicationGetPropHelper(DescType propName, AEDesc *result);
    // Provides support for standard application properties.
    //
    //    o keyAEBestType   -- always cApplication
    //    o pName           -- using Process Manager
    //    o pIsFrontProcess -- using Process Manager
    //    o pVersion        -- from your 'vers' ID=1 resource
    //                         (your resource file must be CurResFile)
 
extern pascal OSStatus MOSLCWindowGetPropHelper(WindowRef window, DescType propName, 
                                                Point idealSize,  AEDesc *result);
    // Provides support for getting standard window properties.
    //
    //    o pName           -- using classic Window Manager
    //    o pIndex          -- ditto
    //    o kAESetPosition  -- using Mac OS 8.5 Window Manager (GetWindowBounds)
    //    o keyAEBounds     -- ditto
    //    o pIsResizable    -- using Mac OS 8.5 Window Manager (GetWindowAttributes)
    //    o pIsZoomable     -- ditto
    //    o pHasCloseBox    -- ditto
    //    o pIsFloating     -- using Mac OS 8.5 Window Manager (GetWindowClass)
    //    o pIsModal        -- ditto
    //    o pHasTitleBar    -- using Appearance Window Manager (GetWindowRegion)
    //    o pIsZoomed       -- using Mac OS 8.5 Window Manager (GetWindowAttributes, IsWindowInStandardState)
    //    o pVisible        -- using classic Window Manager
    //    o pIsFrontProcess -- ditto
    //
    // If you use this routine to support the zooming pIsZoomed property,
    // you must pass in the windowÕs idealSize as you would to ZoomWindowIdeal.
    //
    // Using pIsFrontProcess is a bit of sleaze, but it appears to be a commonly
    // accepted sleaze.
    
extern pascal OSStatus MOSLCWindowSetPropHelper(WindowRef window, DescType propName, 
                                                Point idealSize,  const AEDesc *data);
    // Provides support for setting standard window properties.
    //
    //    o pName           -- using classic Window Manager
    //    o kAESetPosition  -- using Mac OS 8.5 Window Manager (Get/SetWindowBounds)
    //    o keyAEBounds     -- ditto (and GetWindowAttributes)
    //    o pIsZoomed       -- using Mac OS 8.5 Window Manager (GetWindowAttributes, IsWindowInStandardState, ZoomWindowIdeal)
    //    o pVisible        -- using classic Window Manager
    //    o pIsFrontProcess -- ditto
    //
    // If you use this routine to support the zooming pIsZoomed property,
    // you must pass in the windowÕs idealSize as you would to ZoomWindowIdeal.
    
#ifdef __cplusplus
};
#endif