I find that there is a little too much combination of 'business-logic' and presentation in the way the LayerSwitcher is implemented. One aspect of it is the actual layer control, but the other is just having a control that can be opened and closed.
<br><br>I do not know if you have considered separating the two, so that there would be a generic control, which would set up the open/close functionality and have some ways of positioning it on the page plus a control over the size when opened.
<br>A second bit of functionality would be e.g. the layerswitcher, which would simply fill a div in the generic control and to which the generic control would delegate when redrawing the contents.<br>This would make it easier to develop custom controls that one could fill with additional functionality, with a shared behaviour/appearance on the screen.
<br><br>I hacked out some simple stuff that I just need for a demo here, but you can see the base idea at<br><a href="http://iceds.ge.ucl.ac.uk/OL/control.html">http://iceds.ge.ucl.ac.uk/OL/control.html</a><br><br>On the right hand side are three controls, the top a variation of the layerswitcher, the bottom two browsers that will allow adding a layer to OpenLayers by clicking on a WMS Layer. All three controls just use the same dummy control to handle the opening and there are ways to set the size and position....
<br><br>(The green sliders in the layerswitcher are supposed to enable a user to adjust the opacity of a layer, but somehow the sliders do not get the mouse focus, as the map dragging monopolises it. The layers are also supposed to be restackable using scriptaculous sortable, but in this version it does not work for the same reason).
<br><br>I have only tested this on firefox (it does not work at all on IE) and there a quite a few bugs in it, but I thought submitting the idea to get some more input on how this could be done in the most generic fashion.
<br><br>Ludwig<br><br><br>