Table Of Contents

Graph IDECustom Application ► Document

The following is a code splice for loading a Graphic View into a custom application's window. Note that this should only be used within Xcode (not in a Graph IDE script) and that the prefix VVPUBLIC_ needs to be prepended to the class name.

NSString *aPath = [[NSBundle mainBundle] pathForResource:@"MyDocument" ofType:@"vvibook"];

theDocument = [[VVPUBLIC_GraphicDocument alloc] init];
programmedView = [theDocument viewForDocumentPath:aPath];

[programmedView setFrame:[_switchView frame]];
[programmedView setAutoresizingMask:[_switchView autoresizingMask]];

[[_switchView superview] replaceSubview:_switchView with:programmedView];

If you intend to register states then you need to assign a controller such as in this code splice:

NSString *aPath = [[NSBundle mainBundle] pathForResource:@"MyDocument" ofType:@"vvibook"];

theDocument = [[VVPUBLIC_GraphicDocument alloc] init];
[theDocument setController:self];
programmedView = [theDocument viewForDocumentPath:aPath];

[programmedView setFrame:[_switchView frame]];
[programmedView setAutoresizingMask:[_switchView autoresizingMask]];

[[_switchView superview] replaceSubview:_switchView with:programmedView];

The following is API description specific to the Document class.

@@method(public, class) (id)alloc;
  Call like this:

[VVPUBLIC_GraphicDocument alloc]

That allocates a VVPUBLIC_GraphicDocument object.

@@method(public, instance) (void)enableEventQualifierProcessing;
  Call like this:

[myDocument enableEventQualifierProcessing];

Enables event qualifier processing. It does that by setting some internal states and then executing all programs in the document. Note that, in addition to calling this method, you must enable the event qualifier for each Layer, otherwise normal Graph IDE event processing with occur.

@@method(public, instance) (id)init;
  Call like this:

myDocument = [[VVPUBLIC_GraphicDocument alloc] init];

That allocates, initializes and assigns a document object to the myDocument variable. The document must not be released until its graphic view is no longer needed.

@@method(public, instance) (void)performAnimationStep;
  Call like this:

[myDocument performAnimationStep];

Perform one step of the animation.

@@method(public, instance) (void)release;
  Call like this:

[myDocument release];

Releases the document. Only release the document when you are completely done using the view returned by the method viewForDocumentPath:.

@@method(public, instance) (void)setController:(id)aController;
  Call like this:

[myDocument setController:self];

The controller is accessible to all programming states for the purpose of registering those states, and subsequently synchronizing states, in a larger system.

@@method(public, instance) (void)startAnimation;
  Call like this:

[myDocument startAnimation];

Starts the animation of the graphic view maintained by the document.

@@method(public, instance) (void)stopAnimation;
  Call like this:

[myDocument stopAnimation];

Stops the animation of the graphic view maintained by the document.

@@method(public, instance) (id)viewForPath:(NSString *)aPath;
  Call like this:

aView = [theDocument viewForPath:aPath];

Returns the Graphic View of a document. That view is a subclass of NSView and can be inserted into a view hierarchy as desired.




© Copyright 1993-2022 by VVimaging, Inc. (VVI); All Rights Reserved. Please email support@vvi.com with any comments you have concerning this documentation. See Legal for trademark and legal information.