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

水平行に Graphic のコレクションを配置するためのコンテナ。

次の例は、各種のグラフィック要素を含む単純な HBox の作成方法を示します。


{HBox
    background="lime",
    spacing=5pt,
    {bold Words},
    17,
    {VBox "abc", "def"},
    {CommandButton label="Press me!"},
    {TextField value="Hello", width=2in}}


この例が示すように、既定では HBox のアイテムの起点が揃えられます。この既定値を変更するには、次の例のように、HBox.valign オプションの値として "bottom" を指定します。


{HBox
    background="lime",
    spacing=5pt,
    valign="bottom",
    {RectangleGraphic width=18pt, height=6pt},
    {bold Words},
    17,
    {VBox "abc", "def"},
    {CommandButton label="Press me!"},
    {TextField value="Hello", width=2in},
    {RectangleGraphic width=18pt, height=6pt}}


その他の効果を確認するには、"center""top" などの別の整列方法を指定します。

注意事項

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

コンストラクタ
clone-appearance-from:このタイプの新しいオブジェクトを作成するために Visual.clone-appearance が使用するコンストラクタ。
コンストラクタ protected {HBox.clone-appearance-from
other:HBox,
fixup:#{proc-type {Visual, Visual}:Visual}
}
default:任意の数の子 Graphic を保持できるコンテナ。オブジェクトを水平行に配置します。
コンストラクタ public {HBox.default ...}

プロパティ
clonable-class?:当該クラスがクローン化可能である場合は、true を返します。その他の場合は false を返します。
アクセサ protected HBox.clonable-class?:bool
framelike-stretch?:vstretch? が true の場合、子オブジェクトの伸長方法を制御します。
ローカル オプション public HBox.framelike-stretch?:bool =false
style-element:スタイリングの目的のための、この Visual の "要素" や "型" です。
アクセサ public HBox.style-element:String
valign:HBox のグラフィカルな子の間の垂直方向の整列方法を指定します。
ローカル オプション public HBox.valign:any
vstretch?:固定サイズの子が伸長可能な子を収縮するかどうかを設定します。
ローカル オプション public HBox.vstretch?:bool =false
プロパティ 継承 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?, 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, 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

メソッド
clone-appearance-helper:クローンを作成し、クローン自体を返します。
protected {HBox.clone-appearance-helper
fixup:#{proc-type {Visual, Visual}:Visual}
}:Visual
get-range-as-selected-text:start-boundend-bound 間の、このグラフィック内に含まれる選択したテキストを取得します。
public {HBox.get-range-as-selected-text
into:StringBuf,
start-bound:#GuiMark = null,
end-bound:#GuiMark = null
}:void
paginate:グラフィックにパジネーションを適用します。
public {HBox.paginate
page-height:Distance,
next-page-height:Distance,
query-only?:bool
}:(PaginationState, PaginationQuality)
メソッド 継承 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, 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-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



コンストラクタ詳細
clone-appearance-from (コンストラクタ)
protected {HBox.clone-appearance-from
other:HBox,
fixup:#{proc-type {Visual, Visual}:Visual}
}

このタイプの新しいオブジェクトを作成するために Visual.clone-appearance が使用するコンストラクタ。

other: クローンする HBox
fixup: other に複数の子がある場合は、それらの子のクローンを作成するとき、このプロシージャが Visual.clone-appearance の各呼び出しごとに渡されます。

注意事項

クローン化をサポートする HBox のサブクラスは、このコンストラクタを呼び出してクローンを作成する必要があります。


default (コンストラクタ)
public {HBox.default ...}

任意の数の子 Graphic を保持できるコンテナ。オブジェクトを水平行に配置します。

注意事項

このメソッドに指定可能な引数は、次の 3 つのタイプです。



プロパティ詳細
clonable-class? (アクセサ)
アクセサ protected HBox.clonable-class?:bool

当該クラスがクローン化可能である場合は、true を返します。その他の場合は false を返します。

オーバーライド

既定の実装は false を返します。クローン化機能を提供するクラスは、{type-of self} == {compile-time-type-of self} を返すためには、このゲッターをオーバーライドする必要があります。クローン化可能な Visual が必ずしもクローン化可能であるとは限らないので、単に true を返すだけでは正しくありません。
このメソッドをオーバーライドする場合は、Visual.clone-appearance-helper もオーバーライドする必要があります。


framelike-stretch? (ローカル オプション)
public HBox.framelike-stretch?:bool =false

vstretch? が true の場合、子オブジェクトの伸長方法を制御します。

説明

このオプションは、HBox.vstretch?true である場合に HBox の子の伸長方法を制御します。
既定では、HBox.framelike-stretch?false であり、HBox.vstretch? により、HBox は伸長可能な塗りつぶしエラスティックをそれぞれの子 HBox の高さエラスティックに追加できるようになります。その結果、固定の子により、伸長する子が固定の子の高さにまで縮小されることはなくなります。
HBox.framelike-stretch?true で、HBox.vstretch?true に設定されると、HBox の子はその伸張順位に関係なく、縦方向に強制的に伸張され、HBox 内を埋めます。これにより、HBox の動作は Frame.vstretch? との整合性が保たれます。


{let hb:HBox =
    {spaced-hbox
        vstretch? = true,
        background = "green",
        {Frame height = 1cm, width = 3cm, background = "lime"},
        {Frame height = 3cm, width = 4cm, background = "orange"},
        {Frame height = 2cm, width = 2cm, background = "yellow"}
    }
}

{Frame
    background = "red",
    height = 5cm,
    hb
}

{CheckButton
    label = "framelike-stretch?",
    value = hb.framelike-stretch?,
    {on ValueFinished at cb:CheckButton do
        set hb.framelike-stretch? = cb.value
    }
}


style-element (アクセサ)
アクセサ public HBox.style-element:String

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

説明

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

オーバーライド

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


valign (ローカル オプション)
public HBox.valign:any

HBox のグラフィカルな子の間の垂直方向の整列方法を指定します。

説明

HBox内部起点は、指定された配置方法で揃えられます。有効値は次のとおりです。

次の例の HBox は、valign オプションにさまざまな値 (または値なし) を使用して得られる効果の一部を示しています。


{HBox spacing=4pt,
      {HBox
          "None", {TextField value="Hello"},
          {RectangleGraphic width=24pt, height=18pt}},
      {HBox valign="bottom",
            "Bottom", {TextField value="Hello"},
            {RectangleGraphic width=24pt, height=18pt}},
      {HBox valign="center",
            "Center", {TextField value="Hello"},
            {RectangleGraphic width=24pt, height=18pt}},
      {HBox valign="top",
            "Top", {TextField value="Hello"},
            {RectangleGraphic width=24pt, height=18pt}},
      {HBox valign="origin",
            "Origin", {TextField value="Hello"},
            {RectangleGraphic width=24pt, height=18pt}}}


vstretch? (ローカル オプション)
public HBox.vstretch?:bool =false

固定サイズの子が伸長可能な子を収縮するかどうかを設定します。

説明

true の場合、HBox のすべての子は HBox.framelike-stretch? オプションの設定により決定される方法で同じ高さとなります。





メソッド詳細
clone-appearance-helper (メソッド)
protected {HBox.clone-appearance-helper
fixup:#{proc-type {Visual, Visual}:Visual}
}:Visual

クローンを作成し、クローン自体を返します。

オーバーライド

既定の実装はエラーをスローします。クローン化機能を提供するクラスは、
{{compile-time-type-of self}.clone-appearance-from self, fixup}
を返すためには、このゲッターをオーバーライドする必要があります。


get-range-as-selected-text (メソッド)
public {HBox.get-range-as-selected-text
into:StringBuf,
start-bound:#GuiMark = null,
end-bound:#GuiMark = null
}:void

start-boundend-bound 間の、このグラフィック内に含まれる選択したテキストを取得します。

into: 結果を格納する StringBuf
start-bound: グラフィック内の開始ポイントを区切る GuiMark。null の場合、開始ポイントはグラフィックの先頭の端と見なされます。
end-bound: グラフィック内の終了ポイントを区切る GuiMark。null の場合、終了ポイントは、グラフィックの最後の端と見なされます。

オーバーライド

通常コンテナは再帰的に呼び出しを実行して、適切な区切り文字を挿入します。その他のサブクラスは、直接テキストを提供します。


paginate (メソッド)
public {HBox.paginate
page-height:Distance,
next-page-height:Distance,
query-only?:bool
}:(PaginationState, PaginationQuality)

グラフィックにパジネーションを適用します。

page-height: グラフィックをページにレンダリングするのに有効な高さ。これには、ボーダーとマージンが占めるスペースは含まれません。
next-page-height: このグラフィックが次のページに移動される場合に、このグラフィックをパジネートするのに有効な高さ。
query-only?: true の場合は、この Graphic に対する PaginationState の状態は変わりません。詳細については、Graphic.get-pagination-state および注を参照してください。

戻り値

返される PaginationState は、このメソッドが呼び出された後の Graphic のパジネーション状態です。
返される PaginationQuality 値は、与えられた page-height を使用して達成されるページ分割の品質を示します。

プログラミング注意事項

Graphic にパジネーションを適用する前に、true に設定された query-only? でこの関数を呼び出すことができます。このように、呼び出し元は、与えられた page-height でどんな PaginationQuality を達成できるかを決定することができます。呼び出し元は、PaginationQuality に応じて、現行ページにあるオブジェクトの一部にパジネーションを適用するか、オブジェクト全体を次のページに押し込むことができます。これを行うには、このオブジェクトの先頭を指すように、Graphic に関連付けられた PaginationStatePaginationState.end-offset を設定します。

オーバーライド

Graphic 自身が何らかの具体的な方法でページ間でパジネーションを実行するようにしたい場合は、このメソッドをオーバーライドします。
このメソッドをオーバーライドするときは、以下の規則に従う必要があります。
query-only?Graphic.get-pagination-state を呼び出して、この Graphic の現在のパジネーションの状態を取得します。query-only?true であると、メソッドはこの GraphicPaginationState のクローンに作用します。
このメソッドが前に PaginationQuality.complete を返した Graphic で呼び出される場合は、PaginationState.start-offsetPaginationState.end-offset に設定されていて、返されたパジネーションの質が PaginationQuality.complete であることを確認してください。
page-height が負または無視できるほどである場合は、返されたパジネーション状態がオブジェクトの現在のパジネーション状態であり、返されたパジネーションの質が PaginationQuality.clipped-outside でなければなりません。
そうでない場合は、page-height が使用可能であれば、新しいページの PaginationState.start-offsetPaginationState.end-offset、および PaginationState.min-end-offset を計算して設定し、このパジネーション シーケンスにふさわしい PaginationQuality を返してください。
Box などのコンテナ (パジネーションによってその子をページ間で分割しないようにする場合)。このようなコンテナは、現行ページに子を収容できない場合は、次の 2 つのステップに従う必要があります。
1. その子が改ページしないように要求しているかどうかを調べる (Graphic.avoid-page-break? を参照)。要求している場合は、現行ページでこのグラフィックに使用できる高さが next-page-height より小さければ、その子を次のページに押し込みます。子を次のページに押し込むためには、コンテナがその現在の PaginationStatePaginationState.end-offset を、-{child.get-cell-bounds}.ascent である子の先頭に設定する必要があります。
2. 子にパジネーションを依頼し、返された PaginationQualityPaginationQuality.good 以上であれば、現行ページで子のパジネーションを開始する。そうでなければ、コンテナが、true として渡される query-only? と、独自の Graphic.paginate メソッドに渡された next-page-height として渡される page-height および next-page-heightとで Graphic.paginate メソッドを呼び出して子を次のページに押し込んだ場合に子のパジネーションが少なくとも PaginationQuality.good になるかどうかを調べる必要があります。PaginationQuality.good である場合は子を次のページに押し込み、そうでない場合は子が現行ページからパジネーションするようにします。
コンテナは、子グラフィックを直接パジネーションさせるのではなく、子グラフィックの Layout にパジネーションを依頼する必要があるので、注意してください。
以下は、Graphic.paginate がどのようにして実装されるかを示すコードです。
{method public open {paginate
page-height:Distance,
next-page-height:Distance,
query-only?:bool
}:(PaginationState, PaginationQuality)
let pstate:PaginationState = 
{self.get-pagination-state query-only?}
let bounds:GRect = pstate.bounds
let constant epsilon:Distance = epsilon-float * 1m

|| All done.
{if {abs bounds.descent - pstate.end-offset} < epsilon then
set pstate.start-offset = pstate.end-offset
{return pstate, PaginationQuality.complete}
}

|| No space left for the graphic.
{if page-height < epsilon then
{return pstate, PaginationQuality.clipped-outside}
}

let new-start-offset:Distance = pstate.min-end-offset
let new-end-offset:Distance = 
{min new-start-offset + page-height, bounds.descent}

{return
{pstate.advance-pagination
new-start-offset,
new-end-offset,
quality-if-not-complete = PaginationQuality.poor
}
}
}

注意事項

これは、Layout.paginate を呼び出したときに呼び出されます。