[OpenLayers-Dev] Toolbar Status

Christopher Schmidt crschmidt at metacarta.com
Fri Mar 9 09:40:59 EST 2007

On Fri, Mar 09, 2007 at 08:58:45AM -0500, Stephen Woodbridge wrote:
> Christopher Schmidt wrote:
> >So, the goal is to have 3 types of controls: 
> >  * Button: A click triggers an action (like zoom in)
> >  * Modal: Turns state on temporarily. Drawing tools  probably use
> >    this.
> >  * Toggles. Auto-pan might fall under this: when it's active, the map
> >    responds. when it's not, it doesn't. 
> >
> >Do these fit all the needs address by buttons?    
> Is there a need for something like a radio set for modal buttons that 
> are mutually exclusive? It can probably be built from the Modal buttons, 
> but it might be nice to provide and easy way to do this in the api.

Ah, right, Tim brought that up. The solution to that is to create a
subclass of Panel -- like MouseToolbar is, and EditingToolbar will be -- 
and use that as a control. So, you have:

 MainPanel.addControls( [ 
  -> Control.MouseToolBar
  -> Control.EditingToolbar
 ] )

deactivate on these can probably even be implemented on the Panel super
class -- deactivate simply iterates through this.controls and turns them
all off, and subclasses can then change display properties appropriately.

So, I've just done that -- now anything that subclasses off panel can
be used as a 'tool' in a panel. When panels are deactivated, they
dissappear, and their buttons no longer have any affect: all the
controls on them are turned off. In the process, I also  added support
for a defaultControl option. That's committed as 2629. 
Christopher Schmidt

More information about the Dev mailing list