GenView: 4.3 Advanced Concepts and Uses: Drawing the Document

Up: GEOS SDK TechDocs | Up | Prev: 4.2 Documents in a View | Next: 4.4 Document and View Size
MSG_GEN_VIEW_GET_WINDOW, MSG_GEN_VIEW_REDRAW_CONTENT

Displaying your document inside a view is as easy as drawing the document. Any time part of the view becomes invalid (due to scrolling or window movement, for example), the content will receive a MSG_META_EXPOSED. Your content object must have a handler for MSG_META_EXPOSED . See MSG_META_EXPOSED Handler for an example of handling MSG_META_EXPOSED .

You may also cause your application to redraw the window at any time. However, you will need to either save the window handle when the view is created (see MSG_META_CONTENT_VIEW_WIN_OPENED ) or retrieve it with MSG_GEN_VIEW_GET_WINDOW . When your content has the window handle, it can create a GState for that window and draw to it as if a MSG_META_EXPOSED had been sent; drawing the changed portion of the document will change the drawing on the screen. Note that the content should not send itself a MSG_META_EXPOSED --this message should be generated only by the window system because the window system will then know which parts of the screen have become invalid. For a self-generated MSG_META_EXPOSED to work, you must also get the view's visible rectangle (with MSG_GEN_VIEW_GET_VISIBLE_RECT , above) and call GrInvalRect() to invalidate the view's window.

A simpler way to force a redraw is to make the GenView redraw its entire document with MSG_GEN_VIEW_REDRAW_CONTENT . One example of when this might be used is a "Refresh" or "Redraw" option; this causes the window to be redrawn in order to clean up anything extra that may be left on the screen. Note that this is an option provided by the GenViewControl object.

MSG_GEN_VIEW_GET_WINDOW

WindowHandle MSG_GEN_VIEW_GET_WINDOW();

This message returns the window handle of the view window. As an alternative, you can store the view's window handle when MSG_META_CONTENT_VIEW_WIN_OPENED is sent upon view startup (see The Life of a View ) and discard it when you receive MSG_META_CONTENT_VIEW_CLOSING .

Source: Unrestricted.

Destination: Any GenView object.

Parameters: None.

Return: The window handle of the GenView's window.

Interception: Generally not intercepted.

See Also: MSG_META_CONTENT_VIEW_WIN_OPENED , MSG_META_CONTENT_VIEW_CLOSING

MSG_GEN_VIEW_REDRAW_CONTENT

void	MSG_GEN_VIEW_REDRAW_CONTENT();

This message causes the GenView to redraw its entire content. This is essentially the same as exposing the entire view window.

Source: Unrestricted--typically the GenViewControl

Destination: Any GenView object.

Interception: Generally not intercepted.


Up: GEOS SDK TechDocs | Up | Prev: 4.2 Documents in a View | Next: 4.4 Document and View Size