GEOS SDK TechDocs
|
|
6.6 Handling Mouse Events
|
7 VisClass Error Checking
Finally, you should be aware of what attributes to set in both the GenView and the VisContent objects of your visible tree to support the large document. You could easily find this out by looking through the various attributes of those classes (and you are encouraged to do so), but the following guide is provided for convenience:
In the GenView object, set GVA_WINDOW_COORDINATE_MOUSE_EVENTS in the
GVI_attrs
instance data field. This will pass mouse events in terms of offsets from the upper-left corner of the view window rather than in absolute document coordinates.
VisContentClass
handles these events and automatically turns them into document coordinates.
In the VisContent, set VCNA_WINDOW_COORDINATE_MOUSE_EVENTS and VCNA_LARGE_DOCUMENT_MODEL in the
VCNI_attrs
field. The first of these tells the content that it will receive input events in window coordinates rather than in document coordinates. The second will have the effect of making the content object ignore its bounds field and geometry management. It will also tell the content that all its children are layer objects. Setting the large document model will cause the content to send all the following messages on to all its children rather than handle them directly:
MSG_VIS_DRAW
,
MSG_VIS_CONTENT_VIEW_ORIGIN_CHANGED
,
MSG_VIS_CONTENT_VIEW_SCALE_FACTOR_CHANGED
, and
MSG_VIS_CONTENT_VIEW_SIZE_CHANGED
.
You do not have to create all the objects you may need; be aware that the Graphic Object Library provides its own layer object that supports a 32-bit graphic object layer. The spreadsheet object also exports its own layer object.
Layer objects will need to handle
MSG_VIS_LAYER_SET_DOC_BOUNDS
, which will be sent to all layers when the document bounds change.
In essence the layer object's job is to isolate its children and their children from the fact that they are in a 32-bit document rather than a 16-bit document. In order to do this, layer objects must do several things:
MSG_VIS_DRAW
In its handler, the layer should apply any 32-bit translations (using
GrApplyTranslationDWord()
) on the GState provided by
MSG_VIS_DRAW
. It should then intelligently select which of its children are affected by the drawing event and pass the message on to them with the translated GState. The handler should then untranslate the GState before returning.
MSG_VIS_VUP_CREATE_GSTATE
In the handler, the layer must
first
call its superclass (to create the GState normally), then apply the necessary translation using
GrApplyTranslationDWord()
. It can then return the translated GState.Large visible objects in the visible tree should be equipped to handle both large and small mouse events. This is because the parent object may have both 32-bit and 16-bit children. If it does, it will have to send out only small mouse events; otherwise, the 16-bit objects would be confused by the large mouse events.
Because 16-bit objects are the norm and not the exception, there are few requirements for them. However, 16-bit objects in 32-bit documents must do one thing: they must prevent the system from allowing the user to select the object and then drag-scroll too far. To prevent this from happening, the visible object must call
MSG_VIS_VUP_SET_MOUSE_INTERACTION_BOUNDS
to set a temporary boundary on drag scrolling.
GEOS SDK TechDocs
|
|
6.6 Handling Mouse Events
|
7 VisClass Error Checking