GEOS SDK TechDocs
|
|
4 Advanced Concepts and Uses
|
4.2 Documents in a View
When a view is first instantiated, the window system wants to make sure everything happens properly. As a result, the view sends out a series of messages intended to notify the content that the view is opening and that it should be ready to draw its document soon. Most of these messages are intended for the GenContent and VisContent objects, and you will not need to handle them if you designate your Process object as the view's content. Similarly, when the view is shutting down, it notifies its content of the fact that it is closing. Again, the Process does not typically need to handle these messages.
MSG_META_CONTENT_SET_VIEW, MSG_META_CONTENT_VIEW_ORIGIN_CHANGED, MSG_META_CONTENT_VIEW_SCALE_FACTOR_CHANGED, MSG_META_CONTENT_VIEW_WIN_OPENED, MSG_META_CONTENT_VIEW_OPENING, MSG_META_CONTENT_VIEW_SIZE_CHANGED
When a GenView is instantiated, the UI takes care of most of the work. However, the view will send several messages to its new content in order to notify it that the view is opening.
The first message sent will be a
MSG_META_CONTENT_SET_VIEW
, which you may intercept if you need to know the view's object pointer (optr).
The content will then receive a series of other messages indicating the view's initial state. These messages are also sent whenever the view changes its state--for example, when the user moves a scrollbar, the view's origin will change. In general, your Process will not need to handle these. If you are using one of the content objects, you may need them. They are detailed below (for full reference information on these messages, see the VisContent chapter):
MSG_META_CONTENT_VIEW_ORIGIN_CHANGED
This message indicates the initial origin of the view. See Current Origin
for more information.
MSG_META_CONTENT_VIEW_SCALE_FACTOR_CHANGED
This message indicates the original scale factor of the view. If you are displaying large documents, you will need to know this in order to handle input events.
MSG_META_CONTENT_VIEW_WIN_OPENED
This message indicates that the view window is being created. Unless you plan on keeping track of several open views, you will not need to handle this message. It is sent before the window is actually opened; this means that the view may or may not be mapped, and you should not draw your document in response to this message. You should instead wait until you receive a
MSG_META_EXPOSED
. Some applications may intercept this message to get the window handle of the GenView and cache it for future use (until the window is closed).
MSG_META_CONTENT_VIEW_OPENING
This message indicates that the view has received a
MSG_VIS_OPEN
and that the content will soon be put on the screen. Your Process object will not likely handle this message, though some special VisContents may in order to prepare information needed before drawing.
MSG_META_CONTENT_VIEW_SIZE_CHANGED
This message indicates a change in size of the view--your Process object will not need to intercept this message unless you plan on using the view's width and height for something special.
After the view has been created and opened and is on the screen, it will send a
MSG_META_EXPOSED
to the content. At this time, the content must make sure the document gets drawn properly (see Drawing the Document
). No special handler is required when a view starts up; the
MSG_META_EXPOSED
is the same as would be received normally.
MSG_META_CONTENT_VIEW_CLOSING, MSG_META_CONTENT_VIEW_WIN_CLOSED, MSG_META_CONTENT_SET_VIEW
When a view is about to be closed, a
MSG_META_CONTENT_VIEW_CLOSING
is sent to the content to notify it of the shutdown. This message is primarily used by
VisContentClass
so it can send
MSG_VIS_CLOSE
to itself and all its children.
When the view is being destroyed in addition to being closed, the content will receive a
MSG_META_CONTENT_VIEW_WIN_CLOSED
. You will only need to handle this message if you have cached the view's window handle. If so, your application should throw out the old window handle to avoid any future drawing to the nonexistent window.
The content will then receive a
MSG_META_CONTENT_SET_VIEW
again (see above), this time with a null value passed as the view's optr. As with the
MSG_META_CONTENT_SET_VIEW
received when the view started up, your Process object will not need to intercept this message.
GEOS SDK TechDocs
|
|
4 Advanced Concepts and Uses
|
4.2 Documents in a View