MenuItem (クラス)
public abstract sealed MenuItem {inherits HBox}
インポート元: CURL.GUI.STANDARD. package 内で定義されています CURL.GUI.BASE.
直接継承しているサブクラス: MenuAction, SubMenu

メニュー内のアイテムの基本的なインターフェイスです。

説明

このクラスは、SubMenu または MenuAction のスーパークラスです。

プロパティ
anchor-rect:この Menu オブジェクトからポップアップされるメニュー ペインを置き換えるのに使用される四角形を返します。
アクセサ public MenuItem.anchor-rect:GRect
cascade-marker-frame:MenuItem カスケード マーカーがあれば、そのコンテナです。
フィールド public-get private-set MenuItem.cascade-marker-frame:Frame
control-color:このオプションで、コントロールのボタン部分の主な色を設定します。
非ローカル オプション public MenuItem.control-color:FillPattern
enabled?:Visual が有効であるかどうかを指定します。
非ローカル オプション public MenuItem.enabled?:bool
icon:MenuItem アイコンを取得または設定します。
アクセサ public MenuItem.icon:#Graphic
セッター public MenuItem.icon:#Graphic
icon-frame:MenuItem アイコンがあれば、そのコンテナです。
フィールド public-get private-set MenuItem.icon-frame:#Frame
item-active?:このアイテムがアクティブかハイライトになっているかどうかを示します。
フィールド public-get protected-set MenuItem.item-active?:bool =false
label:MenuItem のラベルです。
ローカル オプション public MenuItem.label:Label ={Label null}
menu-bar:この MenuItem のルート メニューが BaseMenuBar の場合、非 null になります。
アクセサ public MenuItem.menu-bar:#BaseMenuBar
セッター public MenuItem.menu-bar:#BaseMenuBar
menu-context:この MenuItem(通常は MenuAction)がコンテキスト メニューに存在した場合、これはコンテキスト メニューが表示された時にマウス ポインタの下にある Visual を返します。
アクセサ public MenuItem.menu-context:#Visual
プロパティ 継承 HBox: clonable-class?, framelike-stretch?, style-element, valign, vstretch?
プロパティ 継承 HVBox: display-context, distribution, spacing
プロパティ 継承 LengthBreadthBox: first-elastic, second-elastic
プロパティ 継承 SequenceBox: child-array, completely-clonable-children?, contains-valid?, graphical-children, invalid-epoch, layouts-have-valid-sequence-number?, option-register-proc, ordered-children, registered-option-keys, reverse-ordered-children
プロパティ 継承 GetBoundsBox: layout-locally-valid?, layout-valid?
プロパティ 継承 Box: clip-child-shadows?
プロパティ 継承 Graphic: avoid-page-break?, background, border-color, border-spec, border-style, border-width, cell-border-spec, cell-border-width, cell-margin, discrete-select-in-range?, graphic-selectable, height, horigin, is-paginating?, layout, margin, opaque-to-events?, option-parent, outside-margin, pagination-state, parent, possibly-displayed?, selection-context, shadow-color, shadow-spec, visible?, visual-parent, vorigin, width
プロパティ 継承 Visual: _style-element, cursor, data-source, dragee, font-size, graphical-parent, has-key-focus?, input-method-enabled?, input-method-keyboard-mode, name, options, style-class, style-manager, style-options, test-child?, test-description, test-name, test-parent?, test-type-name, test-visible?, tooltip, user-data
プロパティ 継承 DataBindingTarget: data-binding-context, data-bindings
プロパティ 継承 EventTarget: event-handlers
プロパティ 継承 OptionListInterface: options-present-here

メソッド
add:子アイテムを SequenceBox に追加します。
public {MenuItem.add g:any, ...}:#Visual
add-option:オプション リストにオプションを追加するか、あるいは既存のオプションの値を変更します。変更は、value がオプションの現在値と異なる場合にのみ行われます。
public {MenuItem.add-option key:OptionKey, value:any}:void
become-active-item:この MenuItem にトラバースします。
public {MenuItem.become-active-item}:void
highlight:MenuItem のハイライトです。
public {MenuItem.highlight}:void
on-grab-release:GrabRelease イベントのスタティック イベント ハンドラ
public {MenuItem.on-grab-release e:GrabRelease}:void
on-pointer-event:PointerEventスタティック イベント ハンドラ
public {MenuItem.on-pointer-event e:PointerEvent}:void
remove-option:バインディング オプションを削除します。
public {MenuItem.remove-option key:OptionKey}:void
take-action:この MenuItem にあったアクションを実行します。
public abstract {MenuItem.take-action}:void
unhighlight:MenuItem のハイライトを解除します。
public {MenuItem.unhighlight}:void
unselect-item:この MenuItemの選択を解除します。
public {MenuItem.unselect-item}:void
walk-items:自身で再帰的にプロシージャを呼び出します。
public {MenuItem.walk-items f:{proc-type {MenuItem}:void}}:void
メソッド 継承 HBox: clone-appearance-helper, get-range-as-selected-text, paginate
メソッド 継承 HVBox: allocate-breadth, allocate-length, compute-breadth-elastic, compute-length-elastic, option-changed, recompute-first-elastic, recompute-our-layout, recompute-second-elastic, set-spacing
メソッド 継承 LengthBreadthBox: allocate-layout-object, attempt-revalidate-layout, check-property, constrain-height, constrain-width, get-height-preference, get-width-preference, propagate-request-layout, revalidate-second-elastic, set-size
メソッド 継承 SequenceBox: add-at-index, add-at-index-with-layout, after-reposition, before-reposition, clear, compare-children, draw, end-pagination, find, graphical-child-visible-at, internal-remove-child, note-attached, note-detaching, notify-option-children, pick-child, register-options, request-draw, request-pointer-trace, swap-children, validate-layout-sequence-numbers
メソッド 継承 BasicBox: contains-point?, find-graphic-at, handle-crossing, on-pointer-envelope-event, pointer-enter-occurred, pointer-leave-occurred
メソッド 継承 GetBoundsBox: get-bounds, get-elastic-bounds-into, get-nonparent-bounds-into, request-layout, validate-layout
メソッド 継承 Box: find-test-children, get-delimited-child-text-selection, get-gui-path-to-child, get-visible-rect-in-root-into, make-gui-mark, search-next-here, search-prev-here
メソッド 継承 Graphic: create-pagination-state, detach, draw-range-as-selected, draw-shadow, find-ancestor, find-graphical-ancestor, fire-inferior-crossing-event, get-graphical-root, get-gui-path, get-origin-in-graphical-ancestor, get-origin-in-root, get-pagination-state, get-top-left-in-ancestor, get-visible-bounds-into, on-drag-enter, on-inspection, on-pointer-enter, paint-with-decorations, replace-with, request-draw-rect, search-next, search-prev, set-layout, start-pagination, xy-offset-to
メソッド 継承 Visual: add-from-init-args, animate, change-cursor, clonable-appearance?, clone-appearance, get-focus-manager, get-layout-context, get-test-parent, get-test-property, get-text, get-view, maybe-fire-attach-event, maybe-fire-detach-event, non-keyword-init-arg, note-caret-position, on-drag-leave, on-pointer-leave, pop-cursor, prepare-test-object, prepare-test-parent, push-cursor, quantize-width, refresh-style-options, release-key-focus, request-key-focus, scroll-to-include, test-record, test-run, transform-from-display-coordinates, transform-from-graphical-root-coordinates, transform-to-display-coordinates, transform-to-graphical-root-coordinates
メソッド 継承 GraphicOptions: any-to-Distance, get-display-context
メソッド 継承 GuiEventTarget: handle-delegate-event, handle-event, on-action, on-cancel-mode, on-command-changed, on-commit, on-composition-change-event, on-composition-result-event, on-context-menu-event, on-current-record-change-request, on-current-record-changed, on-destroy-notify, on-destroy-requested, on-drag-over, on-drag-pointer, on-drag-started, on-drop, on-end-composition-event, on-focus-event, on-focus-in, on-focus-out, on-gesture, on-gesture-begin, on-gesture-end, on-gesture-magnify, on-gesture-pan, on-gesture-rotate, on-gesture-swipe, on-gesture-tap, on-gesture-touch, on-gui-event, on-input-method-event, on-key-event, on-key-press, on-pointer-button, on-pointer-crossing, on-pointer-motion, on-pointer-press, on-pointer-release, on-pointer-scroll, on-raw-key-event, on-raw-key-press, on-raw-key-release, on-reset, on-selectable-added, on-selectable-removed, on-selection-changed, on-selection-context-activated, on-selection-context-deactivated, on-selection-event, on-start-composition-event, on-start-event, on-stop-event, on-view-activate, on-view-deactivate, on-window-close, remove-event-handlers-for-event-class
メソッド 継承 DataBindingTarget: add-data-binding, get-data-binding, refresh-data-binding, remove-data-binding, unset-property, update-data-binding, validate-data-binding
メソッド 継承 EventTarget: accepts-event-class?, add-event-handler, event-handler-present?, remove-event-handler, verify-event
メソッド 継承 OptionListInterface: add-style-option, change-option-parent-notify, clone-options, get-option, get-option-by-name, keyword-init-arg, local-add-notify, local-remove-notify, name-to-option-key, new-option-item, option-change-notify, option-lookup, option-lookup-here, option-propagate-notify, option-set?, propagate-option-change, remove-style-option, remove-styles, set-option-by-name, set-style-option-by-name, unset-option-by-name, unset-style-option-by-name
メソッド 継承 BasicEventTarget: enqueue-event
メソッド 継承 InitRestArgParser: process-rest-args
メソッド 継承 Object: object-describe, object-describe-for-debugging, object-serialize




プロパティ詳細
anchor-rect (アクセサ)
アクセサ public MenuItem.anchor-rect:GRect

この Menu オブジェクトからポップアップされるメニュー ペインを置き換えるのに使用される四角形を返します。

導入: バージョン 6.0


cascade-marker-frame (フィールド)
public-get private-set MenuItem.cascade-marker-frame:Frame

MenuItem カスケード マーカーがあれば、そのコンテナです。

注意事項

既定では、カスケード マーカーを表す Graphicを含みます。この MenuItemBaseMenuBar 内にある場合、この Graphicの高さも幅も 0 に縮みます。これが、SubMenu の場合矢印を描画し、そうでなければ何も描画しません。
導入: バージョン 6.0


control-color (非ローカル オプション)
public MenuItem.control-color:FillPattern

このオプションで、コントロールのボタン部分の主な色を設定します。

説明

これは効果がありません。ただし、ノンローカルオプション ControlFrame.control-appearance-changeable? が true で、標準のルック アンド フィールが使用されている場合は別です。バージョン7.0の既定であるスキンが適用可能なルック アンド フィールでは、コントロールの色は、スキンによって決定されます。
7.0 以上のアプレットでは、標準のルック アンド フィールは明示的に指定する必要があります。install-standard-look-and-feel を呼び出すことによって、アプレット全体に StandardLookAndFeel を適用することが出来ます。また、以下のサンプルに示されるように、 install-style-sheet-on-Graphic プロシージャを使うことも出来ます。標準のルック アンド フィールは、6.0 以前のアプレットでは既定です。ただし、Macintosh プラットフォームは除きます。


{def samples = 
    {HBox valign="bottom", spacing = 4pt,
        control-appearance-changeable? = true, 
        control-color = "cornflowerblue",
        {CommandButton label = "Sample Button"},
        {CheckButton label = "Sample"},
        {Scrollbar width = .8in, direction = "horizontal"},
        {ComboBox width = 1.2in, prompt = "Choose One", 
            "First", "Second", "Third"
        },
        {TextField width = 1.0in, value = "Sample text"}
    }
}
{install-style-sheet-on-Graphic samples, null,
    look-and-feel = the-standard-look-and-feel
}


enabled? (非ローカル オプション)
public MenuItem.enabled?:bool

Visual が有効であるかどうかを指定します。

説明

このオプションが false の場合、オブジェクトやGUI オブジェクトとのユーザー インタラクションは無効になります。
このオプションを true に設定する代わりに、オプションを unset する方が一般的です。これにより、一部の親コンテナの値は、有効な値を判別します。
  • このオプションが false の場合、オプションに応じて、テキストは disabled-color および disabled-text-sunken? で表示されます。


    {paragraph I am enabled}
    {paragraph enabled? = false, I'm not}
    
  • このオプションが false で、Visual がコントロールの場合、コントロールのユーザー インターフェイスは無効になります。前述したように、ラベル上の任意のテキストは、無効状態で表示されます。
    さらに、コントロールに ReactiveLabel があれば、ラベルは既定ラベルの代わりに ReactiveLabel.label-disabled のプロパティを表示します。


    {radio-buttons 
        value = "first",
        {RadioButton radio-value = "first"},
        {RadioButton
            radio-value = "second",
            reactive-label = {ReactiveLabel
                                 label-disabled = "(second)"
                             },
            enabled? = false
        },
        {RadioButton radio-value = "third"}
    }
    


icon (アクセサ)
アクセサ public MenuItem.icon:#Graphic
セッター public MenuItem.icon:#Graphic

MenuItem アイコンを取得または設定します。

注意事項

iconnull の場合は、この MenuItem から前のメニュー アイコンが削除されます。そうでない場合は、新しいメニュー アイコンが設定され、古いメニュー アイコンがあれば、それと置き換わります。


icon-frame (フィールド)
public-get private-set MenuItem.icon-frame:#Frame

MenuItem アイコンがあれば、そのコンテナです。

注意事項

これは、MenuItem がアイコンのスペースを予約している場合、非 null になります。
導入: バージョン 6.0


item-active? (フィールド)
public-get protected-set MenuItem.item-active?:bool =false

このアイテムがアクティブかハイライトになっているかどうかを示します。

導入: バージョン 6.0


label (ローカル オプション)
public MenuItem.label:Label ={Label null}

MenuItem のラベルです。

注意事項

Label も参照してください。


menu-bar (アクセサ)
アクセサ public MenuItem.menu-bar:#BaseMenuBar
セッター public MenuItem.menu-bar:#BaseMenuBar

この MenuItem のルート メニューが BaseMenuBar の場合、非 null になります。

導入: バージョン 6.0


menu-context (アクセサ)
アクセサ public MenuItem.menu-context:#Visual

この MenuItem(通常は MenuAction)がコンテキスト メニューに存在した場合、これはコンテキスト メニューが表示された時にマウス ポインタの下にある Visual を返します。

導入: バージョン 6.0





メソッド詳細
add (メソッド)
public {MenuItem.add g:any, ...}:#Visual

子アイテムを SequenceBox に追加します。

g: 追加するアイテム。g がまだ Graphic でない場合、gGraphic に強制変換され、その結果が追加されます。

注意事項

SequenceBox.add はまた次の 3 つのパラメータを受け取ります。

戻り値

追加された実際の値。追加された Graphic のサブタイプになります。

オーバーライド

子の追加にさらに別の処理を関連付けることができるように、SequenceBox のサブクラスでオーバーライドできます。この種のオーバーライド メソッドは、以下を呼び出す必要があります。

{super.add g, ...}

を呼び出して、SequenceBox 自体の追加アクションを呼び出し、キーワード引数が指定されている場合はそのキーワード引数とともに渡します。


add-option (メソッド)
public {MenuItem.add-option key:OptionKey, value:any}:void

オプション リストにオプションを追加するか、あるいは既存のオプションの値を変更します。変更は、value がオプションの現在値と異なる場合にのみ行われます。

key: 追加または設定されるオプションの OptionKey
value: オプションに関連付けられる値。

プログラミング注意事項

このメソッドは、Curl コンパイラが次のような式に対して生成するコードから呼び出されます。

set object.option-name = value

通常は、ユーザー コードにより直接呼び出されることはありません。

オーバーライド

オプションが追加または設定されるたびに追加操作を実行する必要があるサブクラスでは、これをオーバーライドすることができます。


become-active-item (メソッド)
public {MenuItem.become-active-item}:void

この MenuItem にトラバースします。



highlight (メソッド)
public {MenuItem.highlight}:void

MenuItem のハイライトです。

導入: バージョン 6.0


on-grab-release (メソッド)
public {MenuItem.on-grab-release e:GrabRelease}:void

GrabRelease イベントのスタティック イベント ハンドラ

説明

スタティック イベント ハンドラの一般的な情報については、GuiEventTarget.on-pointer-event を参照してください。


on-pointer-event (メソッド)
public {MenuItem.on-pointer-event e:PointerEvent}:void

PointerEventスタティック イベント ハンドラ

e: 発生した PointerEvent

オーバーライド

このメソッドは、PointerEvent のスタティック ハンドラを提供するためにオーバーライドします。このメソッドをオーバーライドする標準的な方法は、以下のとおりです。

  1. 最初に、現在のオブジェクトの代わりに実行すべき演算を行います。
  2. 次に、{super.on-pointer-event e} を呼び出します。


(1) の演算でイベントが消費されると考えられる場合、イベントで GuiEvent.consume を呼び出してこれを示します。ただし、この場合でも上記の 2 つの手順をその後で実行してください。消費されていないイベントに対してのみ実行されるスタティック イベント ハンドラは、GuiEvent.consumed? をチェックして、イベントがすでに消費されているかどうかを調べることができます。

注意事項

すべてのスタティック イベント ハンドラ (on-... 形式の名前を持つ GuiEventTarget のメソッド) でこれと類似した動作が行われ、それらすべてにオーバーライドについての同じ注意事項が適用されます。


remove-option (メソッド)
public {MenuItem.remove-option key:OptionKey}:void

バインディング オプションを削除します。

key: 削除されるオプションの OptionKey

プログラミング注意事項

このメソッドは、Curl コンパイラが次のような式に対して生成するコードから呼び出されます。

{unset object.option-name}

通常は、ユーザー コードにより直接呼び出されることはありません。

オーバーライド

オプションが削除されるたびに追加操作の実行を必要とするサブクラスで、オーバーライドすることができます。


take-action (メソッド)
public abstract {MenuItem.take-action}:void

この MenuItem にあったアクションを実行します。

説明

MenuItem.item-active?true の場合、MenuAction を起動します。このメソッドを MenuAction で呼び出すことで、メニューのトラバースを終了させます。
SubMenu では、これは SubMenu を開きます。
これは、通常 enter キーが押されてメニュー アイテムがアクティブになると呼び出されます。
導入: バージョン 6.0


unhighlight (メソッド)
public {MenuItem.unhighlight}:void

MenuItem のハイライトを解除します。

導入: バージョン 6.0


unselect-item (メソッド)
public {MenuItem.unselect-item}:void

この MenuItemの選択を解除します。

導入: バージョン 6.0


walk-items (メソッド)
public {MenuItem.walk-items f:{proc-type {MenuItem}:void}}:void

自身で再帰的にプロシージャを呼び出します。

f: 呼び出すプロシージャ。このプロシージャは、MenuItem を引数として受け取り、void を返す必要があります。
導入: バージョン 6.0