Visit Mozilla.org

XUL:window

出典: MDC

« XUL リファレンス HOME    [ | 属性 | プロパティ | メソッド | 関連項目 ]

最上位のウィンドウの構造について記述します。それは XUL 文書のルートノードです。デフォルトで水平方向のボックスです。 ボックスなのでボックスのすべての属性を使用することができます。標準ではウィンドウの周りにプラットホーム特有のフレームがあるでしょう。

ウィンドウのアイコンを設定するには、プラットフォーム特有のアイコンファイル <windowid>.ico と/か <windowid>.xpm を作り、それらのファイルを <mozilla-directory>/chrome/icons/default/ ディレクトリにおくか、インストールしてください。<windowid> はウィンドウの id 属性の値です。これによってそれぞれのウィンドウに異なるアイコンを使うことができます。

プロパティとメソッドは XUL Window オブジェクトを参照してください。

詳しい情報が XUL チュートリアルにあります。

属性
height, hidechrome, id, screenX, screenY, sizemode, title, width, windowtype

[編集]

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="rootWnd" title="Register Online!"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <vbox>
    <hbox>
      <image src="application_form.png"/>
      <description>Register Online!</description>
    </hbox>
    <groupbox align="start">
      <caption label="Your Information"/>
      <radiogroup>
        <vbox>
          <hbox>
            <label control="your-fname" value="Enter first name:"/>
            <textbox id="your-fname" value="Johan"/>
          </hbox>
          <hbox>
            <label control="your-lname" value="Enter last name:"/>
            <textbox id="your-lname" value="Hernandez"/>
          </hbox>
          <hbox>
            <button oncommand="alert('save!')">
              <description>Save</description>
            </button>
          </hbox>
        </vbox>
      </radiogroup>
    </groupbox>
  </vbox>
</window>

[編集] 属性

XUL 要素からの継承
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

height
型: string (integer に相当)
優先する要素のピクセル単位の高さ。実際に表示される高さは、要素やその内容が持つ最小高または最大高によって異なります。CSS の height プロパティもまた使用されます。

hidechrome
型: boolean
chrome に含まれる titlebar を隠すには、この属性を true に設定します。


id
型: window 内で固有の要素 ID
要素を識別するために付与される固有の識別子。 getElementById() などの DOM 関数やスタイルシートで要素を参照するために使うことができる。

screenX
型: integer
スクリーンに表示するウインドウの水平位置。

screenY
型: integer
スクリーンに表示するウインドウの垂直位置。


sizemode
型: 下記の値のいずれか一つ
window の状態。次の値が使用されます:
  • maximized: window は最大化されており、スクリーン全体を占有しています。
  • minimized: window は最小化されているか隠れています。
  • normal: window は定められたサイズで通常の状態です。

title
型: string
window のタイトルバーに表示するためのテキスト。

width
型: string (integer に相当)
優先的な要素の幅。すべての値はピクセルなので値に単位を含むべきではありません。実際に表示される幅は、要素やその内容が持つ最小幅または最大幅によって異なります。または、要素の幅はその親要素に従って柔軟に調節されます。CSS の width プロパティもまた使用されます。

windowtype
型: string
window の種類を識別するために使用する文字列を設定します。例えば、ブラウザウィンドウと編集ウィンドウを区別するために使用します。Mozilla のウィンドウを扱う関数の一部は、この属性を同じ種類のウィンドウをグループ化するために使用します。

[編集] プロパティ

XUL 要素からの継承
align, allowEvents, boxObject, builder, className, collapsed, contextMenu, controllers, currentItem, database, datasources, dir, flex, height, hidden, id, left, listBoxObject, maxHeight, maxWidth, menu, minHeight, minWidth, observes, ordinal, orient, pack, persist, ref, resource, statusText, style, tooltip, tooltipText, top, value, width

DOM 要素からの継承
attributes, childNodes, cloneNode, firstChild, lastChild, localName, namespaceURI, nextSibling, nodeName, nodeType, nodeValue, ownerDocument, parentNode, prefix, previousSibling, tagName

[編集] メソッド

XUL 要素からの継承
blur, click, doCommand, focus, getElementsByAttribute

DOM 要素からの継承
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

[編集] 注意

"XML Parsing Error: undefined entity...<window" のエラーメッセージは、XUL ファイル内で参照された DTD ファイルが見つからないか、パスの間違いによって起こります。DOCTYPE 宣言の SYSTEM キーワードの次に来るファイル名は暗黙の内に読み込みが失敗し、エラーメッセージのみが、次の XUL 要素上で未定義の実体エラーになります。

[編集] 関連項目

要素
dialog, dialogheader

[編集] ユーザノート

ウィンドウのタイトルバーのアイコンを変更する方法は、Window icons をご覧ください。

ロケーションバーとブラウザのタブ(ダイアログなどはポップアップではありません) に favicon を追加するには、次のコードを HTML 名前空間とリンクに使用してください。

<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
	xmlns:html="http://www.w3.org/1999/xhtml">

<!-- Icon from chrome -->
<html:link rel="icon" href="chrome://myExtension/content/path/to/favicon.png"/>

<!-- From a remote site -->
<html:link rel="icon" href="http://www.mozilla.org/favicon.ico"/>