|The MAP_View widget renders the contents of a MAP(3) to the display. MAP_View also provides a map editor with an extensible set of map edition tools.|
The MAP_ViewSetSelection() function sets the active selection to w by h nodes at map position x, y. MAP_ViewSetSelection() also disables any mouse selection in progress.
The MAP_ViewGetSelection() returns 1 if there is an active selection or 0 if there is none. If there is no selection, no value is written to x, y, w and h.
The MAP_View widget provides a generic interface for tools that must accomplish diverse map operations. MAP_ViewRegTool() registers a tool for use from a MAP_View. toolspec is assumed to point to a tool structure with the following fields properly initialized:
The init(), destroy(), load() and save() operations are used to initialize, free, save and restore any private data structures needed by the tool.
The cursor() operation is expected to draw the current cursor at the screen coordinates given by the AG_Rect argument.
The effect() operation is executed on mouse click events, and on mouse motion events where the relative map (node) coordinates are >|1|. Typically, simple tools that perform node-specific operations such as the stamp and eraser tools will use this operation.
Tools that perform more complex operations (such as vector graphics manipulations) will generally use the lower-level mousemotion(), mousebuttondown(), mousebuttonup(), keydown() and keyup() operations. If any of these functions return a value of 1, the given event will not be forwarded to the mouse/keyboard tool bindings and default operations.
The MAP_ViewSetDefaultTool() function configures a default tool which will receive all events that have not been processed by the active tool or a mouse event binding.
The MAP_ViewRegDrawCb() function registers a function to invoke every time the MAP_View widget is redrawn.
MAP_View widget generates the following events:
|AG_DataSource(3), AG_Widget(3), AG_Window(3), MAP(3), MAP_Actor(3), SG_Intro(3)|
|The MAP_View widget first appeared in Agar 1.0.|