VisContent: 2.2 Basic VisContent Usage: Messages Received from the View

Up: GEOS SDK TechDocs | Up | Prev: 2.1 Setting Up Sizing Behavior
MSG_META_CONTENT_SET_VIEW, MSG_META_CONTENT_VIEW_ORIGIN_CHANGED, MSG_META_CONTENT_VIEW_SCALE_FACTOR_CHANGED, MSG_META_CONTENT_VIEW_OPENING, MSG_META_CONTENT_VIEW_WIN_OPENED, MSG_META_CONTENT_VIEW_SIZE_CHANGED, MSG_META_CONTENT_VIEW_CLOSING, MSG_META_CONTENT_VIEW_WIN_CLOSED

A s detailed in the discussions on GenView, the view sends a sequence of messages to its content when the view is first opening and when it is closing. These messages set up the content's visible instance data and prime the visible tree to be drawn on the screen. The messages are handled by the default handlers in VisContentClass , and you do not need to add anything to them to make them work.

The messages sent to the content when the view is first created are

  1. MSG_META_CONTENT_SET_VIEW
    This message passes the view's optr to the content, setting the VCNI_view field properly.
  2. MSG_META_CONTENT_VIEW_ORIGIN_CHANGED
    This message passes the view's initial origin (which may be set other than the default) to the content.
  3. MSG_META_CONTENT_VIEW_SCALE_FACTOR_CHANGED
    This message passes the view's initial scale factor (which may be set other than the default) to the content.
  4. MSG_META_CONTENT_VIEW_OPENING
    This message is sent to the content when the view receives a MSG_VIS_OPEN . This notifies the content that the view is about to be put on the screen and that it should prepare itself to be drawn.
  5. MSG_META_CONTENT_VIEW_WIN_OPENED
    This message passes the window handle of the newly created view window so the content can record it in VCNI_window .
  6. MSG_META_CONTENT_VIEW_SIZE_CHANGED
    This message passes the view window's size (height and width) to the content so the content can determine its proper size and geometry.
  7. MSG_META_EXPOSED
    This message is sent when the view's window is finally on the screen. It signifies that the content should draw itself and then send MSG_VIS_DRAW s to all its children.

The view will also send certain messages to the content when different things happen to change the content's instance data:

When the view is shutting down, it will send the following three messages to the content to set the proper data:

  1. MSG_META_CONTENT_VIEW_CLOSING
    This message is sent to the content when the view receives a MSG_VIS_CLOSE . It indicates that the view is being taken off the screen and that all the visible objects in the content's tree should remove themselves from the screen.
  2. MSG_META_CONTENT_VIEW_WIN_CLOSED
    This message is sent when the view's window is finally destroyed. The copy of the window handle in VCNI_window will be thrown out now so no drawing to the stale window handle will be done.
  3. MSG_META_CONTENT_SET_VIEW
    This message is sent to set the content's VCNI_view field to a null handle. When the view is finally taken off the screen, it no longer should have a content associated with it since it is meaningless to work with a visible tree that is not on the screen. If the view is opened again later, the content will receive another MSG_META_CONTENT_VIEW_OPENING and will once again be passed the view's optr.

MSG_META_CONTENT_SET_VIEW

void	MSG_META_CONTENT_SET_VIEW(
        optr	view);

This message passes the optr of the GenView object that will display this content object. The default handler will set the content's VCNI_view field to the passed optr. This message is also used when the view has been shut down; the passed optr will be null.

Source: Unrestricted--typically sent by a GenView to its content object.

Destination: Any VisContent or Process object acting as the content of a GenView.

Parameters: view The optr of the GenView using this object as its content.

Return: Nothing.

Interception: Unlikely.

MSG_META_CONTENT_VIEW_ORIGIN_CHANGED

void	MSG_META_CONTENT_VIEW_ORIGIN_CHANGED(@stack
        WindowHandle	 viewWindow,
        sdword		xOrigin,
        sdword		yOrigin);

This message notifies the content that the view's origin has changed. The content will set its VCNI_docOrigin field to the passed values.

Source: Unrestricted--typically sent by a GenView to its content object.

Destination: Any VisContent or Process object acting as the content of a GenView.

Parameters: viewWindow The window handle of the GenView's window.

xOrigin
The new horizontal origin of the view.
yOrigin
The new vertical origin of the view.

Return: Nothing.

Interception: Any content that is managing large documents will probably need to subclass this message and apply the proper translations for the 32-bit coordinates.

MSG_META_CONTENT_VIEW_SCALE_FACTOR_CHANGED

void	MSG_META_CONTENT_VIEW_SCALE_FACTOR_CHANGED(@stack
        WindowHandle viewWindow,
        WWFixedAsDWord		yScaleFactor,
        WWFixedAsDWord		xScaleFactor);

This message notifies the content that the view window's scale factor has changed. The content will set its VCNI_scaleFactor field to the passed values.

Source: Unrestricted--typically sent by a GenView to its content object.

Destination: Any VisContent or Process object acting as the content of a GenView.

Parameters: viewWindow The window handle of the GenView's window.

yScaleFactor
The new vertical scale factor.
xScaleFactor
The new horizontal scale factor.

Return: Nothing.

Interception: Any content that is managing large documents will probably need to subclass this message and apply the proper translations for the 32-bit coordinates.

MSG_META_CONTENT_VIEW_WIN_OPENED

void	MSG_META_CONTENT_VIEW_WIN_OPENED(
        word		viewWidth,
        word		viewHeight,
        WindowHandle		viewWindow);

This message notifies the content that the view's window has been created and is being put on the screen. This message will be followed by MSG_META_EXPOSED , so the content should not draw anything here.

Source: Unrestricted--typically sent by a GenView to its content object.

Destination: Any VisContent or Process object acting as the content of a GenView.

Parameters: viewWidth The new window's initial width.

viewHeight
The new window's initial height.
viewWindow
The window handle of the GenView's window.

Return: Nothing.

Interception: A content may wish to subclass this message if it needs to initialize data before the view's window is actually on the screen.

MSG_META_CONTENT_VIEW_OPENING

void	MSG_META_CONTENT_VIEW_OPENING(
        optr	view);

This message notifies the content that the view window is being put on the screen. Although the window will usually be fully realized by the time the content handles this message, the content should not draw anything in this handler. Because the view and content are often in different threads, a context switch could have occurred and the window might not be fully realized. This message will be followed by a MSG_META_EXPOSED indicating that the visible tree can be drawn and that the window is fully opened.

Source: Unrestricted--typically sent by a GenView to its content object.

Destination: Any VisContent or Process object acting as the content of a GenView.

Parameters: view The optr of the GenView.

Return: Nothing.

Interception: A content may wish to subclass this message to initialize data before the view window is fully opened.

MSG_META_CONTENT_VIEW_SIZE_CHANGED

void	MSG_META_CONTENT_VIEW_SIZE_CHANGED(
        word		viewWidth,
        word		viewHeight,
        WindowHandle		viewWindow);

This message is sent to the content whenever the view's size changes for any reason. The passed height and width will be stored in the content's VCNI_viewHeight and VCNI_viewWidth fields.

Source: Unrestricted--typically sent by a GenView to its content object.

Destination: Any VisContent or Process object acting as the content of a GenView.

Parameters: viewWidth The new width of the view window.

viewHeight
The new height of the view window.
viewWindow
The window handle of the GenView's window.

Return: Nothing.

Interception: Any content that is managing large documents may need to subclass this message to apply translations for 32-bit coordinates.

MSG_META_CONTENT_VIEW_CLOSING

void	MSG_META_CONTENT_VIEW_CLOSING();

This message indicates to the content that the view window is being shut down. The content should remove the visible tree from the screen and should prepare itself for the window to be closed.

Source: Unrestricted--typically sent by a GenView to its content object.

Destination: Any VisContent or Process object acting as the content of a GenView.

Interception: A content may subclass this message if it wants to do additional things when the view is taken off the screen.

MSG_META_CONTENT_VIEW_WIN_CLOSED

void	MSG_META_CONTENT_VIEW_WIN_CLOSED(
        WindowHandle viewWindow);

This message indicates that the view's window has been shut down, taken off the screen, and destroyed. The content responds to this message by discarding the window handle stored in its VCNI_window field. The content should already have removed itself from the screen when it received an earlier MSG_VIS_CLOSE .

Source: Unrestricted--typically sent by a GenView to its content object.

Destination: Any VisContent or Process object acting as the content of a GenView.

Parameters: viewWindow The window handle of the GenView's window.

Return: Nothing.

Interception: A content may subclass this message to clean up after the view window is closed (e.g. if the content cached the view's window handle to a global variable, it will need to zero that handle now).


Up: GEOS SDK TechDocs | Up | Prev: 2.1 Setting Up Sizing Behavior