RasterBox (クラス)
public RasterBox {inherits LengthBreadthBox}
インポート元: CURL.GUI.STANDARD. package 内で定義されています CURL.GUI.BASE.

Graphic のコレクションを水平に配置するためのコンテナで、必要に応じて改行を実行します。

説明

RasterBoxHBox に似ていますが、使用可能な行の長さが内容をすべて 1 行に収めるのに十分でない場合、RasterBox では複数行に表示するという点が異なります。RasterBox に、別の RasterBox である子オブジェクトが含まれる場合、子の内容は親 RasterBox の "フロー" に統合されます。RasterBox ではない子オブジェクトは四角形オブジェクトとして表示され、そのサイズはオブジェクトのユーザー設定サイズとなります。

他のグラフィカル コンテナと同様に、RasterBox のグラフィカルな子の配列 (外側起点を使用した) を好まない場合は、子の外側起点を変更することができます。つまり、vorigin オプションを "bottom"、horigin オプションを "left" などに統一して設定します。

プログラミング注意事項

テキスト書式設定では、TextFlowBoxRasterBox より充実していて強力ですが、"改行を行う HBox" だけが必要で TextFlowBox のその他の機能は必要としないような単純な状況では、RasterBox の方が適しています。MenuBar は、RasterBox を使用してレイアウトを実行するグラフィカル オブジェクトの一例です。

次の例は、各種のグラフィカル要素を含む単純な HBox の作成方法を示します。[実行] ボタンをクリックして結果ウィンドウの高さと幅を変更し、RasterBox の外観がどのように変化するかを確認してください。


{RasterBox
    background="yellow",
    {bold Words},
    17,
    {RectangleGraphic fill-color="orange", width=3in, height=6pt},
    {RectangleGraphic fill-color="cyan", width=2in, height=6pt},
    {VBox "abc", "def"},
    {RectangleGraphic fill-color="orange", width=1in, height=6pt},
    {RectangleGraphic fill-color="cyan", width=4in, height=6pt},
    {CommandButton label="Press me!"},
    {TextField value="Hello"}}


例に示されるように、既定では RasterBox の各行で全アイテムの垂直起点を揃えています。

注意事項

このオブジェクトは、"RasterBox"のスタイル ルールを記述することによりスタイル化することが出来ます。

コンストラクタ
default:新しい RasterBox を初期化します。残余引数は、RasterBox に追加されるアイテム、オプション設定、イベント ハンドラです。
コンストラクタ public {RasterBox.default ...}

プロパティ
style-element:スタイリングの目的のための、この Visual の "要素" や "型" です。
アクセサ public RasterBox.style-element:String
プロパティ 継承 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?, display-context, enabled?, 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, clonable-class?, 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

メソッド
constrain-height:指定した高さの制約を受けた場合にこの Graphic の幅設定を返します。
public {RasterBox.constrain-height
lc:LayoutContext,
ascent:Distance,
descent:Distance
}:Dimension
constrain-width:指定した高さの制約を受けた場合にこの Graphic の高さ設定を返します。
public {RasterBox.constrain-width
lc:LayoutContext,
lextent:Distance,
rextent:Distance
}:Dimension
place-children-in-parent:
protected {RasterBox.place-children-in-parent
lc:LayoutContext,
parent:RasterBox,
before:Distance,
after:Distance
}:void
recompute-first-elastic:レイアウト ネゴシエーションでの最初のエラスティックを計算します。
protected {RasterBox.recompute-first-elastic}:OriginElastic
recompute-our-layout:レイアウト ネゴシエーションを終了します。
protected {RasterBox.recompute-our-layout}:void
recompute-second-elastic:レイアウト ネゴシエーションでの 2 番目のエラスティックを計算します。
protected {RasterBox.recompute-second-elastic}:OriginElastic
set-size:このオブジェクトにレイアウト幅と高さを代入します。
public {RasterBox.set-size lc:LayoutContext, bounds:GRect}:void
メソッド 継承 LengthBreadthBox: allocate-layout-object, attempt-revalidate-layout, check-property, get-height-preference, get-width-preference, propagate-request-layout, revalidate-second-elastic
メソッド 継承 SequenceBox: add, 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-range-as-selected-text, 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, option-changed, paginate, 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, clone-appearance-helper, 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-grab-release, on-gui-event, on-input-method-event, on-key-event, on-key-press, on-pointer-button, on-pointer-crossing, on-pointer-event, 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-option, 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-option, 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



コンストラクタ詳細
default (コンストラクタ)
public {RasterBox.default ...}

新しい RasterBox を初期化します。残余引数は、RasterBox に追加されるアイテム、オプション設定、イベント ハンドラです。




プロパティ詳細
style-element (アクセサ)
アクセサ public RasterBox.style-element:String

スタイリングの目的のための、この Visual の "要素" や "型" です。

説明

この実装によって Visual._style-elementの値が返されますが、通常は定数を返すためにオーバーライドされます。

オーバーライド

Visual のサブクラスのスタイルが他のオブジェクトと異なる場合、このゲッターは適切な文字列を返すようにオーバーライドされる必要があります。 慣例では,この文字列はクラス名または、オブジェクトを生成するマークアップの名前です。
オーバーライドでは、空の文字列でないかぎり、self._style-elementを返さなければなりません。
導入: バージョン 6.0





メソッド詳細
constrain-height (メソッド)
public {RasterBox.constrain-height
lc:LayoutContext,
ascent:Distance,
descent:Distance
}:Dimension

指定した高さの制約を受けた場合にこの Graphic の幅設定を返します。

lc: このレイアウト ネゴシエーションに対して有効な LayoutContext
ascent, descent: 高さの制約。この Graphic の起点からの相対的な上昇および下降の距離で表されます。

戻り値

オブジェクトの幅設定を表す Dimension。この Dimension は、後続のレイアウト処理中に OriginElastic に変換されます。

オーバーライド

既定のメソッド Graphic.constrain-height は、単に Graphic.get-width-preference を呼び出します。このメソッドは、オブジェクトが幅設定を計算する際に高さの制約を考慮しなくてもいい場合はオーバーライドする必要がありません。

このメソッドをオーバライドするクラスでは必ず Dimension を返すようにして、これで必要な水平軸に沿ったスペースをそのオブジェクトの起点との関係を含めて表します。実際には、これはこのメソッドが適切な OriginElastic または Dimension を返すことを意味します。Dimension の場合は、「次元から OriginElastics への変換」で説明する変換規則に従って、適切な OriginElastic に変換されます。

重要:このメソッドのオーバーライド実装には、レイアウト ネゴシエーションが確実にグラフィック階層全体に適用されるように、スーパークラス実装の呼び出しを含める必要があります。


constrain-width (メソッド)
public {RasterBox.constrain-width
lc:LayoutContext,
lextent:Distance,
rextent:Distance
}:Dimension

指定した高さの制約を受けた場合にこの Graphic の高さ設定を返します。

lc: このレイアウト ネゴシエーションに対して有効な LayoutContext
lextent, rextent: 幅の制約。起点からの左と右の相対距離で表されます。

戻り値

オブジェクトの高さ設定を表す Dimension。この Dimension は、後続のレイアウト処理中に OriginElastic に変換されます。

オーバーライド

既定のメソッド Graphic.constrain-width は、単に Graphic.get-height-preference を呼び出します。このメソッドは、オブジェクトが高さ設定を計算する際に幅制約を考慮しなくてもいい場合はオーバーライドする必要がありません。

このメソッドをオーバライドするクラスでは必ず Dimension を返すようにして、これで必要な垂直軸に沿ったスペースをそのオブジェクトの起点との関係を含めて表します。実際には、これはこのメソッドが適切な OriginElastic または Dimension を返すことを意味します。Dimension の場合は、「次元から OriginElastics への変換」で説明する変換規則に従って、適切な OriginElastic に変換されます。

重要:このメソッドのオーバーライド実装には、レイアウト ネゴシエーションが確実にグラフィック階層全体に適用されるように、スーパークラス実装の呼び出しを含める必要があります。


place-children-in-parent (メソッド)
protected {RasterBox.place-children-in-parent
lc:LayoutContext,
parent:RasterBox,
before:Distance,
after:Distance
}:void
この項目はサポートされていません。内部使用限定となっています。


recompute-first-elastic (メソッド)
protected {RasterBox.recompute-first-elastic}:OriginElastic

レイアウト ネゴシエーションでの最初のエラスティックを計算します。

lc: レイアウト ネゴシエーションを管理する LayoutContext

説明

現在のレイアウト ネゴシエーションの最初の次元に従って self のサイズ設定を計算します。したがって、この次元が幅の場合、メソッドは self の幅設定を表す OriginElastic を返し、高さを先に処理するレイアウト ネゴシエーションが進行中の場合は、self の高さ設定を表す OriginElastic を代わりに返します。

プログラミング注意事項

キャッシュされたサイズ設定が使用可能でない (または有効でない) のでサイズ設定を計算する必要がある場合、このメソッドは、self の内部メソッドから呼び出されます。

オーバーライド

LengthBreadthBox はこれを抽象メソッドとして宣言します。具象サブクラスでは、このメソッドが必要な OriginElastic 値を計算するように、このメソッドをオーバーライドする必要があります。


recompute-our-layout (メソッド)
protected {RasterBox.recompute-our-layout}:void

レイアウト ネゴシエーションを終了します。

lc: レイアウト ネゴシエーションを管理する LayoutContext
before, after: このメソッドの結果の計算に使用されるサイズ制約。

説明

現在のレイアウト ネゴシエーションの最初の次元でない次元に従って self のサイズを設定します。したがって、最初の次元が幅の場合、このメソッドはこのオブジェクトの高さの特性を示す上昇値および下降値として、それぞれ before および after を使用します。逆に、高さを先に処理するレイアウト ネゴシエーションでは、このオブジェクトの幅の特性を示す左右の範囲としてそれぞれ before および after を使用します。最終的にこのメソッドを呼び出すと、このオブジェクトのそれぞれの子で呼び出される Graphic.set-size になります。

プログラミング注意事項

このオブジェクトのそれぞれの子の set-size メソッドを呼び出すときには、このメソッドは self の内部のメソッドから呼び出されます。

オーバーライド

LengthBreadthBox はこれを抽象メソッドとして宣言します。具象サブクラスでは、このメソッドが必要な操作を実行するように、このメソッドをオーバーライドする必要があります。


recompute-second-elastic (メソッド)
protected {RasterBox.recompute-second-elastic}:OriginElastic

レイアウト ネゴシエーションでの 2 番目のエラスティックを計算します。

lc: レイアウト ネゴシエーションを管理する LayoutContext
before, after: このメソッドの結果の計算に使用されるサイズ制約。

説明

現在のレイアウト ネゴシエーションの最初の次元でない次元に従って self のサイズ設定を計算します。したがって、最初の次元が幅の場合、このメソッドは self の高さ設定を表す OriginElastic を返し、高さを先に処理するレイアウト ネゴシエーションが進行中の場合、self の幅設定を表す OriginElastic を代わりに返します。

before および after は、レイアウト ネゴシエーションの最初の次元に従った適切なサイズ制約を表します。こうした値は、Graphic.constrain-width の呼び出しにおいて lextentrextent の役割を果たします。あるいは、高さを先に処理するネゴシエーションでは、Graphic.constrain-height の呼び出しにおいて ascentdescent の役割を果たします。

プログラミング注意事項

キャッシュされたサイズ設定が使用可能でない (または有効でない) のでサイズ設定を計算する必要がある場合、このメソッドは、self の内部メソッドから呼び出されます。

オーバーライド

LengthBreadthBox はこれを抽象メソッドとして宣言します。具象サブクラスでは、このメソッドが必要な OriginElastic 値を計算するように、このメソッドをオーバーライドする必要があります。


set-size (メソッド)
public {RasterBox.set-size lc:LayoutContext, bounds:GRect}:void

このオブジェクトにレイアウト幅と高さを代入します。

説明

このオブジェクトで set-size を呼び出すと、オブジェクトのレイアウト サイズを代入し、オブジェクトのレイアウト ネゴシエーションを完了します。グラフィック階層のすべてのオブジェクトにレイアウト サイズが代入された後で階層のレイアウト ネゴシエーションが完了します。
lc: このレイアウト ネゴシエーションに対して有効な LayoutContext
bounds: このオブジェクトの境界ボックスの左右および上下の範囲をオブジェクトの起点から相対的に示す GRect

プログラミング注意事項

このメソッドは、オブジェクトのグラフィカルな親によって呼び出されます。

オーバーライド

既定のメソッド Graphic.set-size は何も行ないません。Graphicのサブクラスはこのメソッドをオーバーライドして、ここで提供した情報をインターセプトできます。