Menuitem
A single choice in a menupopup element. It acts much like a button but it is rendered on a menu.
More information about menuitem
menupopup 要素における一つの選択項目を表す。 メニュー上に描画されることを除けばボタンと同じようにふるまう。
属性:
acceltext | accessible | accesskey | allowevents | autocheck |
checked | command | crop | disabled | image |
key | label | name | selected | type |
validate | value |
スタイルクラス:
menuitem-iconic | menuitem-non-iconic |
属性:
XUL Element から継承:
align
allowevents
allownegativeassertions
class
coalesceduplicatearcs
collapsed
container
containment
context
contextmenu
datasources
debug
dir
empty
equalsize
flags
flex
height
hidden
id
insertafter
insertbefore
left
maxheight
maxwidth
menu
minheight
minwidth
mousethrough
observes
ordinal
orient
pack
persist
popup
position
ref
removeelement
sortDirection
sortResource
sortResource2
statustext
style
template
tooltip
tooltiptext
top
uri
wait-cursor
width
acceltext
Type: string
Text that appears beside beside the menu label to indicate the shortcut key (accelerator key) to use to invoke the command. If this value is set, it overrides an assigned key set in the key attribute. This attribute does not apply to menus directly on the menubar.
型 : string
コマンドを実行するのに使用するショートカットキー (アクセラレータキー) を指定するため、メニューラベルの横に表示するテキスト。この値を設定すると、key 属性で割り当てたキー設定を上書きする。この属性は、メニューバーのメニューには直接には適用されない。
accessible
Type: nsIAccessible
Returns the accessibility object for the menuitem.
型 : nsIAccessible
menuitem の accessibility オブジェクトを返す。
accesskey
Type: character
This should be set to a letter that is used as a shortcut key. This letter should be one of the characters that appears in the label text for the menuitem. This letter will typically be drawn underlined, although this behavior will be platform and theme specific. When the user presses ALT (or a similar key that varies on each platform) and the access key, the menuitem will be activated from anywhere in the window. Although the value is case insensitive, a letter with the case matching the accesskey attribute will used if both cases exist in the label.
型 : character
ショートカットキーとして使う文字に設定する。この文字は、menuitem のラベルテキストに現れる文字の一つである必要がある。この文字は一般に下線付きで表示される。一方、その振る舞いはプロットフォームやテーマに依存する。ユーザが ALT (またはプラットフォームによる同様のキー) とアクセスキーを押すと、ウィンドウのどこからでも menuitem は起動される。この値は文字の大小には関しないが、ラベルに両方がある場合には、 accesskey 属性にマッチする方の文字が使用される。
allowevents
Type: boolean
If true, events are passed to children of the menuitem. Otherwise, events are passed to the menuitem only.
型 : boolean
true のとき、イベントは menuitem の子要素に渡される。true でないときは、イベントは menuitem にのみ渡される。
autocheck
If this attribute is true, or left out, the menuitem check mark will update each time the menu item is selected. If this attribute is false, the check mark must be adjusted manually.
この属性を true にする、または取り払うと、メニュー項目が選択されるたびに menuitem のチェックマークが更新される。この属性を false にすると、チェックマークは手動で調整する必要がある。
checked
Type: boolean
Indicates whether the menuitem is checked or not.
型 : boolean
menuitem がチェックされているかいないかを示す。
command
Type: element id
Set to an id of a command element that is being observed by the menuitem. If the command element's disabled attribute is set to true, the menuitem will become disabled. If the command disabled attribue is removed, the menuitem will be enabled. Similarly, the command's label attribute can be used to set the menuitem's label.
型 : element id
menuitem に監視されている command 要素の id を設定する。 command 要素の disabled 属性が true に設定されると、 menuitem は無効になる。 command 要素の disabled 属性が削除されると、 menuitem は有効になる。同じく、 command 要素の label 属性は menuitem のラベルを設定するのに使用することができる。
crop
Type: one of the values below
If the label of the menuitem is too small to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed.
- start: The text will be cropped on its left side.
- end: The text will be cropped on its right side.
- left: (Deprecated) The text will be cropped on its left side.
- right: (Deprecated) The text will be cropped on its right side.
- center: The text will be cropped on both sides.
- none: The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment.
型 : 以下の値の一つ
与えられたスペースが小さくて menuitem のラベルがその場所に合わないとき、crop 属性で指定した側にテキストは切り取られる。切り取られたテキストの位置には、省略記号が用いられる。ボックスの方向が逆のときは、切り取りも逆になる。
- start: テキストの左側が切り取られる。
- end: テキストの右側が切り取られる。
- left: (非推奨) テキストの左側が切り取られる。
- right: (非推奨) テキストの右側が切り取られる。
- center: テキストの両側が切り取られる。
- none: テキストの切り取りに省略記号が用いられない。テキストが非常に大きいときには、単に切られるだけである。側は CSS のテキスト配置 (alignment) に依存する。
disabled
Type: boolean
Indicates whether the menuitem is disabled or not. If this attribute is set to true, the menuitem is disabled. This is usually drawn with the text in grey. If the menuitem is disabled, it does not respond to user actions. The element cannot be focused and the command event will not fire. The element will still respond to mouse events. To enable the menuitem, leave the attribute out entirely as opposed to setting the value to false.
型 : boolean
menuitem が無効か有効かを表す。この属性を true に設定すると、menuitem は無効になる。通常、テキストが灰色で表示される。menuitem が無効の場合には、ユーザアクションに応答しない。要素にフォーカスできず、またコマンドイベントは起きない。マウスイベントにはまだ応答する。 menuitem を有効にするには、値を false に設定したことに対応するものとして、この属性を取り除く。
image
Type: image URL
The URL of the image to appear on the menuitem. If this is attribute is left out, no image appears. The position of the image is determined by the dir and orient attributes. You must use the class 'menuitem-iconic' to have an image appear.
型 : image URL
menuitem に表示す画像の URL。この属性がないと、画像は表示されない。画像の位置は dir 属性と orient 属性で決定される。表示画像を持つ 'menuitem-iconic' クラスを使う必要がある。
key
Type: key element id
The id of a key element that is used as the menu command's shortcut key. If used, text will be displayed beside the menu label to indicate which keys can be pressed to invoke the command.
型 : key element id
メニューコマンドのショートカットキーとして使用される key 要素の id。使用すると、どのキーを押すとコマンドを実行できるかを示すため、メニューラベルの横にテキストを表示する。
label
Type: string
The label that will appear on the menuitem. If this is left out, no text appears.
型 : string
menuitem に表示するラベル。この属性がないと、テキストは表示されない。
name
Type: string name
Radio menuitems with the same name as put into a group. Only one menuitem from each radio group can be checked at a time.
型 : string name
同じ名前を持つラジオ menuitem を一つのグループに入れる。各ラジオグループからは一つの menuitem のみ、一度にチェックすることができる。
selected
Type: boolean
Indicates that the menuitem is selected in a menulist. This property is read only. To change the selection, set either the selectedIndex or selectedItem property of the containing menulist.
型 : boolean
menuitem が menulist で選択されていることを示す。このプロパティは読み込み専用である。この選択を変更するには、menuitem を含んでいる menulist の selectedIndex プロパティか selectedItem プロパティを設定すること。
type
Type: one of the values below
Can be used to create checkable menuitems or for radio button menuitems.
- checkbox: The menuitem is checked. The checked attribute determines whether the menuitem is checked or not.
- radio: The menuitem becomes part of a radio group. Other menuitems that have the same value for their name attributes are part of the same radio group. Only one menuitem in the same radio group can be checked at once.
型 : 以下の値の一つ
チェック可能な menuitem かラジオボタン型 meuitem を作成するのに使用される。
- checkbox: menuitem はチェック型。 checked 属性で、 menuitem がチェックされているかどうかが決まる。
- radio: menuitem はラジオグループの一員になる。 name 属性に同じ値を持つ他の menuitem は同じラジオグループの一員である。同じラジオグループでは、一つの menuitem のみ一度にチェックすることができる。
validate
Type: one of the values below
This attribute indicates whether to load the image from the cache or not. This would be useful if the images are stored remotely or you plan on swapping the image frequently. The following values are accepted, or leave out the attribute entirely for default handling:
- always: The image is always checked to see whether it should be reloaded.
- never: The image will be loaded from the cache if possible.
型 : 以下の値の一つ
この属性は、キャッシュから画像を読み込むかどうかを指定する。画像がリモートに保存されていたり、頻繁に画像を変えたりするとき、この属性は役立つ。以下の値が受け入れられる。属性を完全に消すと、デフォルトの処理になる。
- always: 画像を再読み込みするべきかどうかを常にチェックする。
- never: 可能であれば、画像はキャッシュから読み込まれる。
value
Type: string
You can associate a data value with each menu and menuitem. It is not used for any specific purpose but you can access it with a script for your own use.
型 : string
各 menu や menuitem にデータ値を関連づけることができる。特定の目的のために使用されるわけではない。スクリプトで使用するためにアクセスすることができる。
Style Classes:
The following classes may be used to style the element. These classes should be used instead of changing the style of the element directly since they will fit more naturally with the user's selected theme.
以下のクラスは、要素をスタイル付けするために用いられる。ユーザが選択したテーマにより自然に合うため、要素のスタイルを直接変更するかわりにこれらのクラスを使用するべきである。
menuitem-iconic
Use this class to have an image appear on the menuitem. Specify the image using the image attribute.
menuitem に表示される画像を保持するのにこのクラスを使う。 image 属性を使って画像を指定する。
menuitem-non-iconic
Normally, menuitems have a margin to the left for an image or checkmark. This class may be used to remove this margin so that the menuitem appears on the left edge of the menupopup.
通常、menuitem は画像やチェックマークの左側にマージンを持っている。このクラスは、このマージンを取り去り、menuitem が menupopup の左端に表示されるようにするために使われる。
プロパティとメソッド:
label
Type: string
Gets and sets the value of the label attribute.
型 : string
label 属性の値を取得・設定する。
value
Type: string
Gets and sets the value of the value attribute.
型 : string
value 属性の値を取得・設定する。
XUL Element から継承:
Element から継承: