标题栏titlebar

由titlebar(标题栏)元素创建的盒子的行为就像是普通的窗口标题栏:当这个元素被点击并拖曳,窗体随着它移动。这个元素不能被用来改变普通窗体的平台原生标题栏,作为代替,它被用来给无chrome窗体创建自定义标题栏。如果标题栏在面板元素中,拖曳它会使那个面板移动。

标题栏中元素不会接受任何鼠标事件,例如,里面的按钮不能被点击,文本框不能通过鼠标获得焦点。如果你想要的不是这种行为,你可以通过在标题栏元素中设置allowevent="true"来重写它。

当移动完成时,标题栏会发送一个command事件。

示例

这个XUL文件创建了一个可以通过鼠标移动的HUD风格的窗体。它将会在鼠标释放时关闭。

<?xml version="1.0"?>
<window title="Movable HUD Window"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        width="300" height="200"
        style="background: transparent; -moz-appearance: none;">
  <titlebar flex="1" oncommand="close()"
            style="background: rgba(30, 30, 30, 0.9);
                   -moz-border-radius: 10px;
                   -moz-box-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
                   margin: 8px 12px 16px;"/>
</window>

可以在错误控制台输入这些打开它:open("file:///Users/markus/Sites/hudwindow.xul", "", "chrome=1, titlebar=0")

特征

Inherited from XUL element
align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width

Note: allowevents特征在Firefox 3之前的标题栏中不起作用。

属性

Inherited Properties
align, attributes, allowEvents, baseURI, boxObject, builder, childElementCount, childNodes, children, className, clientHeight, clientLeft, clientTop, clientWidth, collapsed, contextMenu, controllers, database, datasources, dir, firstChild, firstElementChild, flex, height, hidden, id, lastChild, lastElementChild, left, localName, maxHeight, maxWidth, menu, minHeight, minWidth, namespaceURI, nextElementSibling, nextSibling, nodeName, nodeType, nodeValue, observes, ordinal, orient, ownerDocument, pack, parentNode, persist, prefix, previousElementSibling, previousSibling, ref, resource, scrollHeight, scrollLeft, scrollTop, scrollWidth, statusText, style, tagName,textContent, tooltip, tooltipText, top, width

方法

Inherited from XUL element
blur, click, doCommand, focus, getElementsByAttribute

Inherited from DOM element
addEventListener(), appendChild(), dispatchEvent(), getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getElementsByTagName(), getElementsByTagNameNS(), hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isSupported(), normalize(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS()

TBD

文档标签和贡献者

标签: 
 此页面的贡献者: magiclogy
 最后编辑者: magiclogy,