| <?xml version="1.0" encoding="UTF-8" ?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| |
| --> |
| <library> |
| |
| <class name="whiteboardBarMenu" extends="view" width="${ parent.width }" x="0" y="21" |
| height="20" layout="axis:x;spacing:1;inset:2" bgcolor="$once{ canvas.getThemeColor('baseMousecolorizer') }"> |
| |
| <attribute name="staticwidth" type="number" value="120" /> |
| <attribute name="currentBtn" value="null" /> |
| |
| <method name="getCurrentSize"> |
| <![CDATA[ |
| if ( ((this.subviews.length+1)*(this.staticwidth+1)) <= this.width) { |
| return this.staticwidth; |
| } else { |
| var newwidth = Math.round((this.width-this.subviews.length)/(this.subviews.length+1)); |
| for (var i=0;i<this.subviews.length;i++) { |
| this.subviews[i].setAttribute('width',newwidth); |
| } |
| return newwidth; |
| } |
| ]]> |
| </method> |
| |
| <handler name="onwidth"> |
| <![CDATA[ |
| if ( ((this.subviews.length)*(this.staticwidth+1)) <= this.width) { |
| for (var i=0;i<this.subviews.length;i++) { |
| this.subviews[i].setAttribute('width',this.staticwidth); |
| } |
| } else { |
| var newwidth = Math.round((this.width-this.subviews.length)/(this.subviews.length)); |
| for (var i=0;i<this.subviews.length;i++) { |
| this.subviews[i].setAttribute('width',newwidth); |
| } |
| } |
| ]]> |
| </handler> |
| |
| <method name="removeObject" args="btn"> |
| var whiteboardId = btn.objRef.whiteboardId; |
| this.removeObjectSynced(btn); |
| parent.sendRemoveWindow(whiteboardId); |
| </method> |
| |
| <method name="removeObjectSynced" args="btn"> |
| var removeCurrent = false; |
| if (this.currentBtn == btn){ |
| removeCurrent = true; |
| } |
| btn.objRef.destroy(); |
| btn.destroy(); |
| if (this.subviews.length != 0) { |
| if (removeCurrent) { |
| this.sendActiveWindowSynced(this.subviews[this.subviews.length-1]); |
| } |
| } |
| parent.addNewItemButton.updatePosition(); |
| </method> |
| |
| |
| <method name="sendActiveWindow" args="btn,win"> |
| if ($debug) Debug.write("sendActiveWindow: ",btn,win); |
| this.sendActiveWindowSynced(btn); |
| this.currentBtn.objRef.sendActiveWindow(); |
| </method> |
| |
| <method name="sendActiveWindowSynced" args="btn"> |
| <![CDATA[ |
| if (this.currentBtn != null){ |
| this.currentBtn.isactive=false; |
| if (this.currentBtn._minimizebtn_mo != null) this.currentBtn._minimizebtn_mo.setAttribute('visibility','hidden'); |
| if (this.currentBtn._minimizebtn_dn != null) this.currentBtn._minimizebtn_dn.setAttribute('visibility','hidden'); |
| } |
| this.currentBtn = btn; |
| this.currentBtn.objRef.setAttribute("visibility","visible"); |
| this.currentBtn.objRef.bringToFront(); |
| ////if ($debug) //Debug.write("sendActiveWindow2: ",this.currentBtn); |
| this.currentBtn._minimizebtn_mo.setAttribute('visibility','hidden'); |
| this.currentBtn._minimizebtn_dn.setAttribute('visibility','visible'); |
| this.currentBtn.isactive=true; |
| ]]> |
| </method> |
| |
| </class> |
| |
| </library> |