SlideShare a Scribd company logo
1 of 52
Download to read offline
C H A P T E R 1
The Class XMPPart
3
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
The Class XMPPart 1
This chapter describes the class XMPPart, which you must subclass to create a
part handler.
Note
One recommended method for developing a part handler
involves use of a part-handler framework, a set of classes
that provide an intermediate step between your part
handler’s code and the OpenDoc class library. Such a
framework is not documented here, nor are any classes
that your part handler might implement on its own,
independent of or as wrappers to OpenDoc classes. This
chapter, like the rest of this book, describes only the classes
defined by OpenDoc itself. For information on using a
framework to develop a part handler, see [documentation
to come]. x
C H A P T E R 1
The Class XMPPart
4 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
XMPPart 1
Superclasses XMPPersistentObject → XMPRefCntObject → XMPObject
Subclasses none
XMPPart is the abstract superclass from which you instantiate subclasses for
implementation as part handlers. There can be no instances of XMPPart itself,
but there will always be instantiations of its subclasses.
XMPPart provides a template for the structure and behavior of parts. Each part
in an OpenDoc document is represented by one instance of XMPPart.
Description 1
Parts are the building blocks of an OpenDoc document. Each part object is an
instantiation of XMPPart, and consists of a unit of the document’s content,
accompanied by the code that manipulates it. Part content consists of data of a
given structure or type. This data is represented by the instance variables for
that instantiation of XMPPart. Instantiated part objects are separated by data
format into part kinds and part categories, which represent various data
formats, such as text, graphics, or video. To the end user, parts mostly represent
the discrete screen areas in a document where one kind of content ends and
where another kind begins. Documents may contain many different part kinds.
The code that manipulates the part content is referred to as a part handler.
Each part handler controls the behavior of one part kind. There are two kinds
of part handlers: part editors and part viewers. A part editor can display and
change the data contained in its part, whereas the part viewer can only display
that data.
Each part kind exhibits a unique behavior. This behavior is determined by the
part handler. The behavior is unique because each part in an OpenDoc
application represents an independent instantiation of a subclass of XMPPart.
The unique behavior of each subclass of XMPPart is defined during the
implementation of the methods of that subclass. Because the methods of
XMPPart are pure virtual methods, they must be must be subclassed and
C H A P T E R 1
The Class XMPPart
XMPPart 5
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
implemented by all part handlers. One part handler supplies the behavior for
all parts of a given part kind.
Parts can embed other parts, although they possess little or no information
regarding the data contained in the embedded parts. Every document
possesses a single part that resides at its topmost level. This is referred to as the
root part. All other parts in this document will be embedded in the root part,
either directly or in parts that are themselves embedded in the root part. A part
that contains other parts that are embedded within it is referred to as the
containing part or embedding part. The root part, for instance, is the
containing part for the entire document.
Parts participate in many OpenDoc activities, and developers of part handlers
must implement behavior for the part in all of them. XMPPart provides a base
structure, on which you can construct the capability of your part handler. There
are quite a few entry points into a part, but many of these are fairly simple to
implement.
Each part must maintain a list of all frames in which it is displayed. The
representation of this list is hidden by the API, and you may choose whatever
format works best for your implementation.
A part that can embed other parts must maintain a list of all frames embedded
within it. This list contains references to frames displaying all the parts
embedded in the containing part. The representation of this list is hidden by
the API, and you may choose whatever format works best for your
implementation.
Parts that support extensions, including a semantic interface, must manage the
creation and deletion of their extension objects.
For more information related to XMPPart, see the class descriptions for
XMPFacet, XMPFrame, XMPShape, XMPCanvas, XMPStorageUnit,
XMPTransform, and XMPLink.
Methods 1
The methods of XMPPart are used for the activation and general manipulation
of part objects. You must override all these methods.
Initialization
InitPart Called to allow your part to initialize itself.
C H A P T E R 1
The Class XMPPart
6 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
InitPartFromStorage Called to allow your part to initialize itself from
stored data.
Part Manipulation
AbortRelinquishFocus
Called to cause your part to resume ownership of
the focus.
BeginRelinquishFocus
Called to ask your part to give up ownership of a
specified focus.
ChangeKind Called to ask your part to change its content to a
new kind.
CloneInto Called to ask your part to write its data into the
specified storage unit.
CommitRelinquishFocus
Called to ask your part to complete the process of
relinquishing the ownership of the specified focus
that was inititated in your part’s
BeginRelinquishFocus method.
ContainingPartPropertiesChanged
Called to inform your part of changes to the content
properties of the containing part that should be
reflected, if possible, in your part’s embedded frame.
FocusAcquired Called to notify your part that one of its frames has
acquired the specified focus.
FocusLost Called to notify your part that a focus has
unexpectedly been lost.
FulfillPromise Called to ask your part to fulfill a previously made
promise by providing the actual data the promise
represents.
GetContainingPartProperties
Called to ask you part for the properties it associates
with an embedded frame.
Open Called to ask your part to create and open a
presentation of itself as the root frame in a new
window.
C H A P T E R 1
The Class XMPPart
XMPPart 7
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
DragAndDrop
DragEnter Called to activate your part for tracking a drag
operation.
DragLeave Called to notify your part that the drag operation is
complete, and your part can deactivate itself from
drag tracking.
DragWithin Called to ask your part to track the drag operation,
and provide graphical feedback regarding possible
drop targets.
Drop Called to ask your part to transfer the dragged data
to itself.
DropCompleted Called to notify your part that the drop is completed.
Facet Manipulation
ClipShapeChanged Called by a facet of the part to inform it that the
clipping shape of that facet has changed.
FacetAdded Called to notify your part that a facet has been
added to one of its display frames.
FacetRemoved Called to notify your part that a facet has been
added to one of its display frames.
Frame Manipulation
AddDisplayFrame Called to tell your part to add the specified frame to
its list of frames.
AdjustBorderShape Called to adjust the shape of the active frame border
of an embedded frame.
AttachSourceFrame Called to associate a source frame with a display
frame of a part.
CloseDisplayFrame Called to inform your part that one of its display
frames is closing.
CreateEmbeddedFramesIterator
Called to ask your part to create an object that will
iterate over the frames that are embedded within a
display frame of this part.
EmbeddedFrameChanged
Called to notify your part that the content of one of
its embedded frames has changed.
C H A P T E R 1
The Class XMPPart
8 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
EmbeddedFrameSpec Called to ask your part to create an object specifier
for an embedded frame.
FrameShapeChanged Called to notify your part that the containing part
has changed the frame shape of one of your part’s
display frames.
GeometryChanged Called to inform your part that the clipping shape
and/or external transform of one of its facets has
changed.
PresentationChanged Called to notify your part that the presentation of
one of its frames has been changed.
RemoveDisplayFrame Called to ask your part to remove a specified frame
from your part’s list of frames.
RemoveEmbeddedFrame Called to ask your part to remove a frame of an
embedded part.
RequestEmbeddedFrame
Called to ask your part to create a new frame and
embed a part in it.
RequestFrameShape Called to ask your part for a change in the shape of
an embedded frame.
RevealFrame Called to ask your part to make an embedded frame
visible by scrolling it into view.
SequenceChanged Called to inform your part that the sequencing of a
group of its frames has been changed.
UsedShapeChanged Called to inform your part that the used shape of
one of its embedded frames has changed.
ViewTypeChanged Called to notify your part that the view type of one
of its frames has been changed.
Imaging
CanvasChanged Called to notify your part that one of its facets has
been moved to image on a different canvas.
CanvasUpdated Called to notify your part that a canvas that it owns
has been updated and that its contents need to be
copied to its root canvas.
Draw Called to ask your part to draw itself in the specified
facet.
C H A P T E R 1
The Class XMPPart
XMPPart 9
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
GetPrintResolution Called to ask your part for the minimum desired
resolution in dots per inch required for printing the
contents of a specified frame.
HighlightChanged Called to notify your part that the highlight state of
one of its facets has been changed.
Linking
CreateLink Called to ask your part to create a new link object.
LinkStatusChanged Called to allow your part to set the link status of any
embedded frame.
LinkUpdated Called to pass an updated link object to your part.
RevealLink Called to ask your part to reveal data that was
linked in a frame, making it available for viewing in
a frame.
User Iinterface Events
AdjustMenus Called by the window state object to allow your part
to adjust the presentation of its menus for display.
HandleEvent Called to give your part the opportunity to handle a
specified user-interface event.
MouseEnter Called to notify your part that the user has moved
into the area of a display frame of your part (mouse
button up).
MouseLeave Calledto notify your part that the cursor has moved
out of the area of a display frame of your part
(mouse button up).
MouseWithin Called to notify your part that the cursor has moved
within the area of a display frame of your part
(mouse button up).
UndoActions
DisposeActionState Called to tell your part to dispose of the undo action
data.
RedoAction Called to ask your part to redo a specified action.
UndoAction Called to tell your part to undo a previous action.
C H A P T E R 1
The Class XMPPart
10 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
Reading and Writing
ExternalizeKinds Called to ask your part to write to storage a
representation for each part kind, out of a supported
list, that it supports.
ReadActionState Called to ask you part to read the undo action data
from a storage unit.
ReadPartInfo Called to ask your part to read the part information
data for a display frame of your part from a storage
unit.
WriteActionState Called to ask you part to write out the specified
action state data into a specified storage unit view
object.
WritePartInfo Called to ask your part to write the frame's part
information data into the frame's storage unit.
***Where do you read/write partInfor data into a facet?***
Method Descriptions 1
AbortRelinquishFocus 1
The AbortRelinquishFocus method is called to cause your part to resume
ownership of the focus.
void AbortRelinquishFocus(
XMPTypeToken focus,
XMPFrame* ownerFrame,
XMPFrame* proposedFrame);
PARAMETERS
focus A tokenized string representing the focus type that is being
relinquished.
ownerFrame A reference to the frame that currently possesses the focus.
C H A P T E R 1
The Class XMPPart
XMPPart 11
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
proposedFrame
A reference to the frame of the part that has requested the focus.
DESCRIPTION
This method is called by the arbitrator object to cancel changes initiated by the
BeginRelinquishFocus method.
Your part must return itself to the state where it previously possessed the
focus, before continuing use of that focus. Before calling this method, the caller
must have previously called the part’s BeginRelinquishFocus method.
EXCEPTIONS
kXMPErrInvalidFocus Part doesn't own this focus.
kXMPErrNotPrepared Part hasn't prepared to relinqush focus.
kXMPErrInvalidFrame The specified owner frame is not a display frame
of this part.
AddDisplayFrame 1
The AddDisplayFrame method is called to tell your part to add the specified
frame to its list of frames.
void AddDisplayFrame (XMPFrame* frame);
frame A reference to the new frame to add.
DESCRIPTION
This method is only called by frame objects during their initialization.
The part must record the specified frame in whatever internal structures it uses
to remember its display frames. The new frame will carry a suggested view
type and presentation information. The part should look at those settings, and
decide if it can support them; if not, it should update those settings in the
frame to reflect a default presentation that it can support. Note that the part
C H A P T E R 1
The Class XMPPart
12 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
must support the required set of standard view types (frame, icon, small icon,
thumbnail, etc.). The part will then create the appropriate partInfo data and
store it in the frame. This data allows the part to distinguish the frame from its
other display frames, and is also a handy place to store other view-related
information.
AdjustBorderShape 1
The AdjustBorderShape method is called to adjust the shape of an
embedded frame’s active border shape.
XMPShape* AdjustBorderShape (XMPFrame* embeddedFrame,
XMPShape* shape);
embeddedFrame
A reference to an embedded frame that is contained in your
part, for which the border is being adjusted.
shape A reference to the starting shape for the active border of the
embedded frame.
return value A reference to the shape to use for the active border, clipped by
your part's content.
DESCRIPTION
This method is called by the arbitrator object.
The shape parameter specifies the requested shape. The return value specifies
that shape as it is obscured by the other contents of this part.
EXCEPTIONS
kXMPErrInvalidFrame The embeddedFrame is not an embeddedFrame
of this part.
C H A P T E R 1
The Class XMPPart
XMPPart 13
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
AdjustMenus 1
The AdjustMenus method is called by the window state object to allow your
part to adjust the presentation of its menus for display.
void AdjustMenus (XMPFrame* frame);
frame A reference to the display frame for which the menus need to be
adjusted.
DESCRIPTION
This method is called by the window state object just prior to calling the
MenuSelect or MenuKey methods.
When this method is called your part should enable and disable menus as
appropriate to its current state.
EXCEPTIONS
kXMPErrInvalidFrame The specified frame is not a display frame of this
part.
AttachSourceFrame 1
The AttachSourceFrame method is called to associate a source frame with a
display frame of a part.
void AttachSourceFrame (XMPFrame* frame,
XMPFrame* sourceFrame);
frame A reference to a display frame for this part.
sourceFrame
A reference to another display frame for this part.
C H A P T E R 1
The Class XMPPart
14 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
DESCRIPTION
The source frame is a display frame that is used for a source for a new display
frame. This method is called by the part that requested creation of the frame,
immediately after that frame’s creation. It tells the part to keep two or more of
its display frames synchronized.
A part will receive this call every time that a display frame has been added.
Attaching a source frame should cause the display frame to look identical to it.
If presentations differ, it causes the display frame to be equivalent to it. This
causes duplication of the embedded frames, and ensures that the view in one
frame is updated when content in the other is changed. Before calling this
method, the caller must ensure that both the specified frame and source frame
are registered frames belonging to your part.
EXCEPTIONS
kXMPErrInvalidFrame Either frame or sourceFrame is not a display
frame of this part.
BeginRelinquishFocus 1
The BeginRelinquishFocus method is called to ask your part to give up
ownership of a specified focus.
XMPBoolean BeginRelinquishFocus (XMPTypeToken focus,
XMPFrame* ownerFrame,
XMPFrame* proposedFrame);
focus The focus type being relinquished.
ownerFrame A reference to the part's frame that possesses the focus.
proposedFrame
A reference to the frame of belonging to the other part that has
requested the focus.
return value Returns a Boolean specifying whether the part can give up the
requested focus; kXMPTrue if the focus is relinquished,
otherwise kXMPFalse.
C H A P T E R 1
The Class XMPPart
XMPPart 15
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
DESCRIPTION
This method is called by the arbitrator object.
Upon receiving this call, your part decides if it can give up the requested focus.
Each part will have part-specific requirements that need to be met before that
part will relinquish a focus, if these requirements are met and it is determined
that the part can relinquish focus, it prepares to relinquish the focus. It also
ensures that, during the process of relinquishing the specified focus, and before
the CommitRelinquishFocus method is called, it does not enter a state
where the focus can't be given up. Before calling this method, the caller must
ensure that your part owns the requested focus.
EXCEPTIONS
kXMPErrInvalidFocus Part doesn't own this focus.
kXMPErrInvalidFrame The specified ownerFrame is not a display frame
of this part.
CanvasChanged 1
The CanvasChanged method is called to notify your part that one of its facets
has been moved to image on a different canvas.
void CanvasChanged (XMPFacet* facet);
facet A reference to the facet that has a new canvas.
DESCRIPTION
This method is called by the facet object.
Your part must update any internal state necessary for compliance with this
method’s call.
C H A P T E R 1
The Class XMPPart
16 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
CanvasUpdated 1
The CanvasUpdated method is called to notify your part that a canvas that it
owns has been updated and that its contents need to be copied to its root
canvas.
void CanvasUpdated (XMPCanvas* canvas);
canvas A reference to the canvas that has been updated.
DESCRIPTION
When a canvas is updated, it notifies its owning part to copy its contents over
to its own canvas. This method is called by the owning part’s facet object when
copying from an offscreen canvas.
The data must be copied from an off-screen canvas, transformed, and then
placed in the containing canvas.
ChangeKind 1
The ChangeKind method is called to ask your part to change its content to a
new kind.
void ChangeKind (XMPType kind);
kind The new kind for the part.
DESCRIPTION
This method is called to ask for a change in the kind of content that is specified;
for instance, it might ask an ASCII Text part to change into a Styled Text part.
Your part should begin using the given part kind as its primary part kind if it is
supported. The first type of the first value in the content property of your part's
storage unit should become the given part kind. When it reads in subsequent
data, your part uses this representation.
C H A P T E R 1
The Class XMPPart
XMPPart 17
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
EXCEPTIONS
kXMPErrInvalidKind Part does not support that kind of content.
CloneInto 1
The CloneInto method is called to ask your part to write its data into the
specified storage unit.
void CloneInto (XMPDraftKey key,
XMPStorageUnit* storageUnit,
XMPStorageUnit* initiatingFrame);
key The draft key identifying the clone transaction.
storageUnit
A reference to the destination storage unit.
initiatingFrame
A reference to the frame that is initiating this transaction.
DESCRIPTION
This method is generally called by the frame object’s CloneTo method, when
requesting that the specified data be copied to the specified storage unit. This
would typically in an event such as a clipboard event. The actual copying may
not be completed until after EndClone is finished.
CloseDisplayFrame 1
The CloseDisplayFrame method is called to inform your part that one of its
display frames is closing.
void CloseDisplayFrame (XMPFrame* frame);
frame A reference to the frame that is to be closed.
C H A P T E R 1
The Class XMPPart
18 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
DESCRIPTION
This method is called by the frame object when the specified frame is being
removed from a draft.
Your part should remove the specified frame from its list of display frames, by
calling that frame’s Close method on any frames that are embedded within
that frame, and then releasing the frame.
EXCEPTIONS
kXMPErrInvalidFrame The specified frame is not a display frame of this
part.
CommitRelinquishFocus 1
The CommitRelinquishFocus method is called to ask your part to complete
the process of relinquishing the ownership of the specified focus that was
inititated in your part’s BeginRelinquishFocus method.
void CommitRelinquishFocus (XMPTypeToken focus,
XMPFrame* ownerFrame,
XMPFrame* proposedFrame);
focus The focus type that is being relinquished.
ownerFrame A reference to your part's frame that possesses the focus.
proposedFrame
A reference to the frame belonging to the other part that has
requested the focus.
DESCRIPTION
This method is called by the arbitrator object when a transfer of ownership of
the specified focus is requested.
In the process of relinquishing ownership of the specified focus, your part
should release whatever external resources are associated with that focus.
C H A P T E R 1
The Class XMPPart
XMPPart 19
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
Before calling this method, the caler should have previously called the
BeginRelinquishFocus method.
EXCEPTIONS
kXMPErrInvalidFocus Part doesn't own this focus.
kXMPErrNotPrepared Part hasn't prepared to relinquish focus.
kXMPErrInvalidFrame The specified ownerFrame is not a display frame
of this part.
ContainingPartPropertiesChanged 1
The ContainingPartPropertiesChanged method is called to inform your
part of changes to the content properties of the containing part that should be
reflected, if possible, in your part’s embedded frame.
void ContainingPartPropertiesChanged
(XMPFrame* frame,
XMPStorageUnit* propertyUnit);
frame A reference to the frame whose content model should change.
propertyUnit
A reference to the property unit that contains the changed
content properties.
DESCRIPTION
This method is used by your part’s containing part.
It should inspect the specified property unit for properties that your part can
understand. Where applicable, it incorporate those properties into your part's
content data. It ignores inapplicable properties, without signalling an error.
C H A P T E R 1
The Class XMPPart
20 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
CreateEmbeddedFramesIterator 1
The CreateEmbeddedFramesIterator method is called to ask your part to
create an object that will iterate over the frames that are embedded within a
display frame of this part.
XMPEmbeddedFramesIterator* CreateEmbeddedFramesIterator
(XMPFrame* frame);
frame A reference to the display frame of your part that contains the
embedded frames to iterate over.
return value A reference to the embedded frames iterator to use. The caller
must delete the iterator when finished using it.
DESCRIPTION
To indicate all the display frames, the caller uses kXMPNull for the frame
parameter.
EXCEPTIONS
kXMPErrOutOfMemory Not enough memory to allocate iterator.
kXMPErrCannotEmbed This part does not support embedding.
CreateLink 1
The CreateLink method is called to ask your part to create a new link object.
XMPLink* CreateLink (XMPPtr data,
XMPULong size);
data A pointer to a description of the content data to link to, as stored
by your part in a link spec. ***Did the part store this data prior
to this call being made?***
size Size of the data in bytes.
C H A P T E R 1
The Class XMPPart
XMPPart 21
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
return value The link object to be used by the caler to represent the data.
DESCRIPTION
If a link already exists to the content identified by the data and size arguments,
this method should return the existing link object; otherwise, it should create a
new link object, and return it to the caller.
This method identifies the content to be linked (by resolving the object specifier
saved in the data parameter, or by some other means). It then creates a link
object to represent the content data. Your part must maintain information about
what portions of its content have links to them, so that it may notify link clients
when that data has been changed. Before calling this method, the caller must
ensure that the data identifies some portion of your part's contents. After this
method executes successfully, your part maintains a link to the identified
content.
EXCEPTIONS
kXMPErrCantLink Part does not support linking protocol.
kXMPErrInvalidLinkData
Could not identify content for link.
kXMPErrOutOfMemory There is not enough memory to allocate link
object.
DisposeActionState 1
The DisposeActionState method is called to tell your part to dispose of the
undo action data.
void DisposeActionState (XMPActionData actionState,
XMPDoneState doneState);
actionState
Information previously logged by your part to allow it to undo
the action.
C H A P T E R 1
The Class XMPPart
22 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
doneState State of the undo action. It is kDone or kReDone if the action
was on the document's Undo stack, and kUndone if it was on
the Redo stack.
DESCRIPTION
***Who call this method, when, and why?*** Before calling this method, you
must ensure that the specified action state is an action data block previously
logged by your part. After this method executes successfully, memory for the
action state has been reclaimed, and is no longer usable for undo operations.
EXCEPTIONS
kXMPErrInvalidUndo Not an undo action of this part.
DragEnter 1
The DragEnter method is called to activate your part for tracking a drag
operation.
void DragEnter (XMPDragItemIterator* dragInfo,
XMPFacet* facet,
XMPPoint where);
dragInfo A reference to the drag item iterator describing the contents, as
well as the types and values of the dragged data.
facet A reference to the facet of the part that the drag has entered into.
where The location of the drag point, expressed in frame coordinates.
DESCRIPTION
This method is called by the facet object when it has been notified that the drag
point has entered it.
It should display a drag target border within the facet. During drag tracking
(DragEnter, DragWithin) the part should never attempt to read data from
C H A P T E R 1
The Class XMPPart
XMPPart 23
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
any of the storage units supplied by the iterator. The part should only inspect
the type of the dragged data. Before calling this method, the caller must ensure
that your part is ready to receive DragWithin messages. This is determined
by calling the frame object’s isDroppable method.
DragLeave 1
The DragLeave method is called to notify your part that the drag operation is
complete, and your part can deactivate itself from drag tracking.
void DragLeave (XMPFacet* facet,
XMPPoint where);
facet A reference to the facet of the part that the drag point is in.
where The location of the drag point, expressed in frame coordinates.
DESCRIPTION
This method is called by the facet object when it has been notified that the drag
point has left it.
This method should un-highlight any content previously highlighted during
drag tracking. It should also remove the drag target border.Before calling this
method you must ensure that the part was previously activated via
DragEnter().After executing tis method successfully, the part is no longer
active, and cannot receive further DragWithin() or Drop() messages.
EXCEPTIONS
kXMPErrNotDragging Part has not received a DragEnter call.
C H A P T E R 1
The Class XMPPart
24 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
DragWithin 1
The DragWithin method is called to ask your part to track the drag operation,
and provide graphical feedback regarding possible drop targets.
void DragWithin (XMPDragItemIterator* dragInfo,
XMPFacet* facet,
XMPPoint where);
dragInfo A reference to the drag item iterator describing the contents, as
well as the types and values of the dragged data.
facet A reference to the facet of the part that the drag is in.
where The location of the drag point, expressed in frame coordinates.
DESCRIPTION
This method is called by the facet object when it has been notified that the drag
point is within the borders of the facet’s frame.
This method should highlight the appropriate content to provide user feedback
about potential drop targets, based on type of dragged data. It gets the type
information out of the dragInfo. During drag tracking (DragEnter,
DragWithin) the part should never attempt to read data from any of the
storage units supplied by the iterator. The part should only inspect the type of
the dragged data. Before calling this method, the caller must ensure that your
part was previously activated via DragEnter().
EXCEPTIONS
kXMPErrNotDragging Part has not received a DragEnter call.
C H A P T E R 1
The Class XMPPart
XMPPart 25
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
Draw 1
The Draw method is called to ask your part to draw itself in the specified facet.
void Draw (XMPFacet* facet,
XMPShape* invalidShape);
facet A reference to the facet in which to draw the part.
invalidShape
A reference to the portion of the facet to update, expressed in
frame coordinates.
DESCRIPTION
This method is called by the facet object, when updating is required. It makes
the actual, platform-specific drawing calls.
The part should draw itself on the facet's canvas, updating the portion of the
facet in the specified invalid shape. The part must examine its canvas'
isDynamic flag to determine if it will be drawing on the screen or to a printer,
and then draw itself appropriately.
***Does this method make the actual, platform-specific drawing calls?***
EXCEPTIONS
kXMPErrInvalidFrame frame isn't one of the part's display frames.
Drop 1
The Drop method is called to ask your part to transfer the dragged data to
itself.
XMPDropResult Drop (XMPDragItemIterator* dropInfo,
XMPFacet* facet,
XMPPoint where);
C H A P T E R 1
The Class XMPPart
26 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
dropInfo A reference to the drag item iterator describing the contents, and
types and values of the dragged data.
facet A reference to the facet of the part that the drag point is in.
where The location of the drag point, expressed in frame coordinates.
return value The location of the drop point, expressed in frame coordinates.
DESCRIPTION
This method is called by the facet object, when data must be moved or copied.
It should respond to the Drop request. This might involve moving or copying
data in to the part, or some other response entirely. However, the response
should use the data supplied by the dropInfo iterator to perform the
operation. Before calling this method, the caller must ensure that your part was
previously activated using the DragEnter method.
EXCEPTIONS
kXMPErrNotDragging Part hasn't received a DragEnter message.
DropCompleted 1
The DropCompleted method is called to notify your part that the drop is
completed.
void DropCompleted (XMPPart* destPart,
XMPDropResult dropResult);
destPart A reference to the part where the drop is to be completed.
dropResult The result code of the drop operation.
DESCRIPTION
This method is called by the drag and drop object at the end of an
asynchronous drag operation only.
C H A P T E R 1
The Class XMPPart
XMPPart 27
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
If the drag and drop object’s StartDrag method is synchronous, the return
code to its this method is the drop result. Your part’s DropCompleted method
does not need to be called. However, if it is required that drag and drop object’s
StartDrag method returns immediately, there needs to be a way to notify the
result of the drop.
Before calling this method, the caller must ensure that your part previously
started an asynchronous drag.
EmbeddedFrameChanged 1
The EmbeddedFrameChanged method is called to notify your part that the
content of one of its embedded frames has changed.
void EmbeddedFrameChanged (XMPFrame* frame,
XMPChangeID change);
frame A reference to the embedded frame whose contents have
changed.
change A unique change ID. ***What exactly is this unique change
ID?***
DESCRIPTION
This method is called by a frame belonging to an embedded part when the
frame object's ContentChanged method is called. ***When does this occur?
When is it called?***
The embedded part should call the ContentChanged method of any of its
frames that would be interested in this information. This part is not responsible
for passing this notification on to its containing part. It may ignore this
notification if it is uninterested in changes to embedded content. The
embedded part should wait a certain length of time (a second perhaps) before
updating its display so that subsequent calls to the EmbeddedFrameChanged
method don’t result in multiple updates for the same change.
C H A P T E R 1
The Class XMPPart
28 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
EmbeddedFrameSpec 1
The EmbeddedFrameSpec method is called to ask your part to create an object
specifier for an embedded frame.
void EmbeddedFrameSpec (XMPFrame* embeddedFrame,
XMPObjectSpec* spec);
embeddedFrame
A pointer to an object specifier structure. On return, it contains
the frame the caller wants a specifier for.
spec A reference to the frame's specifier.
DESCRIPTION
***Who calls this method, why, and when? What does this method do, to
create a specifier?***
If your part is itself embedded, this method should ask your part’s containing
part for the specifier for your part's display frame, then concatenate the
specifier for the embedded frame. ***What if its not an embedded frame?***
EXCEPTIONS
kXMPErrInvalidFrame embeddedFrame is not an embedded frame of
this part.
ExternalizeKinds 1
The ExternalizeKinds method is called to ask your part to write to storage
a representation for each part kind, out of a supported list, that it supports.
void ExternalizeKinds (XMPTypeList* kindlist);
kindlist A reference to the set of kinds the part should write.
C H A P T E R 1
The Class XMPPart
XMPPart 29
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
DESCRIPTION
***Who calls this method, why, and when?***
Your part should iterate through all the kinds in the specified kind list, and
write out a representation for each that it supports. This call does not specify
anything about the ordering of those kinds in the contents property.
Before calling this method, the caller must ensure that the part supports a
subset of the kinds in the specified kind list. After executing this method
successfully, the contents property of the part has a value and representation
for each part kind in the list that it supports.
FacetAdded 1
The FacetAdded method is called to notify your part that a facet has been
added to one of its display frames.
void FacetAdded (XMPFacet* facet);
facet A reference to the facet that has been added.
DESCRIPTION
This method is called by an embedded frame of your part, after that frame’s
facet has called it’s CreateEmbeddedFacet method.
If your part does not display asynchronously and is a simple part (not a
containing part), it doesn't need to do anything in response to this call. If your
part displays asynchronously, it must make sure to draw in the new facet as
well. If the part has embedded frames, it must create facets for them, using
those embedded frames’ CreateEmbeddedFacet method.
C H A P T E R 1
The Class XMPPart
30 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
FacetRemoved 1
The FacetRemoved method is called to notify your part that a facet has been
removed from one of its display frames.
void FacetRemoved (XMPFacet* facet);
facet A reference to the facet that is being removed.
DESCRIPTION
This method is called by an embedded frame of your part, after that frame’s
facet has called it’s RemoveFacet method.
If your part does not display asynchronously and isn’t a containing part, it
doesn't need to do anything in response to this call. If your part displays
asynchronously, it must stop drawing in the facet. If your part has embedded
frames, it must remove their facets as well, using the RemoveFacet method of
those frames’ facets.
EXCEPTIONS
kXMPErrInvalidFacet The specified facet is not a facet of this part.
FocusAcquired 1
The FocusAcquired method is called to notify your part that one of its
frames has acquired the specified focus.
void FocusAcquired (XMPTypeToken focus,
XMPFrame* ownerFrame);
focus A tokenized string representing the focus type to acquire.
ownerFrame A reference to the frame that has acquired the focus.
C H A P T E R 1
The Class XMPPart
XMPPart 31
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
DESCRIPTION
The frame object call this method when it needs to notify your part that the
ownership of a focus has been transferred.
This method may be called when a document is opened, for example.
It should make whatever response is necessary for having acquired the focus.
For instance, acquiring the selection focus might cause a part to highlight its
text selection.
EXCEPTIONS
kXMPErrInvalidFocus Part cannot own this focus.
kXMPErrInvalidFrame The specified ownerFrame is not a display frame
of this part.
FocusLost 1
The FocusLost method is called to notify your part that a focus has
unexpectedly been lost.
void FocusLost (XMPTypeToken focus,
XMPFrame* ownerFrame);
focus The focus that was lost.
ownerFrame A reference to the frame from which the focus was lost.
DESCRIPTION
This method should take whatever actions are necessary to recover from
having lost the focus, i.e. close connections, de-highlight selection, etc. These
foci can be lost by such events as the disconnection of a serial port, or when a
network has been unexpectedly partitioned.
EXCEPTIONS
kXMPErrInvalidFocus Part doesn't own this focus.
C H A P T E R 1
The Class XMPPart
32 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
kXMPErrInvalidFrame The specified ownerFrame is not a display frame
of this part.
FrameShapeChanged 1
The FrameShapeChanged method is called to notify your part that the
containing part has changed the frame shape of one of your part’s display
frames.
void FrameShapeChanged (XMPFrame* frame);
frame A reference to the frame that is being reshaped.
DESCRIPTION
This method is called by the enclosing frame’s ChangeFrameShape method. It
should take whatever actions are necessary to respond to the new shape. It
may need to re-layout its content, change its used shape, resize its embedded
frames, or something else. It also has the option of turning around and asking
the frame for a different frame shape via RequestFrameShape, though it
must be able to handle the shape it is given. If the size of the frame is not
sufficient, your part may ask the containing part for a continuation frame via
CreatEmbeddedFrame.
EXCEPTIONS
kXMPErrInvalidFrame The specified frame is not a display frame of this
part.
FulfillPromise 1
The FulfillPromise method is called to ask your part to fulfill a previously
made promise by providing the actual data the promise represents.
void FulfillPromise (XMPStorageUnitView *promiseSUView);
C H A P T E R 1
The Class XMPPart
XMPPart 33
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
promiseSUView
A reference to a view into the storage unit that contains the
promise value.
DESCRIPTION
Data transfer classes such as drag and drop and the clipboard often delay the
handling of data transfers until the session dictates that they must be made. In
such cases, requests for these data transfers are logged as promises that are
fulfilled only when these transfers are ultimately required.
The promiseSUView is a view into the same storage unit value that is created
by SetPromiseValue. The information about the promise is encoded in the
promiseSUView in your part handler's own internal format. The promise data
is written into the promiseSUView replacing the data stored in the part
handler's format.
When the promise was made, a record of it was kept by this part. The
promiseSUView contains the part's information for that promise. The part
uses the data in the promiseSUView to determine which data to move/copy.
The part then writes the data into the promiseSUView.
EXCEPTIONS
kXMPErrInvalidPromise The part did not make this promise.
GeometryChanged 1
The GeometryChanged method is called to inform your part that the clipping
shape and/or external transform of one of its facets has changed.
void GeometryChanged (XMPFacet* facet);
facet A reference to the facet where the clip shape has changed.
DESCRIPTION
This method is called by the facet object.
C H A P T E R 1
The Class XMPPart
34 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
Your part should use the new clip shape for display from now on. If your part
displays only in response to update events you don't need to do anything
special, provided you check the clip shape each time you draw. If your part
displays asynchronously (like clocks, movies, etc.) you must notice the new
clipping and limit your display accordingly.
EXCEPTIONS
kXMPErrInvalidFacet The specified facet is not a facet of this part.
GetContainingPartProperties 1
The GetContainingPartProperties method is called to ask you part for
the properties it associates with an embedded frame.
XMPStorageUnit* GetContainingPartProperties
(XMPFrame* frame);
frame A reference to an embedded frame of this part.
return value A storage unit containing the container properties for the
specified frame. The caller has responsibility for deallocating
storage.
DESCRIPTION
This method is called by an embedded part to create a storage unit and write
properties that the containing part associates with the embedded frame into it,
before returning it.
EXCEPTIONS
kXMPErrCannotEmbed This part does not support embedding.
kXMPErrInvalidFrame The specified frame is not an embedded frame of
this part.
C H A P T E R 1
The Class XMPPart
XMPPart 35
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
GetPrintResolution 1
The GetPrintResolution method is called to ask your part for the
minimum desired resolution in dots per inch required for printing the contents
of a specified frame.
XMPULong GetPrintResolution (XMPFrame* frame);
frame A reference to the frame for which the resolution is needed.
return value The minimum desired resolution in dots per inch.
DESCRIPTION
This method is called by the part object or the application and is used in
performing printing.
EXCEPTIONS
kXMPErrInvalidFrame The specified frame is not a display frame of this
part.
HandleEvent 1
The HandleEvent method is called to give your part the opportunity to
handle a specified user-interface event.
XMPBoolean HandleEvent (XMPEventData event,
XMPFrame* frame,
XMPFacet* facet);
event The user-interface event in question.
frame A reference to the frame in which the event occurred.
facet A reference to the facet in which the event occurred. kXMPNull
is passed for events not based on geometry, such as keyboard
events.
C H A P T E R 1
The Class XMPPart
36 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
return value Returns a Boolean specifying whether the part was able to
handle the event.
DESCRIPTION
This method is called by the dispatcher object when an event occurs. These
events are wrappers for platform-specific event data.
EXCEPTIONS
kXMPErrInvalidFrame The specified frame is not a display frame of this
part.
kXMPErrInvalidFacet The specified facet is not a facet of this part.
HighlightChanged 1
The HighlightChanged methodis called to notify your part that the highlight
state of one of its facets has been changed.
void HighlightChanged (XMPFacet* facet);
facet A reference to a facet of the part.
DESCRIPTION
This method is called by the facet’s owner frame. It should adjust your part's
presentation in the facet to its new highlight state. The new state may be found
by calling the facet’s GetHighlight method.
EXCEPTIONS
kXMPErrInvalidFrame The specified facet is not a facet of this part.
C H A P T E R 1
The Class XMPPart
XMPPart 37
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
InitPart 1
The InitPart method is called to allow your part to initialize itself.
void InitPart (XMPStorageUnit* storageUnit);
storageUnit
A reference to the specified storage unit.
DESCRIPTION
This method is called by the draft object the first time this part is instantiated
from persistent storage. This method is called after the draft object’s
CreatePart method has been called.
InitPartFromStorage 1
The InitPartFromStorage method is called to allow your part to initialize
itself from stored data.
void InitPartFromStorage (XMPStorageUnit* storageUnit);
storageUnit
A reference to the specified storage unit.
DESCRIPTION
This method is called by the draft object on all subsequent occasions that this
part is requested from persistent storage. This method differs from the
InitPart method in that it is called after the draft object’s GetPart method
has been called.
C H A P T E R 1
The Class XMPPart
38 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
LinkStatusChanged 1
The LinkStatusChanged method is called to allow your part to set the link
status of any embedded frame.
void LinkStatusChanged (XMPFrame* frame);
frame A reference to a frame whose link status is to be changed.
DESCRIPTION
This method is called by a part's frame when that frame's ChangeLinkStatus
method is called. Frames notify their owner parts that their link status has
changed whenever ChangeLinkStatus is called. After this method executes
successfully, the part will call ChangeLinkStatus on any embedded frames
that are involved in the link in question. ***What exactly is link status?***
LinkUpdated 1
The LinkUpdated method is called to pass an updated link object to your part.
void LinkUpdated (XMPLink* updatedLink,
XMPChangeID id);
updatedLink
A reference to the link that was changed.
id The change id that is associated with the link
DESCRIPTION
This method retrieves the data from the link and incorporates it into this part at
the link's destination, thereby replacing any previous content of the link.
EXCEPTIONS
kXMPErrInvalidLink This isn't one of the part's links.
C H A P T E R 1
The Class XMPPart
XMPPart 39
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
MouseEnter 1
The MouseEnter method is called to notify your part that the user has moved
into the area of a display frame of your part (mouse button up).
void MouseEnter (XMPFacet* facet,
XMPPoint where);
facet A reference to the facet into which the cursor has moved.
where The cursor location, in frame coordinates.
DESCRIPTION
This method is called by the dispatcher object when the mouse moves in. It will
typically change the display of the cursor.
EXCEPTIONS
kXMPErrInvalidFacet The specified facet is not a facet of this part.
MouseLeave 1
The MouseLeave method is calledto notify your part that the cursor has
moved out of the area of a display frame of your part (mouse button up).
void MouseLeave (XMPFacet* facet);
facet A reference to the facet that the cursor has left.
DESCRIPTION
This method is called by the dispatcher object, when the mouse is moved.
C H A P T E R 1
The Class XMPPart
40 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
EXCEPTIONS
kXMPErrInvalidFacet The specified facet is not a facet of this part.
MouseWithin 1
The MouseWithin method is called to notify your part that the cursor has
moved within the area of a display frame of your part (mouse button up).
void MouseWithin (XMPFacet* facet,
XMPPoint where);
facet A reference to the facet in which the cursor has moved.
where The cursor location in frame coordinates.
DESCRIPTION
This method is called by the dispatcher object for as long as movement
continues.
EXCEPTIONS
kXMPErrInvalidFacet The specified facet is not a facet of this part.
Open 1
The Open method is called to ask your part to create and open a presentation of
itself as the root frame in a new window.
XMPID Open (XMPFrame* frame);
frame A reference to a frame whose presentation should be used as a
model for the new presentation. kXMPNull means that your
part should create a new frame and open it in the window.
return value A unique id for the new window.
C H A P T E R 1
The Class XMPPart
XMPPart 41
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
DESCRIPTION
This method adds this part as the root part of the window. It bases the
presentation in the new frame on the presentation in the old frame, or on a
default presentation if there is no old frame. It always creates a new frame. The
old frame part is passed in the same way as an icon as passed, its content will
be the same, whereas its display may be radically different.
EXCEPTIONS
kXMPErrInvalidFrame The specified frame isn't one of the part’s display
frames.
PresentationChanged 1
The PresentationChanged method is called to notify your part that the
presentation of one of its frames has been changed.
void PresentationChanged (XMPFrame* frame);
frame A reference to a display frame of this part.
DESCRIPTION
A frame’s presentation referes to how the content of that frame is displayed,
whereas the view type of a frame indicates what type of frame is being used.
This method is called by the ChangePresentation method of the frame
whose presentation has been changed. It should examine the new presentation
kind using the frame’s GetPresentation method . If your part does not
support that kind of presentation, it should correct the frame's presentation
using the frame’s SetPresentation method. Your part should then adjust its
display in the display frame to be of the new presentation.
EXCEPTIONS
kXMPErrInvalidFrame The specified frame isn't one of the part’s display
frames.
C H A P T E R 1
The Class XMPPart
42 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
ReadActionState 1
The ReadActionState method is called to ask your part to read the undo
action data from a storage unit.
XMPPtr ReadActionState
(XMPStorageUnitView* storageUnitView);
storageUnitView
A reference to where to get the action data.
return value A pointer to information previously logged by your part in an
interaction with the undo object
DESCRIPTION
This method is called by the undo object when it is being internalized. The
undo object maintains its own storage unit. Information is logged by the undo
object, using its MarkActionHistory method.
This method should read the specified action state data from a view on a s
storage unit. It then allocates the memory and passes ownership of the storage
to the caller.
EXCEPTIONS
kXMPErrInvalidUndo Not an undo action of this part.
kXMPErrOutOfMemory Not enough memory to internalize data.
SEE ALSO
XMPStorageUnitView
C H A P T E R 1
The Class XMPPart
XMPPart 43
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
ReadPartInfo 1
The ReadPartInfo method is called to ask your part to read the part
information data for a display frame of your part from a storage unit.
XMPPtr ReadPartInfo (XMPFrame* frame,
XMPStorageUnitView* storageUnitView);
frame A reference to a display frame of your part.
storageUnitView
A reference to where to find the frame's part information storage
unit.
return value A pointer to the part information data.
DESCRIPTION
This method is called by the frame object when it needs to internalize part info.
The data for the partInfo is stored in a value in the frame's storage unit,
specified by the suView parameter. This method should get the data from the
storage unit, and place it in a block of memory. The method should then return
the memory block to the frame for it to hold so that the part can access it later.
EXCEPTIONS
kXMPErrInvalidFrame The specified frame is not a display frame of this
part.
kXMPErrOutOfMemory Not enough memory to allocate partInfo.
SEE ALSO
XMPStorageUnitView
C H A P T E R 1
The Class XMPPart
44 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
RedoAction 1
The RedoAction method is called to ask your part to redo a specified action.
void RedoAction (XMPActionData actionState);
actionState
Information previously logged by your part to allow it to redo
the action.
DESCRIPTION
This method is called by the undo object. The undo object maintains its own
storage unit in the form of a stack. Information is logged by the undo object,
using its MarkActionHistory method.
EXCEPTIONS
kXMPErrInvalidUndo Not an undo action of this part.
RemoveDisplayFrame 1
The RemoveDisplayFrame method is called to ask your part to remove a
specified frame from your part’s list of frames.
void RemoveDisplayFrame (XMPFrame* frame);
frame A reference to the display frame of your part.
DESCRIPTION
This method is called by the Remove method of the frame that is being
removed.
This method should make whatever other adjustments are necessary to deal
with removing a frame. This includes removing any frames embedded within
the specifiedframe.
C H A P T E R 1
The Class XMPPart
XMPPart 45
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
EXCEPTIONS
kXMPErrInvalidFrame The specified frame is not a display frame of this
part.
RemoveEmbeddedFrame 1
The RemoveEmbeddedFrame method is called to ask your part to remove a
frame of an embedded part.
void RemoveEmbeddedFrame (XMPFrame* embeddedFrame);
embeddedFrame
A reference to a specified embedded frame
DESCRIPTION
This method is called by an embedded part to ask a containing part to remove
an embedded frame. This indicates that it no longer needs the frame to display
itself.
EXCEPTIONS
kXMPErrCannotEmbed This part does not support embedding.
kXMPErrInvalidFrame The specified frame is not an embedded frame of
this part.
RequestEmbeddedFrame 1
The RequestEmbeddedFrame method is called to ask your part to create a
new frame and embed a part in it.
XMPFrame* RequestEmbeddedFrame
(XMPFrame* containingFrame,
XMPFrame* baseFrame,
C H A P T E R 1
The Class XMPPart
46 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
XMPShape* frameShape,
XMPPart* embedPart,
XMPTypeToken viewType,
XMPTypeToken presentation,
XMPBoolean isOverlaid);
containingFrame
The display frame of your part in which to embed the new
frame.
baseFrame A sibling frame of the frame to be created, also a display frame
of the embedded part.
frameShape The requested shape of the new frame. In the base frame's own
coordinate space.
embedPart The part to display in the embedded frame.
viewType View type for new frame.
presentation
Presentation for new frame.
isOverlaid Whether the new frame should float above the embedded part's
content. ***We need a definition of an overlaid frame, both
here and for the glossary.
return value A reference to the new frame.
DESCRIPTION
This method is only called by embedded parts that want additional frames in
which to display in the same containing part.
If your part is a containing part, it should ask the draft to create a new frame,
and embed the frame in its content. The new frame’s frame group and
sequence number are initialized based upon the base frame’s values.Your part
decides if it can fulfill the requests for the frame shape. If not, it can create the
frame where it wants and with the shape it chooses. If isOverlaid is true, the
new frame should float above the part's content, and should not have to
negotiate for space with the part. The view type and presentation are just
passed through to the draft object’s CreateFrame method.
C H A P T E R 1
The Class XMPPart
XMPPart 47
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
EXCEPTIONS
kXMPErrCannotEmbed
This part does not support embedding.
kXMPErrOutOfMemory
Not enough memory to embed a part.
RequestFrameShape 1
The RequestFrameShape method is called to ask your part for a change in
the shape of an embedded frame.
XMPShape* RequestFrameShape (XMPFrame* embeddedFrame,
XMPShape* frameShape);
embeddedFrame
A reference to an embedded frame of this part.
frameShape A reference to the requested shape, specified by the frame
coordinates of the embedded frame.
return value A reference to the shape that is to be changed.
DESCRIPTION
This method is called by the embedded frame’s RequestFrameShape method
This initiates a part-specific frame negotiation process. It should decide what
new shape to give the embedded frame, using the requested frame shape as a
guideline. A typical example of this method’s use would be to make a frame
larger. It should thenreturn the shape that is actually granted. The caller must
accept the returned shape, although it may make further requests for different
shapes or additional frames.
C H A P T E R 1
The Class XMPPart
48 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
RevealFrame 1
The RevealFrame method is called to ask your part to make an embedded
frame visible by scrolling it into view.
void RevealFrame (XMPFrame* embeddedFrame
XMPShape* revealShape);
embeddedFrame
A reference to an embedded frame of your part.
revealShape
A reference to a shape expressed in the coordinates of the
embedded frame. The parameter indicates the portion of the
frame that is be revealed.
DESCRIPTION
This method is called by an embedded part when that part needs to be made
visible, such as in conjunction with a keyboard event that requires an
undisplayed area in a scroll window. It should scroll one of your part's frames,
if necessary, to make the embedded frame visible. If your part’s frame is not
visible, this method should first ask the containing part to reveal it. If your part
has no frames, or if the containing frame can't reveal the display frame, this
method should open the frame in a new window.
EXCEPTIONS
kXMPErrInvalidFrame The specified frame is not an embedded frame of
this part.
RevealLink 1
The RevealLink method is called to ask your part to reveal data that was
linked in a frame, making it available for viewing in a frame.
void RevealLink (XMPLinkSource* linkSource);
C H A P T E R 1
The Class XMPPart
XMPPart 49
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
linkSource A reference to the linked content to reveal.
DESCRIPTION
This method is called by XMPLinkSource objects when a link source needs to
be shown. It should not be called by parts.
In the appropriate frame for this part, this method should select the content
linked by the link source argument, scroll it into view, and make it the active
frame. If your part has no display frame, or if your part's containing frame can't
reveal the frame, this method should open a frame in a new window.
EXCEPTIONS
kXMPErrInvalidLink This isn't one of the part's links.
SequenceChanged 1
The SequenceChanged method is called to inform your part that the
sequencing of a group of its frames has been changed.
void SequenceChanged (XMPFrame* frame);
frame A reference to the frame whose sequence has been re-ordered.
DESCRIPTION
This method is called by containing part when more than one frame is used for
viewing the same part. When this happens, the frames are assigned sequence
numbers that indicate the order of content display. If the content needs
reordering, then the sequence of these frames may aso need to be reordered,
and hence the sequence wll be changed.
The containing part of the specified frame calls this method when adding a
new frame to the group or re-ordering the frames in the group. A single frame
of the group is passed as an argument to indicate which group of which
containing frame has been changed. The method must readjust the pportioning
of its content to the display frames of that group.
C H A P T E R 1
The Class XMPPart
50 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
EXCEPTIONS
kXMPErrInvalidFrame The specified frame is not a display frame of
this part.
SEE ALSO
XMPFrame
UndoAction 1
The UndoAction method is called to tell your part to undo a previous action.
void UndoAction (XMPActionData actionState);
actionState
Information that allows it to undo the action.
DESCRIPTION
This method is called by the undo object to undo an action that has been stored
in the undo object’s storage unit using that object’s MarkActionHistory
method.
EXCEPTIONS
kXMPErrInvalidUndo Not an undo action of this part.
UsedShapeChanged 1
The UsedShapeChanged method is called to inform your part that the used
shape of one of its embedded frames has changed.
void UsedShapeChanged (XMPFrame* embeddedFrame);
C H A P T E R 1
The Class XMPPart
XMPPart 51
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
embeddedFrame
A reference to an embedded frame of your part.
DESCRIPTION
This method is called by the embedded frame’s ChangeUsedShape method to
notify a containing part that a used shape has changed its shape.
If your part arranges its content to conform to the used shape of an embedded
frame (as in text wrapping), this method can adjust the layout of that content
based on the new used shape.
EXCEPTIONS
kXMPErrInvalidFrame The specified embeddedFrame is not an
embeddedFrame of this part.
ViewTypeChanged 1
The ViewTypeChanged method is called to notify your part that the view type
of one of its embedded frames has been changed.
void ViewTypeChanged (XMPFrame* frame);
frame A reference to a display frame of your part.
DESCRIPTION
This method is called by the embedded frame’s ChangeViewType method,to
tell an embedded part that its frame’s view type has been changed.
Your part should examine the new view type using the frame’sGetViewType
method. It should then adjust its display in the display frame to be of the new
view type. If your part does not support that kind of view type, it should
correct the frame's view type using the frame’s SetViewType method. Note
that parts must support the standard set of view types (see HI spec).
C H A P T E R 1
The Class XMPPart
52 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
EXCEPTIONS
kXMPErrInvalidFrame The specified frame is not a display frame of this
part.
WriteActionState 1
The WriteActionState method is called to ask you part to write out the
specified action state data into a specified storage unit view object.
void WriteActionState(XMPPtr actionState,
XMPStorageUnitView* storageUnitView);
actionState
Information previously logged by the part to allow it to redo the
action.
storageUnitView
A reference to a storageUnitView location where the
actionState data is to be externalized.
DESCRIPTION
This method is called by the undo object when it is being externalized. The
undo object maintains its own storage unit.
EXCEPTIONS
kXMPErrInvalidUndo Not an undo action of this part.
SEE ALSO
XMPUndo, XMPStorageUnitView
C H A P T E R 1
The Class XMPPart
XMPPart 53
Draft. Preliminary. © Apple Computer, Inc. 5/19/97
WritePartInfo 1
The WritePartInfo method is called to ask your part to write the frame's
part information data into the frame's storage unit.
void WritePartInfo (XMPPtr partInfo,
XMPStorageUnitView* storageUnitView);
partInfo The part information data to write.
storageUnitView
A view onto a value of the frame's storage unit.
DESCRIPTION
This method is called by the frame object when it needs to internalize part info.
C H A P T E R 1
The Class XMPPart
54 XMPPart
Draft. Preliminary. © Apple Computer, Inc. 5/19/97

More Related Content

What's hot

What's hot (11)

Gui
GuiGui
Gui
 
LISP:Program structure in lisp
LISP:Program structure in lispLISP:Program structure in lisp
LISP:Program structure in lisp
 
Chapter 13.1.6
Chapter 13.1.6Chapter 13.1.6
Chapter 13.1.6
 
DAC training-batch -2020(PLSQL)
DAC training-batch -2020(PLSQL)DAC training-batch -2020(PLSQL)
DAC training-batch -2020(PLSQL)
 
Swing
SwingSwing
Swing
 
Jdbc
JdbcJdbc
Jdbc
 
GUI Programming in JAVA (Using Netbeans) - A Review
GUI Programming in JAVA (Using Netbeans) -  A ReviewGUI Programming in JAVA (Using Netbeans) -  A Review
GUI Programming in JAVA (Using Netbeans) - A Review
 
Vb6 ch.8-3 cci
Vb6 ch.8-3 cciVb6 ch.8-3 cci
Vb6 ch.8-3 cci
 
Java swing
Java swingJava swing
Java swing
 
Perfomatix - Android Coding Standards
Perfomatix - Android Coding StandardsPerfomatix - Android Coding Standards
Perfomatix - Android Coding Standards
 
Collaborate12 fce
Collaborate12 fceCollaborate12 fce
Collaborate12 fce
 

Viewers also liked

James_Begin_-_Sales_Associate for Linked-in account
James_Begin_-_Sales_Associate for Linked-in accountJames_Begin_-_Sales_Associate for Linked-in account
James_Begin_-_Sales_Associate for Linked-in accountJames Begin
 
Edición no. 03 abril de 2015
Edición no. 03 abril de 2015Edición no. 03 abril de 2015
Edición no. 03 abril de 2015polo diaz
 
Sales Manager Productivity maximizing presentation
Sales Manager Productivity maximizing presentationSales Manager Productivity maximizing presentation
Sales Manager Productivity maximizing presentationjoesesso
 
Alberta Investor Tax Credit
Alberta Investor Tax CreditAlberta Investor Tax Credit
Alberta Investor Tax CreditIqbal Ahmed
 
Promethean Bahamas Steam Support Initiative: Classflow
Promethean Bahamas Steam Support Initiative: ClassflowPromethean Bahamas Steam Support Initiative: Classflow
Promethean Bahamas Steam Support Initiative: ClassflowCaribbean Development Bank
 
XR1045 Operation Manual (AUS) Rev 01
XR1045 Operation Manual (AUS) Rev 01XR1045 Operation Manual (AUS) Rev 01
XR1045 Operation Manual (AUS) Rev 01A. Ovidiu "Ovy" Lungu
 
Fundraising Crashkurs für soziale Initiativen
Fundraising Crashkurs für soziale InitiativenFundraising Crashkurs für soziale Initiativen
Fundraising Crashkurs für soziale InitiativenLinda Kleemann
 
Una imagen vale mas que mil palabras
Una imagen vale mas que mil palabrasUna imagen vale mas que mil palabras
Una imagen vale mas que mil palabrasNeidaBenitez
 
Proyectos innovaciony estrategiapieunpasofirmehacia
Proyectos innovaciony estrategiapieunpasofirmehaciaProyectos innovaciony estrategiapieunpasofirmehacia
Proyectos innovaciony estrategiapieunpasofirmehaciaMCMurray
 

Viewers also liked (13)

Somnath City Plots For Booking-7503367689
Somnath City Plots For Booking-7503367689Somnath City Plots For Booking-7503367689
Somnath City Plots For Booking-7503367689
 
Musulmanhispanocordobes
MusulmanhispanocordobesMusulmanhispanocordobes
Musulmanhispanocordobes
 
James_Begin_-_Sales_Associate for Linked-in account
James_Begin_-_Sales_Associate for Linked-in accountJames_Begin_-_Sales_Associate for Linked-in account
James_Begin_-_Sales_Associate for Linked-in account
 
Edición no. 03 abril de 2015
Edición no. 03 abril de 2015Edición no. 03 abril de 2015
Edición no. 03 abril de 2015
 
Sales Manager Productivity maximizing presentation
Sales Manager Productivity maximizing presentationSales Manager Productivity maximizing presentation
Sales Manager Productivity maximizing presentation
 
Alberta Investor Tax Credit
Alberta Investor Tax CreditAlberta Investor Tax Credit
Alberta Investor Tax Credit
 
my cv
my cvmy cv
my cv
 
Promethean Bahamas Steam Support Initiative: Classflow
Promethean Bahamas Steam Support Initiative: ClassflowPromethean Bahamas Steam Support Initiative: Classflow
Promethean Bahamas Steam Support Initiative: Classflow
 
XR1045 Operation Manual (AUS) Rev 01
XR1045 Operation Manual (AUS) Rev 01XR1045 Operation Manual (AUS) Rev 01
XR1045 Operation Manual (AUS) Rev 01
 
Fundraising Crashkurs für soziale Initiativen
Fundraising Crashkurs für soziale InitiativenFundraising Crashkurs für soziale Initiativen
Fundraising Crashkurs für soziale Initiativen
 
Una imagen vale mas que mil palabras
Una imagen vale mas que mil palabrasUna imagen vale mas que mil palabras
Una imagen vale mas que mil palabras
 
Ciberespacio- Sitio Web 2.0 - SCJ
Ciberespacio- Sitio Web 2.0 - SCJCiberespacio- Sitio Web 2.0 - SCJ
Ciberespacio- Sitio Web 2.0 - SCJ
 
Proyectos innovaciony estrategiapieunpasofirmehacia
Proyectos innovaciony estrategiapieunpasofirmehaciaProyectos innovaciony estrategiapieunpasofirmehacia
Proyectos innovaciony estrategiapieunpasofirmehacia
 

Similar to XMPPart5

User and group security migration
User and group security migrationUser and group security migration
User and group security migrationAmit Sharma
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migrationAmit Sharma
 
Force.com migration utility
Force.com migration utilityForce.com migration utility
Force.com migration utilityAmit Sharma
 
Force.com migration utility
Force.com migration utilityForce.com migration utility
Force.com migration utilityAmit Sharma
 
Programming Without Coding Technology (PWCT) Environment
Programming Without Coding Technology (PWCT) EnvironmentProgramming Without Coding Technology (PWCT) Environment
Programming Without Coding Technology (PWCT) EnvironmentMahmoud Samir Fayed
 
RomaFramework Tutorial Basics
RomaFramework Tutorial BasicsRomaFramework Tutorial Basics
RomaFramework Tutorial BasicsLuca Garulli
 
Serialization in .NET
Serialization in .NETSerialization in .NET
Serialization in .NETAbhi Arya
 
dylibencapsulation
dylibencapsulationdylibencapsulation
dylibencapsulationCole Herzog
 
Creating Custom Spark Components in Flex 4
Creating Custom Spark Components in Flex 4Creating Custom Spark Components in Flex 4
Creating Custom Spark Components in Flex 4Dan Orlando
 
ColdFusion Components
ColdFusion ComponentsColdFusion Components
ColdFusion Componentsjsmith
 
Flex4 Component Lifecycle
Flex4 Component LifecycleFlex4 Component Lifecycle
Flex4 Component LifecycleEffective
 
Flex4 Component Lifecycle
Flex4 Component LifecycleFlex4 Component Lifecycle
Flex4 Component LifecycleEffectiveUI
 
P Training Presentation
P Training PresentationP Training Presentation
P Training PresentationGaurav Tyagi
 
Patterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxPatterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxdanhaley45372
 
Design Patterns
Design PatternsDesign Patterns
Design Patternsimedo.de
 

Similar to XMPPart5 (20)

User and group security migration
User and group security migrationUser and group security migration
User and group security migration
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migration
 
Force.com migration utility
Force.com migration utilityForce.com migration utility
Force.com migration utility
 
Force.com migration utility
Force.com migration utilityForce.com migration utility
Force.com migration utility
 
Programming Without Coding Technology (PWCT) Environment
Programming Without Coding Technology (PWCT) EnvironmentProgramming Without Coding Technology (PWCT) Environment
Programming Without Coding Technology (PWCT) Environment
 
RomaFramework Tutorial Basics
RomaFramework Tutorial BasicsRomaFramework Tutorial Basics
RomaFramework Tutorial Basics
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Serialization in .NET
Serialization in .NETSerialization in .NET
Serialization in .NET
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
dylibencapsulation
dylibencapsulationdylibencapsulation
dylibencapsulation
 
Creating Custom Spark Components in Flex 4
Creating Custom Spark Components in Flex 4Creating Custom Spark Components in Flex 4
Creating Custom Spark Components in Flex 4
 
ColdFusion Components
ColdFusion ComponentsColdFusion Components
ColdFusion Components
 
Flex4 Component Lifecycle
Flex4 Component LifecycleFlex4 Component Lifecycle
Flex4 Component Lifecycle
 
Flex4 Component Lifecycle
Flex4 Component LifecycleFlex4 Component Lifecycle
Flex4 Component Lifecycle
 
Custom PrimeFaces components
Custom PrimeFaces componentsCustom PrimeFaces components
Custom PrimeFaces components
 
Adobe Flex4
Adobe Flex4 Adobe Flex4
Adobe Flex4
 
P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
 
Add on packages
Add on packagesAdd on packages
Add on packages
 
Patterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxPatterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docx
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 

XMPPart5

  • 1. C H A P T E R 1 The Class XMPPart 3 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 The Class XMPPart 1 This chapter describes the class XMPPart, which you must subclass to create a part handler. Note One recommended method for developing a part handler involves use of a part-handler framework, a set of classes that provide an intermediate step between your part handler’s code and the OpenDoc class library. Such a framework is not documented here, nor are any classes that your part handler might implement on its own, independent of or as wrappers to OpenDoc classes. This chapter, like the rest of this book, describes only the classes defined by OpenDoc itself. For information on using a framework to develop a part handler, see [documentation to come]. x
  • 2. C H A P T E R 1 The Class XMPPart 4 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 XMPPart 1 Superclasses XMPPersistentObject → XMPRefCntObject → XMPObject Subclasses none XMPPart is the abstract superclass from which you instantiate subclasses for implementation as part handlers. There can be no instances of XMPPart itself, but there will always be instantiations of its subclasses. XMPPart provides a template for the structure and behavior of parts. Each part in an OpenDoc document is represented by one instance of XMPPart. Description 1 Parts are the building blocks of an OpenDoc document. Each part object is an instantiation of XMPPart, and consists of a unit of the document’s content, accompanied by the code that manipulates it. Part content consists of data of a given structure or type. This data is represented by the instance variables for that instantiation of XMPPart. Instantiated part objects are separated by data format into part kinds and part categories, which represent various data formats, such as text, graphics, or video. To the end user, parts mostly represent the discrete screen areas in a document where one kind of content ends and where another kind begins. Documents may contain many different part kinds. The code that manipulates the part content is referred to as a part handler. Each part handler controls the behavior of one part kind. There are two kinds of part handlers: part editors and part viewers. A part editor can display and change the data contained in its part, whereas the part viewer can only display that data. Each part kind exhibits a unique behavior. This behavior is determined by the part handler. The behavior is unique because each part in an OpenDoc application represents an independent instantiation of a subclass of XMPPart. The unique behavior of each subclass of XMPPart is defined during the implementation of the methods of that subclass. Because the methods of XMPPart are pure virtual methods, they must be must be subclassed and
  • 3. C H A P T E R 1 The Class XMPPart XMPPart 5 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 implemented by all part handlers. One part handler supplies the behavior for all parts of a given part kind. Parts can embed other parts, although they possess little or no information regarding the data contained in the embedded parts. Every document possesses a single part that resides at its topmost level. This is referred to as the root part. All other parts in this document will be embedded in the root part, either directly or in parts that are themselves embedded in the root part. A part that contains other parts that are embedded within it is referred to as the containing part or embedding part. The root part, for instance, is the containing part for the entire document. Parts participate in many OpenDoc activities, and developers of part handlers must implement behavior for the part in all of them. XMPPart provides a base structure, on which you can construct the capability of your part handler. There are quite a few entry points into a part, but many of these are fairly simple to implement. Each part must maintain a list of all frames in which it is displayed. The representation of this list is hidden by the API, and you may choose whatever format works best for your implementation. A part that can embed other parts must maintain a list of all frames embedded within it. This list contains references to frames displaying all the parts embedded in the containing part. The representation of this list is hidden by the API, and you may choose whatever format works best for your implementation. Parts that support extensions, including a semantic interface, must manage the creation and deletion of their extension objects. For more information related to XMPPart, see the class descriptions for XMPFacet, XMPFrame, XMPShape, XMPCanvas, XMPStorageUnit, XMPTransform, and XMPLink. Methods 1 The methods of XMPPart are used for the activation and general manipulation of part objects. You must override all these methods. Initialization InitPart Called to allow your part to initialize itself.
  • 4. C H A P T E R 1 The Class XMPPart 6 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 InitPartFromStorage Called to allow your part to initialize itself from stored data. Part Manipulation AbortRelinquishFocus Called to cause your part to resume ownership of the focus. BeginRelinquishFocus Called to ask your part to give up ownership of a specified focus. ChangeKind Called to ask your part to change its content to a new kind. CloneInto Called to ask your part to write its data into the specified storage unit. CommitRelinquishFocus Called to ask your part to complete the process of relinquishing the ownership of the specified focus that was inititated in your part’s BeginRelinquishFocus method. ContainingPartPropertiesChanged Called to inform your part of changes to the content properties of the containing part that should be reflected, if possible, in your part’s embedded frame. FocusAcquired Called to notify your part that one of its frames has acquired the specified focus. FocusLost Called to notify your part that a focus has unexpectedly been lost. FulfillPromise Called to ask your part to fulfill a previously made promise by providing the actual data the promise represents. GetContainingPartProperties Called to ask you part for the properties it associates with an embedded frame. Open Called to ask your part to create and open a presentation of itself as the root frame in a new window.
  • 5. C H A P T E R 1 The Class XMPPart XMPPart 7 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 DragAndDrop DragEnter Called to activate your part for tracking a drag operation. DragLeave Called to notify your part that the drag operation is complete, and your part can deactivate itself from drag tracking. DragWithin Called to ask your part to track the drag operation, and provide graphical feedback regarding possible drop targets. Drop Called to ask your part to transfer the dragged data to itself. DropCompleted Called to notify your part that the drop is completed. Facet Manipulation ClipShapeChanged Called by a facet of the part to inform it that the clipping shape of that facet has changed. FacetAdded Called to notify your part that a facet has been added to one of its display frames. FacetRemoved Called to notify your part that a facet has been added to one of its display frames. Frame Manipulation AddDisplayFrame Called to tell your part to add the specified frame to its list of frames. AdjustBorderShape Called to adjust the shape of the active frame border of an embedded frame. AttachSourceFrame Called to associate a source frame with a display frame of a part. CloseDisplayFrame Called to inform your part that one of its display frames is closing. CreateEmbeddedFramesIterator Called to ask your part to create an object that will iterate over the frames that are embedded within a display frame of this part. EmbeddedFrameChanged Called to notify your part that the content of one of its embedded frames has changed.
  • 6. C H A P T E R 1 The Class XMPPart 8 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 EmbeddedFrameSpec Called to ask your part to create an object specifier for an embedded frame. FrameShapeChanged Called to notify your part that the containing part has changed the frame shape of one of your part’s display frames. GeometryChanged Called to inform your part that the clipping shape and/or external transform of one of its facets has changed. PresentationChanged Called to notify your part that the presentation of one of its frames has been changed. RemoveDisplayFrame Called to ask your part to remove a specified frame from your part’s list of frames. RemoveEmbeddedFrame Called to ask your part to remove a frame of an embedded part. RequestEmbeddedFrame Called to ask your part to create a new frame and embed a part in it. RequestFrameShape Called to ask your part for a change in the shape of an embedded frame. RevealFrame Called to ask your part to make an embedded frame visible by scrolling it into view. SequenceChanged Called to inform your part that the sequencing of a group of its frames has been changed. UsedShapeChanged Called to inform your part that the used shape of one of its embedded frames has changed. ViewTypeChanged Called to notify your part that the view type of one of its frames has been changed. Imaging CanvasChanged Called to notify your part that one of its facets has been moved to image on a different canvas. CanvasUpdated Called to notify your part that a canvas that it owns has been updated and that its contents need to be copied to its root canvas. Draw Called to ask your part to draw itself in the specified facet.
  • 7. C H A P T E R 1 The Class XMPPart XMPPart 9 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 GetPrintResolution Called to ask your part for the minimum desired resolution in dots per inch required for printing the contents of a specified frame. HighlightChanged Called to notify your part that the highlight state of one of its facets has been changed. Linking CreateLink Called to ask your part to create a new link object. LinkStatusChanged Called to allow your part to set the link status of any embedded frame. LinkUpdated Called to pass an updated link object to your part. RevealLink Called to ask your part to reveal data that was linked in a frame, making it available for viewing in a frame. User Iinterface Events AdjustMenus Called by the window state object to allow your part to adjust the presentation of its menus for display. HandleEvent Called to give your part the opportunity to handle a specified user-interface event. MouseEnter Called to notify your part that the user has moved into the area of a display frame of your part (mouse button up). MouseLeave Calledto notify your part that the cursor has moved out of the area of a display frame of your part (mouse button up). MouseWithin Called to notify your part that the cursor has moved within the area of a display frame of your part (mouse button up). UndoActions DisposeActionState Called to tell your part to dispose of the undo action data. RedoAction Called to ask your part to redo a specified action. UndoAction Called to tell your part to undo a previous action.
  • 8. C H A P T E R 1 The Class XMPPart 10 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 Reading and Writing ExternalizeKinds Called to ask your part to write to storage a representation for each part kind, out of a supported list, that it supports. ReadActionState Called to ask you part to read the undo action data from a storage unit. ReadPartInfo Called to ask your part to read the part information data for a display frame of your part from a storage unit. WriteActionState Called to ask you part to write out the specified action state data into a specified storage unit view object. WritePartInfo Called to ask your part to write the frame's part information data into the frame's storage unit. ***Where do you read/write partInfor data into a facet?*** Method Descriptions 1 AbortRelinquishFocus 1 The AbortRelinquishFocus method is called to cause your part to resume ownership of the focus. void AbortRelinquishFocus( XMPTypeToken focus, XMPFrame* ownerFrame, XMPFrame* proposedFrame); PARAMETERS focus A tokenized string representing the focus type that is being relinquished. ownerFrame A reference to the frame that currently possesses the focus.
  • 9. C H A P T E R 1 The Class XMPPart XMPPart 11 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 proposedFrame A reference to the frame of the part that has requested the focus. DESCRIPTION This method is called by the arbitrator object to cancel changes initiated by the BeginRelinquishFocus method. Your part must return itself to the state where it previously possessed the focus, before continuing use of that focus. Before calling this method, the caller must have previously called the part’s BeginRelinquishFocus method. EXCEPTIONS kXMPErrInvalidFocus Part doesn't own this focus. kXMPErrNotPrepared Part hasn't prepared to relinqush focus. kXMPErrInvalidFrame The specified owner frame is not a display frame of this part. AddDisplayFrame 1 The AddDisplayFrame method is called to tell your part to add the specified frame to its list of frames. void AddDisplayFrame (XMPFrame* frame); frame A reference to the new frame to add. DESCRIPTION This method is only called by frame objects during their initialization. The part must record the specified frame in whatever internal structures it uses to remember its display frames. The new frame will carry a suggested view type and presentation information. The part should look at those settings, and decide if it can support them; if not, it should update those settings in the frame to reflect a default presentation that it can support. Note that the part
  • 10. C H A P T E R 1 The Class XMPPart 12 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 must support the required set of standard view types (frame, icon, small icon, thumbnail, etc.). The part will then create the appropriate partInfo data and store it in the frame. This data allows the part to distinguish the frame from its other display frames, and is also a handy place to store other view-related information. AdjustBorderShape 1 The AdjustBorderShape method is called to adjust the shape of an embedded frame’s active border shape. XMPShape* AdjustBorderShape (XMPFrame* embeddedFrame, XMPShape* shape); embeddedFrame A reference to an embedded frame that is contained in your part, for which the border is being adjusted. shape A reference to the starting shape for the active border of the embedded frame. return value A reference to the shape to use for the active border, clipped by your part's content. DESCRIPTION This method is called by the arbitrator object. The shape parameter specifies the requested shape. The return value specifies that shape as it is obscured by the other contents of this part. EXCEPTIONS kXMPErrInvalidFrame The embeddedFrame is not an embeddedFrame of this part.
  • 11. C H A P T E R 1 The Class XMPPart XMPPart 13 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 AdjustMenus 1 The AdjustMenus method is called by the window state object to allow your part to adjust the presentation of its menus for display. void AdjustMenus (XMPFrame* frame); frame A reference to the display frame for which the menus need to be adjusted. DESCRIPTION This method is called by the window state object just prior to calling the MenuSelect or MenuKey methods. When this method is called your part should enable and disable menus as appropriate to its current state. EXCEPTIONS kXMPErrInvalidFrame The specified frame is not a display frame of this part. AttachSourceFrame 1 The AttachSourceFrame method is called to associate a source frame with a display frame of a part. void AttachSourceFrame (XMPFrame* frame, XMPFrame* sourceFrame); frame A reference to a display frame for this part. sourceFrame A reference to another display frame for this part.
  • 12. C H A P T E R 1 The Class XMPPart 14 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 DESCRIPTION The source frame is a display frame that is used for a source for a new display frame. This method is called by the part that requested creation of the frame, immediately after that frame’s creation. It tells the part to keep two or more of its display frames synchronized. A part will receive this call every time that a display frame has been added. Attaching a source frame should cause the display frame to look identical to it. If presentations differ, it causes the display frame to be equivalent to it. This causes duplication of the embedded frames, and ensures that the view in one frame is updated when content in the other is changed. Before calling this method, the caller must ensure that both the specified frame and source frame are registered frames belonging to your part. EXCEPTIONS kXMPErrInvalidFrame Either frame or sourceFrame is not a display frame of this part. BeginRelinquishFocus 1 The BeginRelinquishFocus method is called to ask your part to give up ownership of a specified focus. XMPBoolean BeginRelinquishFocus (XMPTypeToken focus, XMPFrame* ownerFrame, XMPFrame* proposedFrame); focus The focus type being relinquished. ownerFrame A reference to the part's frame that possesses the focus. proposedFrame A reference to the frame of belonging to the other part that has requested the focus. return value Returns a Boolean specifying whether the part can give up the requested focus; kXMPTrue if the focus is relinquished, otherwise kXMPFalse.
  • 13. C H A P T E R 1 The Class XMPPart XMPPart 15 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 DESCRIPTION This method is called by the arbitrator object. Upon receiving this call, your part decides if it can give up the requested focus. Each part will have part-specific requirements that need to be met before that part will relinquish a focus, if these requirements are met and it is determined that the part can relinquish focus, it prepares to relinquish the focus. It also ensures that, during the process of relinquishing the specified focus, and before the CommitRelinquishFocus method is called, it does not enter a state where the focus can't be given up. Before calling this method, the caller must ensure that your part owns the requested focus. EXCEPTIONS kXMPErrInvalidFocus Part doesn't own this focus. kXMPErrInvalidFrame The specified ownerFrame is not a display frame of this part. CanvasChanged 1 The CanvasChanged method is called to notify your part that one of its facets has been moved to image on a different canvas. void CanvasChanged (XMPFacet* facet); facet A reference to the facet that has a new canvas. DESCRIPTION This method is called by the facet object. Your part must update any internal state necessary for compliance with this method’s call.
  • 14. C H A P T E R 1 The Class XMPPart 16 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 CanvasUpdated 1 The CanvasUpdated method is called to notify your part that a canvas that it owns has been updated and that its contents need to be copied to its root canvas. void CanvasUpdated (XMPCanvas* canvas); canvas A reference to the canvas that has been updated. DESCRIPTION When a canvas is updated, it notifies its owning part to copy its contents over to its own canvas. This method is called by the owning part’s facet object when copying from an offscreen canvas. The data must be copied from an off-screen canvas, transformed, and then placed in the containing canvas. ChangeKind 1 The ChangeKind method is called to ask your part to change its content to a new kind. void ChangeKind (XMPType kind); kind The new kind for the part. DESCRIPTION This method is called to ask for a change in the kind of content that is specified; for instance, it might ask an ASCII Text part to change into a Styled Text part. Your part should begin using the given part kind as its primary part kind if it is supported. The first type of the first value in the content property of your part's storage unit should become the given part kind. When it reads in subsequent data, your part uses this representation.
  • 15. C H A P T E R 1 The Class XMPPart XMPPart 17 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 EXCEPTIONS kXMPErrInvalidKind Part does not support that kind of content. CloneInto 1 The CloneInto method is called to ask your part to write its data into the specified storage unit. void CloneInto (XMPDraftKey key, XMPStorageUnit* storageUnit, XMPStorageUnit* initiatingFrame); key The draft key identifying the clone transaction. storageUnit A reference to the destination storage unit. initiatingFrame A reference to the frame that is initiating this transaction. DESCRIPTION This method is generally called by the frame object’s CloneTo method, when requesting that the specified data be copied to the specified storage unit. This would typically in an event such as a clipboard event. The actual copying may not be completed until after EndClone is finished. CloseDisplayFrame 1 The CloseDisplayFrame method is called to inform your part that one of its display frames is closing. void CloseDisplayFrame (XMPFrame* frame); frame A reference to the frame that is to be closed.
  • 16. C H A P T E R 1 The Class XMPPart 18 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 DESCRIPTION This method is called by the frame object when the specified frame is being removed from a draft. Your part should remove the specified frame from its list of display frames, by calling that frame’s Close method on any frames that are embedded within that frame, and then releasing the frame. EXCEPTIONS kXMPErrInvalidFrame The specified frame is not a display frame of this part. CommitRelinquishFocus 1 The CommitRelinquishFocus method is called to ask your part to complete the process of relinquishing the ownership of the specified focus that was inititated in your part’s BeginRelinquishFocus method. void CommitRelinquishFocus (XMPTypeToken focus, XMPFrame* ownerFrame, XMPFrame* proposedFrame); focus The focus type that is being relinquished. ownerFrame A reference to your part's frame that possesses the focus. proposedFrame A reference to the frame belonging to the other part that has requested the focus. DESCRIPTION This method is called by the arbitrator object when a transfer of ownership of the specified focus is requested. In the process of relinquishing ownership of the specified focus, your part should release whatever external resources are associated with that focus.
  • 17. C H A P T E R 1 The Class XMPPart XMPPart 19 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 Before calling this method, the caler should have previously called the BeginRelinquishFocus method. EXCEPTIONS kXMPErrInvalidFocus Part doesn't own this focus. kXMPErrNotPrepared Part hasn't prepared to relinquish focus. kXMPErrInvalidFrame The specified ownerFrame is not a display frame of this part. ContainingPartPropertiesChanged 1 The ContainingPartPropertiesChanged method is called to inform your part of changes to the content properties of the containing part that should be reflected, if possible, in your part’s embedded frame. void ContainingPartPropertiesChanged (XMPFrame* frame, XMPStorageUnit* propertyUnit); frame A reference to the frame whose content model should change. propertyUnit A reference to the property unit that contains the changed content properties. DESCRIPTION This method is used by your part’s containing part. It should inspect the specified property unit for properties that your part can understand. Where applicable, it incorporate those properties into your part's content data. It ignores inapplicable properties, without signalling an error.
  • 18. C H A P T E R 1 The Class XMPPart 20 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 CreateEmbeddedFramesIterator 1 The CreateEmbeddedFramesIterator method is called to ask your part to create an object that will iterate over the frames that are embedded within a display frame of this part. XMPEmbeddedFramesIterator* CreateEmbeddedFramesIterator (XMPFrame* frame); frame A reference to the display frame of your part that contains the embedded frames to iterate over. return value A reference to the embedded frames iterator to use. The caller must delete the iterator when finished using it. DESCRIPTION To indicate all the display frames, the caller uses kXMPNull for the frame parameter. EXCEPTIONS kXMPErrOutOfMemory Not enough memory to allocate iterator. kXMPErrCannotEmbed This part does not support embedding. CreateLink 1 The CreateLink method is called to ask your part to create a new link object. XMPLink* CreateLink (XMPPtr data, XMPULong size); data A pointer to a description of the content data to link to, as stored by your part in a link spec. ***Did the part store this data prior to this call being made?*** size Size of the data in bytes.
  • 19. C H A P T E R 1 The Class XMPPart XMPPart 21 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 return value The link object to be used by the caler to represent the data. DESCRIPTION If a link already exists to the content identified by the data and size arguments, this method should return the existing link object; otherwise, it should create a new link object, and return it to the caller. This method identifies the content to be linked (by resolving the object specifier saved in the data parameter, or by some other means). It then creates a link object to represent the content data. Your part must maintain information about what portions of its content have links to them, so that it may notify link clients when that data has been changed. Before calling this method, the caller must ensure that the data identifies some portion of your part's contents. After this method executes successfully, your part maintains a link to the identified content. EXCEPTIONS kXMPErrCantLink Part does not support linking protocol. kXMPErrInvalidLinkData Could not identify content for link. kXMPErrOutOfMemory There is not enough memory to allocate link object. DisposeActionState 1 The DisposeActionState method is called to tell your part to dispose of the undo action data. void DisposeActionState (XMPActionData actionState, XMPDoneState doneState); actionState Information previously logged by your part to allow it to undo the action.
  • 20. C H A P T E R 1 The Class XMPPart 22 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 doneState State of the undo action. It is kDone or kReDone if the action was on the document's Undo stack, and kUndone if it was on the Redo stack. DESCRIPTION ***Who call this method, when, and why?*** Before calling this method, you must ensure that the specified action state is an action data block previously logged by your part. After this method executes successfully, memory for the action state has been reclaimed, and is no longer usable for undo operations. EXCEPTIONS kXMPErrInvalidUndo Not an undo action of this part. DragEnter 1 The DragEnter method is called to activate your part for tracking a drag operation. void DragEnter (XMPDragItemIterator* dragInfo, XMPFacet* facet, XMPPoint where); dragInfo A reference to the drag item iterator describing the contents, as well as the types and values of the dragged data. facet A reference to the facet of the part that the drag has entered into. where The location of the drag point, expressed in frame coordinates. DESCRIPTION This method is called by the facet object when it has been notified that the drag point has entered it. It should display a drag target border within the facet. During drag tracking (DragEnter, DragWithin) the part should never attempt to read data from
  • 21. C H A P T E R 1 The Class XMPPart XMPPart 23 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 any of the storage units supplied by the iterator. The part should only inspect the type of the dragged data. Before calling this method, the caller must ensure that your part is ready to receive DragWithin messages. This is determined by calling the frame object’s isDroppable method. DragLeave 1 The DragLeave method is called to notify your part that the drag operation is complete, and your part can deactivate itself from drag tracking. void DragLeave (XMPFacet* facet, XMPPoint where); facet A reference to the facet of the part that the drag point is in. where The location of the drag point, expressed in frame coordinates. DESCRIPTION This method is called by the facet object when it has been notified that the drag point has left it. This method should un-highlight any content previously highlighted during drag tracking. It should also remove the drag target border.Before calling this method you must ensure that the part was previously activated via DragEnter().After executing tis method successfully, the part is no longer active, and cannot receive further DragWithin() or Drop() messages. EXCEPTIONS kXMPErrNotDragging Part has not received a DragEnter call.
  • 22. C H A P T E R 1 The Class XMPPart 24 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 DragWithin 1 The DragWithin method is called to ask your part to track the drag operation, and provide graphical feedback regarding possible drop targets. void DragWithin (XMPDragItemIterator* dragInfo, XMPFacet* facet, XMPPoint where); dragInfo A reference to the drag item iterator describing the contents, as well as the types and values of the dragged data. facet A reference to the facet of the part that the drag is in. where The location of the drag point, expressed in frame coordinates. DESCRIPTION This method is called by the facet object when it has been notified that the drag point is within the borders of the facet’s frame. This method should highlight the appropriate content to provide user feedback about potential drop targets, based on type of dragged data. It gets the type information out of the dragInfo. During drag tracking (DragEnter, DragWithin) the part should never attempt to read data from any of the storage units supplied by the iterator. The part should only inspect the type of the dragged data. Before calling this method, the caller must ensure that your part was previously activated via DragEnter(). EXCEPTIONS kXMPErrNotDragging Part has not received a DragEnter call.
  • 23. C H A P T E R 1 The Class XMPPart XMPPart 25 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 Draw 1 The Draw method is called to ask your part to draw itself in the specified facet. void Draw (XMPFacet* facet, XMPShape* invalidShape); facet A reference to the facet in which to draw the part. invalidShape A reference to the portion of the facet to update, expressed in frame coordinates. DESCRIPTION This method is called by the facet object, when updating is required. It makes the actual, platform-specific drawing calls. The part should draw itself on the facet's canvas, updating the portion of the facet in the specified invalid shape. The part must examine its canvas' isDynamic flag to determine if it will be drawing on the screen or to a printer, and then draw itself appropriately. ***Does this method make the actual, platform-specific drawing calls?*** EXCEPTIONS kXMPErrInvalidFrame frame isn't one of the part's display frames. Drop 1 The Drop method is called to ask your part to transfer the dragged data to itself. XMPDropResult Drop (XMPDragItemIterator* dropInfo, XMPFacet* facet, XMPPoint where);
  • 24. C H A P T E R 1 The Class XMPPart 26 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 dropInfo A reference to the drag item iterator describing the contents, and types and values of the dragged data. facet A reference to the facet of the part that the drag point is in. where The location of the drag point, expressed in frame coordinates. return value The location of the drop point, expressed in frame coordinates. DESCRIPTION This method is called by the facet object, when data must be moved or copied. It should respond to the Drop request. This might involve moving or copying data in to the part, or some other response entirely. However, the response should use the data supplied by the dropInfo iterator to perform the operation. Before calling this method, the caller must ensure that your part was previously activated using the DragEnter method. EXCEPTIONS kXMPErrNotDragging Part hasn't received a DragEnter message. DropCompleted 1 The DropCompleted method is called to notify your part that the drop is completed. void DropCompleted (XMPPart* destPart, XMPDropResult dropResult); destPart A reference to the part where the drop is to be completed. dropResult The result code of the drop operation. DESCRIPTION This method is called by the drag and drop object at the end of an asynchronous drag operation only.
  • 25. C H A P T E R 1 The Class XMPPart XMPPart 27 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 If the drag and drop object’s StartDrag method is synchronous, the return code to its this method is the drop result. Your part’s DropCompleted method does not need to be called. However, if it is required that drag and drop object’s StartDrag method returns immediately, there needs to be a way to notify the result of the drop. Before calling this method, the caller must ensure that your part previously started an asynchronous drag. EmbeddedFrameChanged 1 The EmbeddedFrameChanged method is called to notify your part that the content of one of its embedded frames has changed. void EmbeddedFrameChanged (XMPFrame* frame, XMPChangeID change); frame A reference to the embedded frame whose contents have changed. change A unique change ID. ***What exactly is this unique change ID?*** DESCRIPTION This method is called by a frame belonging to an embedded part when the frame object's ContentChanged method is called. ***When does this occur? When is it called?*** The embedded part should call the ContentChanged method of any of its frames that would be interested in this information. This part is not responsible for passing this notification on to its containing part. It may ignore this notification if it is uninterested in changes to embedded content. The embedded part should wait a certain length of time (a second perhaps) before updating its display so that subsequent calls to the EmbeddedFrameChanged method don’t result in multiple updates for the same change.
  • 26. C H A P T E R 1 The Class XMPPart 28 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 EmbeddedFrameSpec 1 The EmbeddedFrameSpec method is called to ask your part to create an object specifier for an embedded frame. void EmbeddedFrameSpec (XMPFrame* embeddedFrame, XMPObjectSpec* spec); embeddedFrame A pointer to an object specifier structure. On return, it contains the frame the caller wants a specifier for. spec A reference to the frame's specifier. DESCRIPTION ***Who calls this method, why, and when? What does this method do, to create a specifier?*** If your part is itself embedded, this method should ask your part’s containing part for the specifier for your part's display frame, then concatenate the specifier for the embedded frame. ***What if its not an embedded frame?*** EXCEPTIONS kXMPErrInvalidFrame embeddedFrame is not an embedded frame of this part. ExternalizeKinds 1 The ExternalizeKinds method is called to ask your part to write to storage a representation for each part kind, out of a supported list, that it supports. void ExternalizeKinds (XMPTypeList* kindlist); kindlist A reference to the set of kinds the part should write.
  • 27. C H A P T E R 1 The Class XMPPart XMPPart 29 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 DESCRIPTION ***Who calls this method, why, and when?*** Your part should iterate through all the kinds in the specified kind list, and write out a representation for each that it supports. This call does not specify anything about the ordering of those kinds in the contents property. Before calling this method, the caller must ensure that the part supports a subset of the kinds in the specified kind list. After executing this method successfully, the contents property of the part has a value and representation for each part kind in the list that it supports. FacetAdded 1 The FacetAdded method is called to notify your part that a facet has been added to one of its display frames. void FacetAdded (XMPFacet* facet); facet A reference to the facet that has been added. DESCRIPTION This method is called by an embedded frame of your part, after that frame’s facet has called it’s CreateEmbeddedFacet method. If your part does not display asynchronously and is a simple part (not a containing part), it doesn't need to do anything in response to this call. If your part displays asynchronously, it must make sure to draw in the new facet as well. If the part has embedded frames, it must create facets for them, using those embedded frames’ CreateEmbeddedFacet method.
  • 28. C H A P T E R 1 The Class XMPPart 30 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 FacetRemoved 1 The FacetRemoved method is called to notify your part that a facet has been removed from one of its display frames. void FacetRemoved (XMPFacet* facet); facet A reference to the facet that is being removed. DESCRIPTION This method is called by an embedded frame of your part, after that frame’s facet has called it’s RemoveFacet method. If your part does not display asynchronously and isn’t a containing part, it doesn't need to do anything in response to this call. If your part displays asynchronously, it must stop drawing in the facet. If your part has embedded frames, it must remove their facets as well, using the RemoveFacet method of those frames’ facets. EXCEPTIONS kXMPErrInvalidFacet The specified facet is not a facet of this part. FocusAcquired 1 The FocusAcquired method is called to notify your part that one of its frames has acquired the specified focus. void FocusAcquired (XMPTypeToken focus, XMPFrame* ownerFrame); focus A tokenized string representing the focus type to acquire. ownerFrame A reference to the frame that has acquired the focus.
  • 29. C H A P T E R 1 The Class XMPPart XMPPart 31 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 DESCRIPTION The frame object call this method when it needs to notify your part that the ownership of a focus has been transferred. This method may be called when a document is opened, for example. It should make whatever response is necessary for having acquired the focus. For instance, acquiring the selection focus might cause a part to highlight its text selection. EXCEPTIONS kXMPErrInvalidFocus Part cannot own this focus. kXMPErrInvalidFrame The specified ownerFrame is not a display frame of this part. FocusLost 1 The FocusLost method is called to notify your part that a focus has unexpectedly been lost. void FocusLost (XMPTypeToken focus, XMPFrame* ownerFrame); focus The focus that was lost. ownerFrame A reference to the frame from which the focus was lost. DESCRIPTION This method should take whatever actions are necessary to recover from having lost the focus, i.e. close connections, de-highlight selection, etc. These foci can be lost by such events as the disconnection of a serial port, or when a network has been unexpectedly partitioned. EXCEPTIONS kXMPErrInvalidFocus Part doesn't own this focus.
  • 30. C H A P T E R 1 The Class XMPPart 32 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 kXMPErrInvalidFrame The specified ownerFrame is not a display frame of this part. FrameShapeChanged 1 The FrameShapeChanged method is called to notify your part that the containing part has changed the frame shape of one of your part’s display frames. void FrameShapeChanged (XMPFrame* frame); frame A reference to the frame that is being reshaped. DESCRIPTION This method is called by the enclosing frame’s ChangeFrameShape method. It should take whatever actions are necessary to respond to the new shape. It may need to re-layout its content, change its used shape, resize its embedded frames, or something else. It also has the option of turning around and asking the frame for a different frame shape via RequestFrameShape, though it must be able to handle the shape it is given. If the size of the frame is not sufficient, your part may ask the containing part for a continuation frame via CreatEmbeddedFrame. EXCEPTIONS kXMPErrInvalidFrame The specified frame is not a display frame of this part. FulfillPromise 1 The FulfillPromise method is called to ask your part to fulfill a previously made promise by providing the actual data the promise represents. void FulfillPromise (XMPStorageUnitView *promiseSUView);
  • 31. C H A P T E R 1 The Class XMPPart XMPPart 33 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 promiseSUView A reference to a view into the storage unit that contains the promise value. DESCRIPTION Data transfer classes such as drag and drop and the clipboard often delay the handling of data transfers until the session dictates that they must be made. In such cases, requests for these data transfers are logged as promises that are fulfilled only when these transfers are ultimately required. The promiseSUView is a view into the same storage unit value that is created by SetPromiseValue. The information about the promise is encoded in the promiseSUView in your part handler's own internal format. The promise data is written into the promiseSUView replacing the data stored in the part handler's format. When the promise was made, a record of it was kept by this part. The promiseSUView contains the part's information for that promise. The part uses the data in the promiseSUView to determine which data to move/copy. The part then writes the data into the promiseSUView. EXCEPTIONS kXMPErrInvalidPromise The part did not make this promise. GeometryChanged 1 The GeometryChanged method is called to inform your part that the clipping shape and/or external transform of one of its facets has changed. void GeometryChanged (XMPFacet* facet); facet A reference to the facet where the clip shape has changed. DESCRIPTION This method is called by the facet object.
  • 32. C H A P T E R 1 The Class XMPPart 34 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 Your part should use the new clip shape for display from now on. If your part displays only in response to update events you don't need to do anything special, provided you check the clip shape each time you draw. If your part displays asynchronously (like clocks, movies, etc.) you must notice the new clipping and limit your display accordingly. EXCEPTIONS kXMPErrInvalidFacet The specified facet is not a facet of this part. GetContainingPartProperties 1 The GetContainingPartProperties method is called to ask you part for the properties it associates with an embedded frame. XMPStorageUnit* GetContainingPartProperties (XMPFrame* frame); frame A reference to an embedded frame of this part. return value A storage unit containing the container properties for the specified frame. The caller has responsibility for deallocating storage. DESCRIPTION This method is called by an embedded part to create a storage unit and write properties that the containing part associates with the embedded frame into it, before returning it. EXCEPTIONS kXMPErrCannotEmbed This part does not support embedding. kXMPErrInvalidFrame The specified frame is not an embedded frame of this part.
  • 33. C H A P T E R 1 The Class XMPPart XMPPart 35 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 GetPrintResolution 1 The GetPrintResolution method is called to ask your part for the minimum desired resolution in dots per inch required for printing the contents of a specified frame. XMPULong GetPrintResolution (XMPFrame* frame); frame A reference to the frame for which the resolution is needed. return value The minimum desired resolution in dots per inch. DESCRIPTION This method is called by the part object or the application and is used in performing printing. EXCEPTIONS kXMPErrInvalidFrame The specified frame is not a display frame of this part. HandleEvent 1 The HandleEvent method is called to give your part the opportunity to handle a specified user-interface event. XMPBoolean HandleEvent (XMPEventData event, XMPFrame* frame, XMPFacet* facet); event The user-interface event in question. frame A reference to the frame in which the event occurred. facet A reference to the facet in which the event occurred. kXMPNull is passed for events not based on geometry, such as keyboard events.
  • 34. C H A P T E R 1 The Class XMPPart 36 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 return value Returns a Boolean specifying whether the part was able to handle the event. DESCRIPTION This method is called by the dispatcher object when an event occurs. These events are wrappers for platform-specific event data. EXCEPTIONS kXMPErrInvalidFrame The specified frame is not a display frame of this part. kXMPErrInvalidFacet The specified facet is not a facet of this part. HighlightChanged 1 The HighlightChanged methodis called to notify your part that the highlight state of one of its facets has been changed. void HighlightChanged (XMPFacet* facet); facet A reference to a facet of the part. DESCRIPTION This method is called by the facet’s owner frame. It should adjust your part's presentation in the facet to its new highlight state. The new state may be found by calling the facet’s GetHighlight method. EXCEPTIONS kXMPErrInvalidFrame The specified facet is not a facet of this part.
  • 35. C H A P T E R 1 The Class XMPPart XMPPart 37 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 InitPart 1 The InitPart method is called to allow your part to initialize itself. void InitPart (XMPStorageUnit* storageUnit); storageUnit A reference to the specified storage unit. DESCRIPTION This method is called by the draft object the first time this part is instantiated from persistent storage. This method is called after the draft object’s CreatePart method has been called. InitPartFromStorage 1 The InitPartFromStorage method is called to allow your part to initialize itself from stored data. void InitPartFromStorage (XMPStorageUnit* storageUnit); storageUnit A reference to the specified storage unit. DESCRIPTION This method is called by the draft object on all subsequent occasions that this part is requested from persistent storage. This method differs from the InitPart method in that it is called after the draft object’s GetPart method has been called.
  • 36. C H A P T E R 1 The Class XMPPart 38 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 LinkStatusChanged 1 The LinkStatusChanged method is called to allow your part to set the link status of any embedded frame. void LinkStatusChanged (XMPFrame* frame); frame A reference to a frame whose link status is to be changed. DESCRIPTION This method is called by a part's frame when that frame's ChangeLinkStatus method is called. Frames notify their owner parts that their link status has changed whenever ChangeLinkStatus is called. After this method executes successfully, the part will call ChangeLinkStatus on any embedded frames that are involved in the link in question. ***What exactly is link status?*** LinkUpdated 1 The LinkUpdated method is called to pass an updated link object to your part. void LinkUpdated (XMPLink* updatedLink, XMPChangeID id); updatedLink A reference to the link that was changed. id The change id that is associated with the link DESCRIPTION This method retrieves the data from the link and incorporates it into this part at the link's destination, thereby replacing any previous content of the link. EXCEPTIONS kXMPErrInvalidLink This isn't one of the part's links.
  • 37. C H A P T E R 1 The Class XMPPart XMPPart 39 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 MouseEnter 1 The MouseEnter method is called to notify your part that the user has moved into the area of a display frame of your part (mouse button up). void MouseEnter (XMPFacet* facet, XMPPoint where); facet A reference to the facet into which the cursor has moved. where The cursor location, in frame coordinates. DESCRIPTION This method is called by the dispatcher object when the mouse moves in. It will typically change the display of the cursor. EXCEPTIONS kXMPErrInvalidFacet The specified facet is not a facet of this part. MouseLeave 1 The MouseLeave method is calledto notify your part that the cursor has moved out of the area of a display frame of your part (mouse button up). void MouseLeave (XMPFacet* facet); facet A reference to the facet that the cursor has left. DESCRIPTION This method is called by the dispatcher object, when the mouse is moved.
  • 38. C H A P T E R 1 The Class XMPPart 40 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 EXCEPTIONS kXMPErrInvalidFacet The specified facet is not a facet of this part. MouseWithin 1 The MouseWithin method is called to notify your part that the cursor has moved within the area of a display frame of your part (mouse button up). void MouseWithin (XMPFacet* facet, XMPPoint where); facet A reference to the facet in which the cursor has moved. where The cursor location in frame coordinates. DESCRIPTION This method is called by the dispatcher object for as long as movement continues. EXCEPTIONS kXMPErrInvalidFacet The specified facet is not a facet of this part. Open 1 The Open method is called to ask your part to create and open a presentation of itself as the root frame in a new window. XMPID Open (XMPFrame* frame); frame A reference to a frame whose presentation should be used as a model for the new presentation. kXMPNull means that your part should create a new frame and open it in the window. return value A unique id for the new window.
  • 39. C H A P T E R 1 The Class XMPPart XMPPart 41 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 DESCRIPTION This method adds this part as the root part of the window. It bases the presentation in the new frame on the presentation in the old frame, or on a default presentation if there is no old frame. It always creates a new frame. The old frame part is passed in the same way as an icon as passed, its content will be the same, whereas its display may be radically different. EXCEPTIONS kXMPErrInvalidFrame The specified frame isn't one of the part’s display frames. PresentationChanged 1 The PresentationChanged method is called to notify your part that the presentation of one of its frames has been changed. void PresentationChanged (XMPFrame* frame); frame A reference to a display frame of this part. DESCRIPTION A frame’s presentation referes to how the content of that frame is displayed, whereas the view type of a frame indicates what type of frame is being used. This method is called by the ChangePresentation method of the frame whose presentation has been changed. It should examine the new presentation kind using the frame’s GetPresentation method . If your part does not support that kind of presentation, it should correct the frame's presentation using the frame’s SetPresentation method. Your part should then adjust its display in the display frame to be of the new presentation. EXCEPTIONS kXMPErrInvalidFrame The specified frame isn't one of the part’s display frames.
  • 40. C H A P T E R 1 The Class XMPPart 42 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 ReadActionState 1 The ReadActionState method is called to ask your part to read the undo action data from a storage unit. XMPPtr ReadActionState (XMPStorageUnitView* storageUnitView); storageUnitView A reference to where to get the action data. return value A pointer to information previously logged by your part in an interaction with the undo object DESCRIPTION This method is called by the undo object when it is being internalized. The undo object maintains its own storage unit. Information is logged by the undo object, using its MarkActionHistory method. This method should read the specified action state data from a view on a s storage unit. It then allocates the memory and passes ownership of the storage to the caller. EXCEPTIONS kXMPErrInvalidUndo Not an undo action of this part. kXMPErrOutOfMemory Not enough memory to internalize data. SEE ALSO XMPStorageUnitView
  • 41. C H A P T E R 1 The Class XMPPart XMPPart 43 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 ReadPartInfo 1 The ReadPartInfo method is called to ask your part to read the part information data for a display frame of your part from a storage unit. XMPPtr ReadPartInfo (XMPFrame* frame, XMPStorageUnitView* storageUnitView); frame A reference to a display frame of your part. storageUnitView A reference to where to find the frame's part information storage unit. return value A pointer to the part information data. DESCRIPTION This method is called by the frame object when it needs to internalize part info. The data for the partInfo is stored in a value in the frame's storage unit, specified by the suView parameter. This method should get the data from the storage unit, and place it in a block of memory. The method should then return the memory block to the frame for it to hold so that the part can access it later. EXCEPTIONS kXMPErrInvalidFrame The specified frame is not a display frame of this part. kXMPErrOutOfMemory Not enough memory to allocate partInfo. SEE ALSO XMPStorageUnitView
  • 42. C H A P T E R 1 The Class XMPPart 44 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 RedoAction 1 The RedoAction method is called to ask your part to redo a specified action. void RedoAction (XMPActionData actionState); actionState Information previously logged by your part to allow it to redo the action. DESCRIPTION This method is called by the undo object. The undo object maintains its own storage unit in the form of a stack. Information is logged by the undo object, using its MarkActionHistory method. EXCEPTIONS kXMPErrInvalidUndo Not an undo action of this part. RemoveDisplayFrame 1 The RemoveDisplayFrame method is called to ask your part to remove a specified frame from your part’s list of frames. void RemoveDisplayFrame (XMPFrame* frame); frame A reference to the display frame of your part. DESCRIPTION This method is called by the Remove method of the frame that is being removed. This method should make whatever other adjustments are necessary to deal with removing a frame. This includes removing any frames embedded within the specifiedframe.
  • 43. C H A P T E R 1 The Class XMPPart XMPPart 45 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 EXCEPTIONS kXMPErrInvalidFrame The specified frame is not a display frame of this part. RemoveEmbeddedFrame 1 The RemoveEmbeddedFrame method is called to ask your part to remove a frame of an embedded part. void RemoveEmbeddedFrame (XMPFrame* embeddedFrame); embeddedFrame A reference to a specified embedded frame DESCRIPTION This method is called by an embedded part to ask a containing part to remove an embedded frame. This indicates that it no longer needs the frame to display itself. EXCEPTIONS kXMPErrCannotEmbed This part does not support embedding. kXMPErrInvalidFrame The specified frame is not an embedded frame of this part. RequestEmbeddedFrame 1 The RequestEmbeddedFrame method is called to ask your part to create a new frame and embed a part in it. XMPFrame* RequestEmbeddedFrame (XMPFrame* containingFrame, XMPFrame* baseFrame,
  • 44. C H A P T E R 1 The Class XMPPart 46 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 XMPShape* frameShape, XMPPart* embedPart, XMPTypeToken viewType, XMPTypeToken presentation, XMPBoolean isOverlaid); containingFrame The display frame of your part in which to embed the new frame. baseFrame A sibling frame of the frame to be created, also a display frame of the embedded part. frameShape The requested shape of the new frame. In the base frame's own coordinate space. embedPart The part to display in the embedded frame. viewType View type for new frame. presentation Presentation for new frame. isOverlaid Whether the new frame should float above the embedded part's content. ***We need a definition of an overlaid frame, both here and for the glossary. return value A reference to the new frame. DESCRIPTION This method is only called by embedded parts that want additional frames in which to display in the same containing part. If your part is a containing part, it should ask the draft to create a new frame, and embed the frame in its content. The new frame’s frame group and sequence number are initialized based upon the base frame’s values.Your part decides if it can fulfill the requests for the frame shape. If not, it can create the frame where it wants and with the shape it chooses. If isOverlaid is true, the new frame should float above the part's content, and should not have to negotiate for space with the part. The view type and presentation are just passed through to the draft object’s CreateFrame method.
  • 45. C H A P T E R 1 The Class XMPPart XMPPart 47 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 EXCEPTIONS kXMPErrCannotEmbed This part does not support embedding. kXMPErrOutOfMemory Not enough memory to embed a part. RequestFrameShape 1 The RequestFrameShape method is called to ask your part for a change in the shape of an embedded frame. XMPShape* RequestFrameShape (XMPFrame* embeddedFrame, XMPShape* frameShape); embeddedFrame A reference to an embedded frame of this part. frameShape A reference to the requested shape, specified by the frame coordinates of the embedded frame. return value A reference to the shape that is to be changed. DESCRIPTION This method is called by the embedded frame’s RequestFrameShape method This initiates a part-specific frame negotiation process. It should decide what new shape to give the embedded frame, using the requested frame shape as a guideline. A typical example of this method’s use would be to make a frame larger. It should thenreturn the shape that is actually granted. The caller must accept the returned shape, although it may make further requests for different shapes or additional frames.
  • 46. C H A P T E R 1 The Class XMPPart 48 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 RevealFrame 1 The RevealFrame method is called to ask your part to make an embedded frame visible by scrolling it into view. void RevealFrame (XMPFrame* embeddedFrame XMPShape* revealShape); embeddedFrame A reference to an embedded frame of your part. revealShape A reference to a shape expressed in the coordinates of the embedded frame. The parameter indicates the portion of the frame that is be revealed. DESCRIPTION This method is called by an embedded part when that part needs to be made visible, such as in conjunction with a keyboard event that requires an undisplayed area in a scroll window. It should scroll one of your part's frames, if necessary, to make the embedded frame visible. If your part’s frame is not visible, this method should first ask the containing part to reveal it. If your part has no frames, or if the containing frame can't reveal the display frame, this method should open the frame in a new window. EXCEPTIONS kXMPErrInvalidFrame The specified frame is not an embedded frame of this part. RevealLink 1 The RevealLink method is called to ask your part to reveal data that was linked in a frame, making it available for viewing in a frame. void RevealLink (XMPLinkSource* linkSource);
  • 47. C H A P T E R 1 The Class XMPPart XMPPart 49 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 linkSource A reference to the linked content to reveal. DESCRIPTION This method is called by XMPLinkSource objects when a link source needs to be shown. It should not be called by parts. In the appropriate frame for this part, this method should select the content linked by the link source argument, scroll it into view, and make it the active frame. If your part has no display frame, or if your part's containing frame can't reveal the frame, this method should open a frame in a new window. EXCEPTIONS kXMPErrInvalidLink This isn't one of the part's links. SequenceChanged 1 The SequenceChanged method is called to inform your part that the sequencing of a group of its frames has been changed. void SequenceChanged (XMPFrame* frame); frame A reference to the frame whose sequence has been re-ordered. DESCRIPTION This method is called by containing part when more than one frame is used for viewing the same part. When this happens, the frames are assigned sequence numbers that indicate the order of content display. If the content needs reordering, then the sequence of these frames may aso need to be reordered, and hence the sequence wll be changed. The containing part of the specified frame calls this method when adding a new frame to the group or re-ordering the frames in the group. A single frame of the group is passed as an argument to indicate which group of which containing frame has been changed. The method must readjust the pportioning of its content to the display frames of that group.
  • 48. C H A P T E R 1 The Class XMPPart 50 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 EXCEPTIONS kXMPErrInvalidFrame The specified frame is not a display frame of this part. SEE ALSO XMPFrame UndoAction 1 The UndoAction method is called to tell your part to undo a previous action. void UndoAction (XMPActionData actionState); actionState Information that allows it to undo the action. DESCRIPTION This method is called by the undo object to undo an action that has been stored in the undo object’s storage unit using that object’s MarkActionHistory method. EXCEPTIONS kXMPErrInvalidUndo Not an undo action of this part. UsedShapeChanged 1 The UsedShapeChanged method is called to inform your part that the used shape of one of its embedded frames has changed. void UsedShapeChanged (XMPFrame* embeddedFrame);
  • 49. C H A P T E R 1 The Class XMPPart XMPPart 51 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 embeddedFrame A reference to an embedded frame of your part. DESCRIPTION This method is called by the embedded frame’s ChangeUsedShape method to notify a containing part that a used shape has changed its shape. If your part arranges its content to conform to the used shape of an embedded frame (as in text wrapping), this method can adjust the layout of that content based on the new used shape. EXCEPTIONS kXMPErrInvalidFrame The specified embeddedFrame is not an embeddedFrame of this part. ViewTypeChanged 1 The ViewTypeChanged method is called to notify your part that the view type of one of its embedded frames has been changed. void ViewTypeChanged (XMPFrame* frame); frame A reference to a display frame of your part. DESCRIPTION This method is called by the embedded frame’s ChangeViewType method,to tell an embedded part that its frame’s view type has been changed. Your part should examine the new view type using the frame’sGetViewType method. It should then adjust its display in the display frame to be of the new view type. If your part does not support that kind of view type, it should correct the frame's view type using the frame’s SetViewType method. Note that parts must support the standard set of view types (see HI spec).
  • 50. C H A P T E R 1 The Class XMPPart 52 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97 EXCEPTIONS kXMPErrInvalidFrame The specified frame is not a display frame of this part. WriteActionState 1 The WriteActionState method is called to ask you part to write out the specified action state data into a specified storage unit view object. void WriteActionState(XMPPtr actionState, XMPStorageUnitView* storageUnitView); actionState Information previously logged by the part to allow it to redo the action. storageUnitView A reference to a storageUnitView location where the actionState data is to be externalized. DESCRIPTION This method is called by the undo object when it is being externalized. The undo object maintains its own storage unit. EXCEPTIONS kXMPErrInvalidUndo Not an undo action of this part. SEE ALSO XMPUndo, XMPStorageUnitView
  • 51. C H A P T E R 1 The Class XMPPart XMPPart 53 Draft. Preliminary. © Apple Computer, Inc. 5/19/97 WritePartInfo 1 The WritePartInfo method is called to ask your part to write the frame's part information data into the frame's storage unit. void WritePartInfo (XMPPtr partInfo, XMPStorageUnitView* storageUnitView); partInfo The part information data to write. storageUnitView A view onto a value of the frame's storage unit. DESCRIPTION This method is called by the frame object when it needs to internalize part info.
  • 52. C H A P T E R 1 The Class XMPPart 54 XMPPart Draft. Preliminary. © Apple Computer, Inc. 5/19/97