Contents Up Previous Next 原文へのリンク

wxTreeCtrl

ツリーコントロールは、情報を階層化して表現します。ツリーの各項目 (Item) を展開して、さらに項目を表示することができます。ツリーの項目は、wxTreeItemId というハンドラによって参照されます。wxTreeItemId::IsOk を呼び出すことで、有効な項目ハンドラであるかどうかを確認できます。

A tree control presents information as a hierarchy, with items that may be expanded to show further items. Items in a tree control are referenced by wxTreeItemId handles, which may be tested for validity by calling wxTreeItemId::IsOk.

ツリーコントロールからのイベントを割り込み処理するために、wxTreeEvent の項目で説明しているイベントテーブルマクロを使います。

To intercept events from a tree control, use the event table macros described in wxTreeEvent.

Derived from

wxControl
wxWindow
wxEvtHandler
wxObject

Include files

<wx/treectrl.h>

Window styles

wxTR_EDIT_LABELS
ツリーコントロールのラベルの編集を可能にしたいときには、このスタイルを用いる。
Use this style if you wish the user to be able to edit labels in the tree control.
wxTR_NO_BUTTONS
便宜的。ボタンが描かれないことを記載するため。
For convenience to document that no buttons are to be drawn.
wxTR_HAS_BUTTONS
親となる項目の左側に + や - のボタンを表示するときにこのスタイルを用いる。
Use this style to show + and - buttons to the left of parent items.
wxTR_TWIST_BUTTONS
親となる項目の左側に Mac 風のツイスターボタンを表示するときにこのスタイルを 用いる。 wxTR_HAS_BUTTONS と wxTR_TWIST_BUTTONS の両方が渡されると、ツイスターボタンが 生成される。ジェネリック版のみ。
Use this style to show Mac-style twister buttons to the left of parent items. If both wxTR_HAS_BUTTONS and wxTR_TWIST_BUTTONS are given, twister buttons are generated. Generic only.
wxTR_NO_LINES
垂直なレベル線を隠すときに、このスタイルを用いる。
Use this style to hide vertical level connectors.
wxTR_FULL_ROW_HIGHLIGHT
背景の色と選択字のハイライトを、ツリーコントロールのウインドウの横幅いっぱいに 広げるときに、このスタイルを使う。(このフラグは、Windows の下では xTR_NO_LINES とあわせて指定しなければ無視される。)
Use this style to have the background colour and the selection highlight extend over the entire horizontal row of the tree control window. (This flag is ignored under Windows unless you specify wxTR_NO_LINES as well.)
wxTR_LINES_AT_ROOT
ルートノード間に線を引きたいときにこのスタイルを用いる。 wxTR_HIDE_ROOT がセットされ、かつ wxTR_NO_LINES がセットされていないときにだけ、効果がある。
Use this style to show lines between root nodes. Only applicable if wxTR_HIDE_ROOT is set and wxTR_NO_LINES is not set.
wxTR_HIDE_ROOT
ルートノードを表示させないときに、このスタイルを用いる。 実質的には、第 1 レベルのノードが一連のルートノードのように見えることになる。
Use this style to suppress the display of the root node, effectively causing the first-level nodes to appear as a series of root nodes.
wxTR_ROW_LINES
行の間に境界線を表示したいときにこのスタイルを使う。
Use this style to draw a contrasting border between displayed rows.
wxTR_HAS_VARIABLE_ROW_HEIGHT
行の高さを内容にあわせて変化させるときに、このスタイルを用いる。 指定されなければ、すべての行は一番大きな行の高さを使う。 デフォルトでは、このフラグは指定されない。ジェネリック版のみ。
Use this style to cause row heights to be just big enough to fit the content. If not set, all rows use the largest row height. The default is that this flag is unset. Generic only.
wxTR_SINGLE
一度に一項目だけを選択できることを明示するための便宜的なフラグ。 別の項目を選ぶと、現在選ばれていたものがあっても、選択解除される。 これがデフォルトの振る舞いである。
For convenience to document that only one item may be selected at a time. Selecting another item causes the current selection, if any, to be deselected. This is the default.
wxTR_MULTIPLE
一連の項目範囲を選択可能にするために、このスタイルを用いる。 別の項目範囲を選ぶと、現在選ばれていた範囲があっても、選択解除される。
Use this style to allow a range of items to be selected. If a second range is selected, the current range, if any, is deselected.
wxTR_EXTENDED
隣接しない項目の選択を可能にする場合にこのスタイルを使用する。 (部分的にしか実装されていないので、すべての場合に動作するとは限らない。)
Use this style to allow disjoint items to be selected. (Only partially implemented; may not work in all cases.)
wxTR_DEFAULT_STYLE
(各プラットフォームに) 固有のツールキットの各コントロールの デフォルトに近いようなフラグの組み合わせとする。
The set of flags that are closest to the defaults for the native control for a particular toolkit.

See also window styles overview.

Event handling

ツリーコントロールからの入力を処理するために、以下のイベントハンドラマクロを用いて、wxTreeEvent を引数とするメンバー関数を指定すること。

To process input from a tree control, use these event handler macros to direct input to member functions that take a wxTreeEvent argument.

EVT_TREE_BEGIN_DRAG(id, func)
左マウスボタンによるドラッグ開始。
Begin dragging with the left mouse button.
EVT_TREE_BEGIN_RDRAG(id, func)
右マウスボタンによるドラッグ開始。
Begin dragging with the right mouse button.
EVT_TREE_BEGIN_LABEL_EDIT(id, func)
ラベルの編集を開始する。 Veto() を 呼び出すと、編集を始めさせない。
Begin editing a label. This can be prevented by calling Veto().
EVT_TREE_END_LABEL_EDIT(id, func)
ラベルの編集を終わる。Veto() を 呼び出すと、編集を終了させない。
注: 編集結果を反映させないで、編集を終了する。?
Finish editing a label. This can be prevented by calling Veto().
EVT_TREE_DELETE_ITEM(id, func)
項目の削除
Delete an item.
EVT_TREE_GET_INFO(id, func)
アプリケーションから情報を要求する。?
Request information from the application.
EVT_TREE_SET_INFO(id, func)
情報が与えられた。?
Information is being supplied.
EVT_TREE_ITEM_ACTIVATED(id, func)
項目がアクティベイトされた。つまり、ダブル・クリックで選ばれたか、キーボードから選択された。
The item has been activated, i.e. chosen by double clicking it with mouse or from keyboard
EVT_TREE_ITEM_COLLAPSED(id, func)
項目が折りたたまれた。
The item has been collapsed.
EVT_TREE_ITEM_COLLAPSING(id, func)
項目が折りたたまれようとしている。Veto() を呼び出して、これを拒否できる。
The item is being collapsed. This can be prevented by calling Veto().
EVT_TREE_ITEM_EXPANDED(id, func)
項目が展開された。
The item has been expanded.
EVT_TREE_ITEM_EXPANDING(id, func)
項目を展開しようとしている。Veto() を呼び出して、これを拒否できる。
The item is being expanded. This can be prevented by calling Veto().
EVT_TREE_SEL_CHANGED(id, func)
別の項目が選択された。
Selection has changed.
EVT_TREE_SEL_CHANGING(id, func)
別の項目を選択しようとしている。Veto() を呼び出して、これを拒否できる。
Selection is changing. This can be prevented by calling Veto().
EVT_TREE_KEY_DOWN(id, func)
キーが押された。
A key has been pressed.

See also

wxTreeItemData, wxTreeCtrl overview, wxListBox, wxListCtrl, wxImageList, wxTreeEvent

Win32 notes

Win32 下では、wxTreeCtrl クラスは、システムライブラリ comctl32.dll に実装されている通常のツリービューコントロールを利用する。このライブラリのいくつかのバージョンでは、ツリーコントロールの色の扱いにバグがあることが知られている。ふつうの症状は、特に標準的ではない背景色を用いたときに、展開された項目が黒い背景色のままである(あるいは、おかしな色をしている)というものである。お勧めの解決策は、 comctl32.dll を新しいバージョンのものにアップグレードすることである。 http://www.microsoft.com/msdownload/ieplatform/ie/comctrlx86.aspを参照。

wxTreeCtrl class uses the standard common treeview control under Win32 implemented in the system library comctl32.dll. Some versions of this library are known to have bugs with handling the tree control colours: the usual symptom is that the expanded items leave black (or otherwise incorrectly coloured) background behind them, especially for the controls using non default background colour. The recommended solution is to upgrade the comctl32.dll to a newer version: see http://www.microsoft.com/msdownload/ieplatform/ie/comctrlx86.asp.

Members

wxTreeCtrl::wxTreeCtrl
wxTreeCtrl::~wxTreeCtrl
wxTreeCtrl::AddRoot
wxTreeCtrl::AppendItem
wxTreeCtrl::AssignButtonsImageList
wxTreeCtrl::AssignImageList
wxTreeCtrl::AssignStateImageList
wxTreeCtrl::Collapse
wxTreeCtrl::CollapseAndReset
wxTreeCtrl::Create
wxTreeCtrl::Delete
wxTreeCtrl::DeleteAllItems
wxTreeCtrl::DeleteChildren
wxTreeCtrl::EditLabel
wxTreeCtrl::EndEditLabel
wxTreeCtrl::EnsureVisible
wxTreeCtrl::Expand
wxTreeCtrl::GetBoundingRect
wxTreeCtrl::GetButtonsImageList
wxTreeCtrl::GetChildrenCount
wxTreeCtrl::GetCount
wxTreeCtrl::GetEditControl
wxTreeCtrl::GetFirstChild
wxTreeCtrl::GetFirstVisibleItem
wxTreeCtrl::GetImageList
wxTreeCtrl::GetIndent
wxTreeCtrl::GetItemBackgroundColour
wxTreeCtrl::GetItemData
wxTreeCtrl::GetItemFont
wxTreeCtrl::GetItemImage
wxTreeCtrl::GetItemText
wxTreeCtrl::GetItemTextColour
wxTreeCtrl::GetLastChild
wxTreeCtrl::GetNextChild
wxTreeCtrl::GetNextSibling
wxTreeCtrl::GetNextVisible
wxTreeCtrl::GetItemParent
wxTreeCtrl::GetParent
wxTreeCtrl::GetPrevSibling
wxTreeCtrl::GetPrevVisible
wxTreeCtrl::GetRootItem
wxTreeCtrl::GetItemSelectedImage
wxTreeCtrl::GetSelection
wxTreeCtrl::GetSelections
wxTreeCtrl::GetStateImageList
wxTreeCtrl::HitTest
wxTreeCtrl::InsertItem
wxTreeCtrl::IsBold
wxTreeCtrl::IsExpanded
wxTreeCtrl::IsSelected
wxTreeCtrl::IsVisible
wxTreeCtrl::ItemHasChildren
wxTreeCtrl::OnCompareItems
wxTreeCtrl::PrependItem
wxTreeCtrl::ScrollTo
wxTreeCtrl::SelectItem
wxTreeCtrl::SetButtonsImageList
wxTreeCtrl::SetIndent
wxTreeCtrl::SetImageList
wxTreeCtrl::SetItemBackgroundColour
wxTreeCtrl::SetItemBold
wxTreeCtrl::SetItemData
wxTreeCtrl::SetItemFont
wxTreeCtrl::SetItemHasChildren
wxTreeCtrl::SetItemImage
wxTreeCtrl::SetItemSelectedImage
wxTreeCtrl::SetItemText
wxTreeCtrl::SetItemTextColour
wxTreeCtrl::SetStateImageList
wxTreeCtrl::SortChildren
wxTreeCtrl::Toggle
wxTreeCtrl::Unselect
wxTreeCtrl::UnselectAll


wxTreeCtrl::wxTreeCtrl

wxTreeCtrl()

デフォルトコンストラクタ。

Default constructor.

wxTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTR_HAS_BUTTONS, const wxValidator& validator = wxDefaultValidator, const wxString& name = "listCtrl")

ツリーコントロールを生成して表示するコンストラクタ。
Constructor, creating and showing a tree control.

Parameters

parent

id

pos

size

style

validator

name

See also

wxTreeCtrl::Create, wxValidator


wxTreeCtrl::~wxTreeCtrl

void ~wxTreeCtrl()

ツリーコントロールを破棄するデストラクタ。
Destructor, destroying the list control.


wxTreeCtrl::AddRoot

wxTreeItemId AddRoot(const wxString& text, int image = -1, int selImage = -1, wxTreeItemData* data = NULL)

ツリーにルートノードを加え、この新しい項目を返す。 パラメータ image および selImage は、非選択時および選択時に用いるイメージをノーマル・イメージ・リスト (normal image list) の中から指定する添え字である。 image > -1 かつ selImage が -1 なら、同じイメージが、選択時と非選択時の両方に用いられる。

Adds the root node to the tree, returning the new item.

The image and selImage parameters are an index within the normal image list specifying the image to use for unselected and selected items, respectively. If image > -1 and selImage is -1, the same image is used for both selected and unselected items.


wxTreeCtrl::AppendItem

wxTreeItemId AppendItem(const wxTreeItemId& parent, const wxString& text, int image = -1, int selImage = -1, wxTreeItemData* data = NULL)

parent からの枝に項目を追加して、追加された項目 id を返す。

パラメータ image および selImage は、 非選択時および選択時に用いるイメージをノーマル・イメージ・リスト (normal image list) の中から指定する添え字である。 image > -1 かつ selImage が -1 なら、同じイメージが、選択時と非選択時の両方に用いられる。

Appends an item to the end of the branch identified by parent, return a new item id.

The image and selImage parameters are an index within the normal image list specifying the image to use for unselected and selected items, respectively. If image > -1 and selImage is -1, the same image is used for both selected and unselected items.


wxTreeCtrl::AssignButtonsImageList

void AssignButtonsImageList(wxImageList* imageList)

ボタンイメージリストをセットする。このメソッドで指定されたボタンイメージは、wxTreeCtrl が適切に削除する。(すなわち、リストのオーナーシップに従う。)

ボタンイメージリストが、セットないしアサインされると イメージボタンの表示が指定される。 一度指定したあとに、ボタンイメージの表示を止めるには、 ボタンメージリストを NULL にセットすること。

この関数は、ジェネリック版でのみ、使用可能。

SetButtonsImageList を参照。

Sets the buttons image list. The button images assigned with this method will be automatically deleted by wxTreeCtrl as appropriate (i.e. it takes ownership of the list).

Setting or assigning the button image list enables the display of image buttons. Once enabled, the only way to disable the display of button images is to set the button image list to NULL.

This function is only available in the generic version.

See also SetButtonsImageList.


wxTreeCtrl::AssignImageList

void AssignImageList(wxImageList* imageList)

ノーマルイメージリストをセットする。このメソッドで指定されたイメージは、wxTreeCtrl が適切に削除する。(すなわち、リストのオーナーシップに従う。)

SetImageList を参照。

Sets the normal image list. Image list assigned with this method will be automatically deleted by wxTreeCtrl as appropriate (i.e. it takes ownership of the list).

See also SetImageList.


wxTreeCtrl::AssignStateImageList

void AssignStateImageList(wxImageList* imageList)

ステートイメージリストをセットする。このメソッドで指定されたイメージは、wxTreeCtrl が適切に削除する。(すなわち、リストのオーナーシップに従う。)

SetStateImageList を参照。

Sets the state image list. Image list assigned with this method will be automatically deleted by wxTreeCtrl as appropriate (i.e. it takes ownership of the list).

See also SetStateImageList.


wxTreeCtrl::Collapse

void Collapse(const wxTreeItemId& item)

指定された項目をたたむ。

Collapses the given item.


wxTreeCtrl::CollapseAndReset

void CollapseAndReset(const wxTreeItemId& item)

指定された項目をたたみ、すべての子項目を削除する。

Collapses the given item and removes all children.


wxTreeCtrl::Create

bool wxTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTR_HAS_BUTTONS, const wxValidator& validator = wxDefaultValidator, const wxString& name = "listCtrl")

ツリーコントロールを生成する。詳細は、wxTreeCtrl::wxTreeCtrl を参照。

Creates the tree control. See wxTreeCtrl::wxTreeCtrl for further details.


wxTreeCtrl::Delete

void Delete(const wxTreeItemId& item)

指定された項目を削除する。イベント EVT_TREE_DELETE_ITEM が生じる。

Deletes the specified item. A EVT_TREE_DELETE_ITEM event will be generated.


wxTreeCtrl::DeleteAllItems

void DeleteAllItems()

コントロールのすべての項目を削除する。Deleteメソッドとは異なり、イベントは何も生じない。

Deletes all the items in the control. Note that this will not generate any events unlike Delete method.


wxTreeCtrl::DeleteChildren

void DeleteChildren(const wxTreeItemId& item)

指定された項目のすべての子を削除する。(自分自身は削除されない。) Deleteメソッドとは異なり、イベントは何も生じない。

Deletes all children of the given item (but not the item itself). Note that this will not generate any events unlike Delete method.


wxTreeCtrl::EditLabel

void EditLabel(const wxTreeItemId& item)

指定された項目についてラベルの編集を開始する。この関数は、EVT_TREE_BEGIN_LABEL_EDIT イベントを生成するが、このイベントを拒否(veto()) して、その場編集ができないように振舞わせることもできる。ユーザがラベルを変更したら、(ESC が押されず、テキストコントロールに変更が加えられていたら)、EVT_TREE_END_LABEL_EDIT イベントが生成される。これにたいしてもまた拒否 (veto()) することができる。

Starts editing the label of the given item. This function generates a EVT_TREE_BEGIN_LABEL_EDIT event which can be vetoed so that no text control will appear for in-place editing.

If the user changed the label (i.e. s/he does not press ESC or leave the text control without changes, a EVT_TREE_END_LABEL_EDIT event will be sent which can be vetoed as well.

See also

wxTreeCtrl::EndEditLabel, wxTreeEvent


wxTreeCtrl::EndEditLabel

void EndEditLabel(bool cancelEdit)

ラベルの編集を終了する。cancelEdit が TRUE のとき、編集結果はキャンセルされる。

現時点では、Windows 下でのみサポートされている。

Ends label editing. If cancelEdit is TRUE, the edit will be cancelled.

This function is currently supported under Windows only.

See also

wxTreeCtrl::EditLabel


wxTreeCtrl::EnsureVisible

void EnsureVisible(const wxTreeItemId& item)

スクロールしたり項目を展開することで、指定された項目を可視な状態 (visible) にする。

Scrolls and/or expands items to ensure that the given item is visible.


wxTreeCtrl::Expand

void Expand(const wxTreeItemId& item)

指定された項目を展開する。

Expands the given item.


wxTreeCtrl::GetBoundingRect

bool GetBoundingRect(const wxTreeItemId& item, wxRect& rect, bool textOnly = FALSE) const

item を囲む矩形を取得する。textOnly が TRUE であれば項目ラベルを囲む矩形だけが返され、それ以外のときには項目のイメージも含まれる。

矩形領域が取得できれば TRUE を返し、例えば指定した項目が現在不可視の場合には失敗して FALSE となる。(この場合、rect は変化しない。)

Retrieves the rectangle bounding the item. If textOnly is TRUE, only the rectangle around the item's label will be returned, otherwise the item's image is also taken into account.

The return value is TRUE if the rectangle was successfully retrieved or FALSE if it was not (in this case rect is not changed) - for example, if the item is currently invisible.

wxPython note:
wxPython バージョンのこのメソッドには、 itemtextOnly だけが必要である。返り値は、 wxRect オブジェクトまたは Noneとなる。

The wxPython version of this method requires only the item and textOnly parameters. The return value is either a wxRect object or None.

wxPerl note:
wxPerl では、このメソッドは、 itemtextOnly だけをパラメータとし、Wx::Rect (または undef ) を返す。

In wxPerl this method only takes the parameters item and textOnly, and returns a Wx::Rect ( or undef ).


wxTreeCtrl::GetButtonsImageList

wxImageList* GetButtonsImageList() const

ボタンイメージリスト(このリストからアプリケーションで定義するボタンイメージを取得する)を返す。

この関数は、ジェネリック版でのみ利用できる。。

Returns the buttons image list (from which application-defined button images are taken).

This function is only available in the generic version.


wxTreeCtrl::GetChildrenCount

size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = TRUE) const

枝に連なる項目の個数を返す。 recursively が TRUE のときには子孫すべての個数を返し、 そうでなければ 1 代の子だけを数える。

Returns the number of items in the branch. If recursively is TRUE, returns the total number of descendants, otherwise only one level of children is counted.


wxTreeCtrl::GetCount

int GetCount() const

コントロールの項目数を返す。

Returns the number of items in the control.


wxTreeCtrl::GetEditControl

wxTextCtrl& GetEditControl() const

ラベルを編集するために用いるエディットコントロールを返す。

Returns the edit control used to edit a label.


wxTreeCtrl::GetFirstChild

wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& cookie) const

一番最初の子供を返す。さらに wxTreeCtrl::GetNextChild を呼び出すと、次の子供が取得できる。

これらの列挙する関数には、「クッキー」パラメータを渡さなければならない。 「クッキー」パラメータは、アプリケーションには透過 (意味をもたない) が、ライブラリがこれらの関数の繰り返しの呼び出しをできるようにするために必要である。 (すなわち、ひとつの同じオブジェクトにたいして、 同時に複数の列挙関数呼び出しが可能になる。) 関数 GetFirstChild と GetNextChild に渡されるクッキーは、同じ変数でなければならない。

それ以上子供がいないときには、無効なツリー項目を返す。

wxTreeItemId::IsOk を呼び出して有効か無効かを調べることができる。
Returns the first child; call wxTreeCtrl::GetNextChild for the next child.

For this enumeration function you must pass in a 'cookie' parameter which is opaque for the application but is necessary for the library to make these functions reentrant (i.e. allow more than one enumeration on one and the same object simultaneously). The cookie passed to GetFirstChild and GetNextChild should be the same variable.

Returns an invalid tree item if there are no further children.

See also

wxTreeCtrl::GetNextChild, wxTreeCtrl::GetNextSibling

wxPython note:

wxPython では、wxTreeItemId と新しいクッキーとが、 2 変数のタプルとして返される。

In wxPython the returned wxTreeItemId and the new cookie value are both returned as a tuple containing the two values.

wxPerl note:
wxPerl では、このメソッドには、パラメータ item だけを渡すと、 2 要素のリスト ( item, cookie ) が返される。

In wxPerl this method only takes the item parameter, and returns a 2-element list ( item, cookie ).


wxTreeCtrl::GetFirstVisibleItem

wxTreeItemId GetFirstVisibleItem() const

可視な項目の中でいちばん最初のものを返す。

Returns the first visible item.


wxTreeCtrl::GetImageList

wxImageList* GetImageList() const

ノーマルイメージリストを返す。
Returns the normal image list.


wxTreeCtrl::GetIndent

int GetIndent() const

現在のツリーコントロールのインデンテーションを返す。

Returns the current tree control indentation.


wxTreeCtrl::GetItemBackgroundColour

wxColour GetItemBackgroundColour(const wxTreeItemId& item) const

項目の背景色を返す。

Returns the background colour of the item.


wxTreeCtrl::GetItemData

wxTreeItemData* GetItemData(const wxTreeItemId& item) const

指定項目に関連付けられた項目データを返す。

Returns the tree item data associated with the item.

See also

wxTreeItemData

wxPython note:

wxPython では、以下のショートカットが提供される:
wxPython provides the following shortcut method:

wxPerl note:

wxPerl では、以下のショートカットが提供される:
wxPerl provides the following shortcut method:


wxTreeCtrl::GetItemFont

wxFont GetItemFont(const wxTreeItemId& item) const

項目ラベルのフォントを返す。

Returns the font of the item label.


wxTreeCtrl::GetItemImage

int GetItemImage(const wxTreeItemId& item, wxTreeItemIcon which = wxTreeItemIcon_Normal) const

指定された項目イメージの取得。値 which は以下のいずれか:

Gets the specified item image. The value of which may be:


wxTreeCtrl::GetItemText

wxString GetItemText(const wxTreeItemId& item) const

項目ラベルを返す。

Returns the item label.


wxTreeCtrl::GetItemTextColour

wxColour GetItemTextColour(const wxTreeItemId& item) const

項目ラベルの色を返す。

Returns the colour of the item label.


wxTreeCtrl::GetLastChild

wxTreeItemId GetLastChild(const wxTreeItemId& item) const

項目の一番最後の子供を返す。(子供がいないときには、無効なツリー項目を返す。)

wxTreeItemId::IsOk を呼び出して有効か無効かを調べることができる。
Returns the last child of the item (or an invalid tree item if this item has no children).

See also

GetFirstChild, wxTreeCtrl::GetNextSibling, GetLastChild


wxTreeCtrl::GetNextChild

wxTreeItemId GetNextChild(const wxTreeItemId& item, long& cookie) const

次の子供を返す。最初の子供をwxTreeCtrl::GetFirstChild で取得したあとに使う。

この列挙する関数には、「クッキー」パラメータを渡さなければならない。 「クッキー」パラメータは、アプリケーションには透過 (意味をもたない) が、ライブラリがこれらの関数の繰り返しの呼び出しをできるようにするために必要である。 (すなわち、ひとつの同じオブジェクトにたいして、 同時に複数の列挙関数呼び出しが可能になる。)

関数 GetFirstChild と GetNextChild に渡されるクッキーは、同じ変数でなければならない。

それ以上子供がいないときには、無効なツリー項目を返す。

wxTreeItemId::IsOk を呼び出して有効か無効かを調べることができる。
Returns the next child; call wxTreeCtrl::GetFirstChild for the first child.

For this enumeration function you must pass in a 'cookie' parameter which is opaque for the application but is necessary for the library to make these functions reentrant (i.e. allow more than one enumeration on one and the same object simultaneously). The cookie passed to GetFirstChild and GetNextChild should be the same.

Returns an invalid tree item if there are no further children.

See also

wxTreeCtrl::GetFirstChild

wxPython note:

wxPython では、wxTreeItemId と新しいクッキーとが、 2 変数のタプルとして返される。

In wxPython the returned wxTreeItemId and the new cookie value are both returned as a tuple containing the two values.

wxPerl note:
wxPerl では、このメソッドには、パラメータ item だけを渡すと、 2 要素のリスト ( item, cookie ) が返される。

In wxPerl this method returns a 2-element list ( item, cookie ), instead of modifying its parameters.


wxTreeCtrl::GetNextSibling

wxTreeItemId GetNextSibling(const wxTreeItemId& item) const

指定された項目の次の弟を返す。 wxTreeCtrl::GetPrevSibling をもちいれば、直前の兄を取得できる。 それ以上弟がいないときには、無効なツリー項目を返す。

wxTreeItemId::IsOk を呼び出して有効か無効かを調べることができる。
Returns the next sibling of the specified item; call wxTreeCtrl::GetPrevSibling for the previous sibling.

Returns an invalid tree item if there are no further siblings.

See also

wxTreeCtrl::GetPrevSibling


wxTreeCtrl::GetNextVisible

wxTreeItemId GetNextVisible(const wxTreeItemId& item) const

次の可視な項目を返す。

Returns the next visible item.


wxTreeCtrl::GetItemParent

wxTreeItemId GetItemParent(const wxTreeItemId& item) const

項目の親を返す。
Returns the item's parent.


wxTreeCtrl::GetParent

wxTreeItemId GetParent(const wxTreeItemId& item) const

NOTE: この関数は、推奨されない。WXWIN_COMPATIBILITY_2_2 が定義されているときにだけ動作する。代わりに、 wxTreeCtrl::GetItemParent を用いる。

NOTE: This function is deprecated and will only work if WXWIN_COMPATIBILITY_2_2 is defined. Use wxTreeCtrl::GetItemParent instead.

Returns the item's parent.

wxPython note:
wxWindow::GetParent との名前の衝突を避けるため、GetItemParent という 名前になっている。
This method is named GetItemParent to avoid a name clash with wxWindow::GetParent.


wxTreeCtrl::GetPrevSibling

wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const

指定された項目の前の兄を返す。 wxTreeCtrl::GetNextSibling をもちいれば、直後の弟を取得できる。 それ以上兄がいないときには、無効なツリー項目を返す。

wxTreeItemId::IsOk を呼び出して有効か無効かを調べることができる。
Returns the previous sibling of the specified item; call wxTreeCtrl::GetNextSibling for the next sibling.

Returns an invalid tree item if there are no further children.

See also

wxTreeCtrl::GetNextSibling


wxTreeCtrl::GetPrevVisible

wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const

直前の可視な項目を返す。
Returns the previous visible item.


wxTreeCtrl::GetRootItem

wxTreeItemId GetRootItem() const

ツリーコントロールのルート項目を返す。

Returns the root item for the tree control.


wxTreeCtrl::GetItemSelectedImage

int GetItemSelectedImage(const wxTreeItemId& item) const

選択時の項目イメージを取得。(この関数は旧型なので、かわりに GetItemImage(item, wxTreeItemIcon_Selected を用いること。)
Gets the selected item image (this function is obsolete, use GetItemImage(item, wxTreeItemIcon_Selected) instead).


wxTreeCtrl::GetSelection

wxTreeItemId GetSelection() const

選択された項目を返す。何も選ばれていなければ、無効な項目を返す。 この関数は、wxTR_MULTIPLE スタイルを使用していないコントロールにたいしてのみ 有効である。wxTR_MULTIPLE スタイルのコントロールにたいしては、 GetSelections を使用する。

Returns the selection, or an invalid item if there is no selection. This function only works with the controls without wxTR_MULTIPLE style, use GetSelections for the controls which do have this style.


wxTreeCtrl::GetSelections

size_t GetSelections(wxArrayTreeItemIds& selection) const

ツリー項目の配列に、現在選択されている項目が返される。 コントロールが wxTR_MULTIPLE スタイルのときに、呼び出し可能。

選択されている項目の数を返す。

Fills the array of tree items passed in with the currently selected items. This function can be called only if the control has the wxTR_MULTIPLE style.

Returns the number of selected items.

wxPython note:
wxPython バージョンでは、パラメータは不要で、wxTreeItemId の Python リストが返される。
The wxPython version of this method accepts no parameters and returns a Python list of wxTreeItemIds.

wxPerl note:
wxPerl バージョンでは、パラメータは不要で、Wx::wxTreeItemId の リストが返される。
In wxPerl this method takes no parameters and returns a list of Wx::TreeItemIds.


wxTreeCtrl::GetStateImageList

wxImageList* GetStateImageList() const

ステートイメージリスト(ここから、アプリケーションで定義されるステートイメージは取得される。)が返される。

Returns the state image list (from which application-defined state images are taken).


wxTreeCtrl::HitTest

wxTreeItemId HitTest(const wxPoint& point, int& flags)

与えられた点の下に、何か項目があれば、ツリー項目の id と特別な flags 情報を返す。

Calculates which (if any) item is under the given point, returning the tree item id at this point plus extra information flags. flags is a bitlist of the following:

wxTREE_HITTEST_ABOVE
クライアント領域より上
Above the client area.
wxTREE_HITTEST_BELOW
クライアント領域より下
Below the client area.
wxTREE_HITTEST_NOWHERE
クライアントエリア内ではあるが、最後の項目よりも下
In the client area but below the last item.
wxTREE_HITTEST_ONITEMBUTTON
項目と関係付けられているボタン上
On the button associated with an item.
wxTREE_HITTEST_ONITEMICON
項目と関係付けられているビットマップ上
On the bitmap associated with an item.
wxTREE_HITTEST_ONITEMINDENT
項目と関係付けられている字下げ領域
In the indentation associated with an item.
wxTREE_HITTEST_ONITEMLABEL
項目と関係付けられているラベル(文字列)
On the label (string) associated with an item.
wxTREE_HITTEST_ONITEMRIGHT
項目の右側の場所
In the area to the right of an item.
wxTREE_HITTEST_ONITEMSTATEICON
ツリービューの中で、ユーザー定義されたステートアイコン
On the state icon for a tree view item that is in a user-defined state.
wxTREE_HITTEST_TOLEFT
クライアント領域の右側
To the right of the client area.
wxTREE_HITTEST_TORIGHT
クライアント領域の左側
To the left of the client area.

wxPython note:

wxPython では、wxTreeItemId と フラグの両方がタプルとして返される。

in wxPython both the wxTreeItemId and the flags are returned as a tuple.

wxPerl note:
wxPerl では、パラメータ point だけを受け取り、2 要素のリスト ( item, flags ) を返す。

In wxPerl this method only takes the point parameter and returns a 2-element list ( item, flags ).


wxTreeCtrl::InsertItem

wxTreeItemId InsertItem(const wxTreeItemId& parent, const wxTreeItemId& previous, const wxString& text, int image = -1, int selImage = -1, wxTreeItemData* data = NULL)

wxTreeItemId InsertItem(const wxTreeItemId& parent, size_t before, const wxString& text, int image = -1, int selImage = -1, wxTreeItemData* data = NULL)

指定した項目 (previous) の後ろに新しい項目を挿入、 または場所 (before) を指定して、その前に項目を挿入する。

パラメータ image および selImage は、インデックスであり、 ノーマルイメージリストの中から、非選択時と選択時に用いるイメージを指定する。 image > -1 かつ selImage が -1 のときには、非選択時と選択時の両方に同じイメージが用いられる。

Inserts an item after a given one (previous) or before one identified by its position (before).

The image and selImage parameters are an index within the normal image list specifying the image to use for unselected and selected items, respectively. If image > -1 and selImage is -1, the same image is used for both selected and unselected items.

wxPython note:
wxPython では、第 2 の様式は InsertItemBefore とする。
The second form of this method is called InsertItemBefore in wxPython.


wxTreeCtrl::IsBold

bool IsBold(const wxTreeItemId& item) const

指定された項目がボールド状態なら TRUE を返す。

Returns TRUE if the given item is in bold state.

See also: SetItemBold


wxTreeCtrl::IsExpanded

bool IsExpanded(const wxTreeItemId& item) const

指定された項目が展開されていれば、TRUE を返す。 (子供がいなければ意味をなさない)

Returns TRUE if the item is expanded (only makes sense if it has children).


wxTreeCtrl::IsSelected

bool IsSelected(const wxTreeItemId& item) const

指定された項目が選択されていれば、TRUE を返す。

Returns TRUE if the item is selected.


wxTreeCtrl::IsVisible

bool IsVisible(const wxTreeItemId& item) const

指定された項目が可視ならば、TRUE を返す。 (ウインドウの中に見えないことや、折りたたまれていることがあるので)

Returns TRUE if the item is visible (it might be outside the view, or not expanded).


wxTreeCtrl::ItemHasChildren

bool ItemHasChildren(const wxTreeItemId& item) const

指定された項目に子供があれば、TRUE を返す。

Returns TRUE if the item has children.


wxTreeCtrl::OnCompareItems

int OnCompareItems(const wxTreeItemId& item1, const wxTreeItemId& item2)

派生クラスで、ツリーコントロールの項目をソートするときの 並べ順を変えるためには、この関数をオーバーライドする。 この関数は、項目 1 が項目 2 と比べて、小さい/等しい/大きいとき、負/ゼロ/正の値を返す。 基底クラスのバージョンでは、辞書順で項目を比較する。

Override this function in the derived class to change the sort order of the items in the tree control. The function should return a negative, zero or positive value if the first item is less than, equal to or greater than the second one.

The base class version compares items alphabetically.

See also: SortChildren


wxTreeCtrl::PrependItem

wxTreeItemId PrependItem(const wxTreeItemId& parent, const wxString& text, int image = -1, int selImage = -1, wxTreeItemData* data = NULL)

指定した項目 parent の最初の子供として、項目を挿入しその項目 id を返す。

パラメータ image および selImage は、インデックスであり、 非選択時と選択時に用いるイメージを、ノーマルイメージリストの中から指定する。 image > -1 かつ selImage が -1 のときには、非選択時と選択時の両方に同じイメージが用いられる。

Appends an item as the first child of parent, return a new item id.

The image and selImage parameters are an index within the normal image list specifying the image to use for unselected and selected items, respectively. If image > -1 and selImage is -1, the same image is used for both selected and unselected items.


wxTreeCtrl::ScrollTo

void ScrollTo(const wxTreeItemId& item)

指定された項目が見えるまでスクロールする。

Scrolls the specified item into view.


wxTreeCtrl::SelectItem

bool SelectItem(const wxTreeItemId& item)

指定された項目を選択する。

Selects the given item.


wxTreeCtrl::SetButtonsImageList

void SetButtonsImageList(wxImageList* imageList)

ボタンイメージリストをセットする。(ここから、アプリケーション定義のボタンイメージが取得される。) wxTreeCtrl のデストラクタは、 このメソッドで指定されたイメージリストを破棄しないので、 自分で削除すること。

ボタンイメージリストをセットあるいはアサインすることで、イメージボタンの 表示が指定される。一度、指定したあとに、ボタンイメージの表示を止めるには、 ボタンメージリストを NULL に指定すること。

この関数は、ジェネリック版のみ。

Sets the buttons image list (from which application-defined button images are taken). The button images assigned with this method will not be deleted by wxTreeCtrl's destructor, you must delete it yourself.

Setting or assigning the button image list enables the display of image buttons. Once enabled, the only way to disable the display of button images is to set the button image list to NULL.

This function is only available in the generic version.

See also AssignButtonsImageList.


wxTreeCtrl::SetIndent

void SetIndent(int indent)

ツリーコントロールの字下げを指定する。
Sets the indentation for the tree control.


wxTreeCtrl::SetImageList

void SetImageList(wxImageList* imageList)

ノーマルイメージリストをセットする。 wxTreeCtrl のデストラクタは、 このメソッドで指定されたイメージリストを破棄しないので、 自分で削除すること。

Sets the normal image list. Image list assigned with this method will not be deleted by wxTreeCtrl's destructor, you must delete it yourself.

See also AssignImageList.


wxTreeCtrl::SetItemBackgroundColour

void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col)

項目の背景色を指定する。

Sets the colour of the item's background.


wxTreeCtrl::SetItemBold

void SetItemBold(const wxTreeItemId& item, bool bold = TRUE)

パラメータ bold が TRUE のとき、項目をボールドフォントで表示させる。 あるいは、ノーマルに戻す。

Makes item appear in bold font if bold parameter is TRUE or resets it to the normal state.

See also: IsBold


wxTreeCtrl::SetItemData

void SetItemData(const wxTreeItemId& item, wxTreeItemData* data)

項目に、(クライアントの) データをセットする。
Sets the item client data.

wxPython note:
wxPython では、以下のショートカットメソッドがある:

wxPython provides the following shortcut method:

wxPerl note:

wxPerl では、以下のショートカットメソッドがある:

wxPerl provides the following shortcut method:


wxTreeCtrl::SetItemFont

void SetItemFont(const wxTreeItemId& item, const wxFont& font)

項目のフォントをセットする。 ツリーのすべての項目が同じ高さでないとテキストがクリップされるので、すべての項目において、フォントの高さは同じでなければならない。フォントの属性は異なっていてもよい。
Sets the item's font. All items in the tree should have the same height to avoid text clipping, so the fonts height should be the same for all of them, although font attributes may vary.

See also

SetItemBold


wxTreeCtrl::SetItemHasChildren

void SetItemHasChildren(const wxTreeItemId& item, bool hasChildren = TRUE)

項目わきのボタンの外見を(子供ありの状態に) 定める。 子供を持ない項目をユーザに展開させるときに役立つ。 必要に応じて子供を付け加えることで、メモリの消費と 読み込み時間を節約できる。
Force appearance of the button next to the item. This is useful to allow the user to expand the items which don't have any children now, but instead adding them only when needed, thus minimizing memory usage and loading time.


wxTreeCtrl::SetItemImage

void SetItemImage(const wxTreeItemId& item, int image, wxTreeItemIcon which = wxTreeItemIcon_Normal)

指定された項目イメージをセットする。 パラメータ which の説明については、 GetItemImage を参照。

Sets the specified item image. See GetItemImage for the description of the which parameter.


wxTreeCtrl::SetItemSelectedImage

void SetItemSelectedImage(const wxTreeItemId& item, int selImage)

項目の選択時イメージをセットする。 (この関数は旧式なので、代わりに SetItemImage(item, wxTreeItemIcon_Selected)を使うこと。)

Sets the selected item image (this function is obsolete, use SetItemImage(item, wxTreeItemIcon_Selected) instead).


wxTreeCtrl::SetItemText

void SetItemText(const wxTreeItemId& item, const wxString& text)

項目ラベルをセットする。

Sets the item label.


wxTreeCtrl::SetItemTextColour

void SetItemTextColour(const wxTreeItemId& item, const wxColour& col)

項目のテキストの色をセットする。

Sets the colour of the item's text.


wxTreeCtrl::SetStateImageList

void SetStateImageList(wxImageList* imageList)

ステートイメージリストをセットする。(ここから、アプリケーション定義のステートイメージが取得される。) wxTreeCtrl のデストラクタは、 このメソッドで指定されたイメージリストを破棄しないので、 自分で破棄すること。

Sets the state image list (from which application-defined state images are taken). Image list assigned with this method will not be deleted by wxTreeCtrl's destructor, you must delete it yourself.

See also AssignStateImageList.

wxTreeCtrl::SetWindowStyle

void SetWindowStyle(longstyles)

ツリーコントロールの表示に関わるフラグをセットする。 新たなモードは直ちに有効になる。 (ジェネリック版のみである; MSW では変更は無視される。)

Sets the mode flags associated with the display of the tree control. The new mode takes effect immediately. (Generic only; MSW ignores changes.)


wxTreeCtrl::SortChildren

void SortChildren(const wxTreeItemId& item)

指定された項目の子供を、wxTreeCtrl の OnCompareItems メソッドでソートする。 ソート順を変更するためには、このメソッドをオーバーライドしなければならない。 (デフォルトは、辞書順の昇順)

Sorts the children of the given item using OnCompareItems method of wxTreeCtrl. You should override that method to change the sort order (the default is ascending alphabetical order).

See also

wxTreeItemData, OnCompareItems


wxTreeCtrl::Toggle

void Toggle(const wxTreeItemId& item)

指定の項目について、折りたたみ状態と展開状態をトグルで切り替える。

Toggles the given item between collapsed and expanded states.


wxTreeCtrl::Unselect

void Unselect()

現在選択された項目があれば、この選択を解除する。

Removes the selection from the currently selected item (if any).


wxTreeCtrl::UnselectAll

void UnselectAll()

この関数は、コントロールが wxTR_MULTIPLE スタイルでなければ、Unselect と同様に振舞う。 また、この wxTR_MULTIPLE スタイルであれば、すべての項目を選択解除する。

This function either behaves the same as Unselect if the control doesn't have wxTR_MULTIPLE style, or removes the selection from all items if it does have this style.