Ruler Object Library: 2 Ruler Setup

Up: GEOS SDK TechDocs | Up | Prev: 1 Ruler Features | Next: 3 VisRuler Instance Data

For each ruler a geode displays, it will need to include three objects: an object of RulerViewClass to display the ruler, a RulerContentClass object to act as the top of the RulerView's visible tree, and a VisRulerClass object, the ruler itself. Also, the geode may wish to include some of the available ruler control objects.

The RulerViews should be alerted when the main GenView scrolls or scales, so set the GenView's GVI_horizLink and GVI_vertLinks to hold the optrs of the RulerViews. A RulerView to the side of the GenView should be linked by the horizontal link; a RulerView above or below the GenView should be linked vertically.

Each RulerView should have a RulerContent as its content. Set this up as you would a normal GenView/VisContent linkage. The RulerContent functions as a VisContent for most purposes; there is some subclassed behavior so that the VisRuler will be notified when the RulerView has detected a scroll or scale event.

A VisRuler should be the child of the RulerContent. If you have more than one VisRuler associated with a view, you should use the VRI_slave links to connect them. When one VisRuler receives certain messages, it will handle them and pass them on to whatever VisRuler has been designated in its VRI_slave field. If this slave ruler itself has a slave, then the message will be relayed again, and so on. Thus the application only has to send messages to one ruler, instead of to all of them. The ruler which is not the target of a VRI_slave link is the view's master ruler, and its VRA_MASTER bit should be set.

If the view only has one ruler associated with it, that ruler's VRA_MASTER bit should be set.

If you will use the ruler library's mouse constraint management support, then the VisRulers must be run in the same thread which manages the main content. The VisRuler messages which deal with mouse positions receive the mouse location parameters on the stack, and thus the handlers must be running in the same thread as the callers. This is not a major restriction: since mouse events are so common, sending them across threads to be processed would lead to slow, jerky responses.

Your application may also include other objects:

Finally, if you wish the VisRuler to take special action on certain mouse events (perhaps providing a mark on the ruler to track the mouse pointer's position), the GenView's content should intercept those mouse events and send messages to the VisRuler (again, the VisRuler at the top of the VRI_slave chain) with the requested action.


Up: GEOS SDK TechDocs | Up | Prev: 1 Ruler Features | Next: 3 VisRuler Instance Data