檢視原始碼 wxTreebook (wx v2.4.3)

這個類別是 wxNotebook 類別的延伸,允許在控制項中顯示樹狀結構的頁面集合。

一個典型的例子是 Netscape 的偏好設定對話框,它在左側顯示偏好設定區塊的樹狀結構,並在右側顯示選定的區塊頁面。

要使用這個類別,只需建立它並使用 insertPage/5insertSubPage/5addPage/4AddSubPage() (在 wx 中未實作) 來填入頁面。

如果您的樹狀結構深度不超過 1 層,那麼您可以簡單地使用 addPage/4AddSubPage() (在 wx 中未實作) 來依序填入您的樹狀結構,方法是在每一步驟中將一個頁面或子頁面添加到樹狀結構的末端。

請參閱

這個類別繼承自以下類別,並可使用它們的函數:

wxWidgets 文件:wxTreebook

事件

從這個類別發出的事件類型

摘要

函數

新增一個頁面。

在索引標籤之間循環。

設定頁面控制項的圖像清單並取得該清單的所有權。

將選取項目變更為指定的頁面,並傳回先前的選取項目。

建立一個 treebook 控制項。

刪除所有頁面。

銷毀物件

展開(摺疊)pageId 節點。

傳回目前選取的頁面,如果沒有選取則傳回 NULL。

傳回關聯的圖像清單,可能為 NULL。

傳回指定頁面位置的視窗。

傳回控制項中的頁面數量。

傳回指定頁面的圖像索引。

傳回指定頁面的字串。

傳回目前選取的頁面,如果沒有選取則傳回 wxNOT\_FOUND

傳回指定位置的索引標籤索引,如果沒有則傳回 wxNOT\_FOUND

pagePos 指示的頁面之前插入一個新頁面。

在指定的頁面下插入一個子頁面。

如果 pageId 代表的頁面已展開,則傳回 true。

預設建構子。

建立一個空的 wxTreebook

設定要使用的圖像清單。

設定指定頁面的圖像索引。

設定頁面的寬度和高度。

設定指定頁面的文字。

將選取項目設定為指定的頁面,並傳回先前的選取項目。

類型

-type wxTreebook() :: wx:wx_object().

函數

連結到這個函數

addPage(This, Page, Text)

檢視原始碼
-spec addPage(This, Page, Text) -> boolean()
                 when This :: wxTreebook(), Page :: wxWindow:wxWindow(), Text :: unicode:chardata().

等同於 addPage(This, Page, Text, [])

-spec addPage(This, Page, Text, [Option]) -> boolean()
                 when
                     This :: wxTreebook(),
                     Page :: wxWindow:wxWindow(),
                     Text :: unicode:chardata(),
                     Option :: {bSelect, boolean()} | {imageId, integer()}.

新增一個頁面。

該頁面放置在所有其他頁面之後的最上層。可以為頁面指定 NULL 以建立一個空頁面。

-spec advanceSelection(This) -> ok when This :: wxTreebook().

等同於 advanceSelection(This, [])

-spec advanceSelection(This, [Option]) -> ok when This :: wxTreebook(), Option :: {forward, boolean()}.

在索引標籤之間循環。

呼叫此函數會產生頁面變更事件。

連結到這個函數

assignImageList(This, ImageList)

檢視原始碼
-spec assignImageList(This, ImageList) -> ok
                         when This :: wxTreebook(), ImageList :: wxImageList:wxImageList().

設定頁面控制項的圖像清單並取得該清單的所有權。

請參閱

連結到這個函數

changeSelection(This, Page)

檢視原始碼
-spec changeSelection(This, Page) -> integer() when This :: wxTreebook(), Page :: integer().

將選取項目變更為指定的頁面,並傳回先前的選取項目。

此函數的行為與 setSelection/2 相同,但不會產生頁面變更事件。

如需更多資訊,請參閱 overview_events_prog。

連結到這個函數

create(This, Parent, Id)

檢視原始碼
-spec create(This, Parent, Id) -> boolean()
                when This :: wxTreebook(), Parent :: wxWindow:wxWindow(), Id :: integer().

等同於 create(This, Parent, Id, [])

-spec create(This, Parent, Id, [Option]) -> boolean()
                when
                    This :: wxTreebook(),
                    Parent :: wxWindow:wxWindow(),
                    Id :: integer(),
                    Option ::
                        {pos, {X :: integer(), Y :: integer()}} |
                        {size, {W :: integer(), H :: integer()}} |
                        {style, integer()}.

建立一個 treebook 控制項。

有關參數的說明,請參閱 new/3

-spec deleteAllPages(This) -> boolean() when This :: wxTreebook().

刪除所有頁面。

-spec destroy(This :: wxTreebook()) -> ok.

銷毀物件

連結到這個函數

expandNode(This, PageId)

檢視原始碼
-spec expandNode(This, PageId) -> boolean() when This :: wxTreebook(), PageId :: integer().

等同於 expandNode(This, PageId, [])

-spec expandNode(This, PageId, [Option]) -> boolean()
                    when This :: wxTreebook(), PageId :: integer(), Option :: {expand, boolean()}.

展開(摺疊)pageId 節點。

傳回先前的狀態。可能會產生頁面變更事件(如果選取的頁面位於摺疊的分支下,則會自動選取其父項)。

-spec getCurrentPage(This) -> wxWindow:wxWindow() when This :: wxTreebook().

傳回目前選取的頁面,如果沒有選取則傳回 NULL。

-spec getImageList(This) -> wxImageList:wxImageList() when This :: wxTreebook().

傳回關聯的圖像清單,可能為 NULL。

請參閱

-spec getPage(This, Page) -> wxWindow:wxWindow() when This :: wxTreebook(), Page :: integer().

傳回指定頁面位置的視窗。

-spec getPageCount(This) -> integer() when This :: wxTreebook().

傳回控制項中的頁面數量。

連結到這個函數

getPageImage(This, NPage)

檢視原始碼
-spec getPageImage(This, NPage) -> integer() when This :: wxTreebook(), NPage :: integer().

傳回指定頁面的圖像索引。

連結到這個函數

getPageText(This, NPage)

檢視原始碼
-spec getPageText(This, NPage) -> unicode:charlist() when This :: wxTreebook(), NPage :: integer().

傳回指定頁面的字串。

-spec getSelection(This) -> integer() when This :: wxTreebook().

傳回目前選取的頁面,如果沒有選取則傳回 wxNOT\_FOUND

注意:此方法從 EVT_TREEBOOK_PAGE_CHANGED() 處理常式呼叫時,可能會根據平台傳回先前或新選取的頁面,因此在這種情況下應改用 wxBookCtrlEvent:getSelection/1

-spec hitTest(This, Pt) -> Result
                 when
                     Result :: {Res :: integer(), Flags :: integer()},
                     This :: wxTreebook(),
                     Pt :: {X :: integer(), Y :: integer()}.

傳回指定位置的索引標籤索引,如果沒有則傳回 wxNOT\_FOUND

如果 flags 參數為非 NULL,則也會傳回點在索引標籤內的位置。

傳回:傳回從零開始的索引標籤索引,如果指定位置沒有索引標籤則傳回 wxNOT_FOUND

連結到這個函數

insertPage(This, PagePos, Page, Text)

檢視原始碼
-spec insertPage(This, PagePos, Page, Text) -> boolean()
                    when
                        This :: wxTreebook(),
                        PagePos :: integer(),
                        Page :: wxWindow:wxWindow(),
                        Text :: unicode:chardata().

等同於 insertPage(This, PagePos, Page, Text, [])

-spec insertPage(This, PagePos, Page, Text, [Option]) -> boolean()
                    when
                        This :: wxTreebook(),
                        PagePos :: integer(),
                        Page :: wxWindow:wxWindow(),
                        Text :: unicode:chardata(),
                        Option :: {bSelect, boolean()} | {imageId, integer()}.

pagePos 指示的頁面之前插入一個新頁面。

新頁面放置在 pagePos 頁面之前,並且在同一層級。可以為頁面指定 NULL 以建立一個空頁面。

連結到這個函數

insertSubPage(This, PagePos, Page, Text)

檢視原始碼
-spec insertSubPage(This, PagePos, Page, Text) -> boolean()
                       when
                           This :: wxTreebook(),
                           PagePos :: integer(),
                           Page :: wxWindow:wxWindow(),
                           Text :: unicode:chardata().

等同於 insertSubPage(This, PagePos, Page, Text, [])

-spec insertSubPage(This, PagePos, Page, Text, [Option]) -> boolean()
                       when
                           This :: wxTreebook(),
                           PagePos :: integer(),
                           Page :: wxWindow:wxWindow(),
                           Text :: unicode:chardata(),
                           Option :: {bSelect, boolean()} | {imageId, integer()}.

在指定的頁面下插入一個子頁面。

可以為頁面指定 NULL 以建立一個空頁面。

連結到這個函數

isNodeExpanded(This, PageId)

檢視原始碼
-spec isNodeExpanded(This, PageId) -> boolean() when This :: wxTreebook(), PageId :: integer().

如果 pageId 代表的頁面已展開,則傳回 true。

-spec new() -> wxTreebook().

預設建構子。

-spec new(Parent, Id) -> wxTreebook() when Parent :: wxWindow:wxWindow(), Id :: integer().

等同於 new(Parent, Id, [])

-spec new(Parent, Id, [Option]) -> wxTreebook()
             when
                 Parent :: wxWindow:wxWindow(),
                 Id :: integer(),
                 Option ::
                     {pos, {X :: integer(), Y :: integer()}} |
                     {size, {W :: integer(), H :: integer()}} |
                     {style, integer()}.

建立一個空的 wxTreebook

連結到這個函數

setImageList(This, ImageList)

檢視原始碼
-spec setImageList(This, ImageList) -> ok
                      when This :: wxTreebook(), ImageList :: wxImageList:wxImageList().

設定要使用的圖像清單。

它不取得圖像清單的所有權,您必須自行刪除它。

請參閱

連結到這個函數

setPageImage(This, Page, Image)

檢視原始碼
-spec setPageImage(This, Page, Image) -> boolean()
                      when This :: wxTreebook(), Page :: integer(), Image :: integer().

設定指定頁面的圖像索引。

image 是使用 setImageList/2 設定的圖像清單的索引。

-spec setPageSize(This, Size) -> ok when This :: wxTreebook(), Size :: {W :: integer(), H :: integer()}.

設定頁面的寬度和高度。

注意:此方法目前未在 wxGTK 中實作。

連結到這個函數

setPageText(This, Page, Text)

檢視原始碼
-spec setPageText(This, Page, Text) -> boolean()
                     when This :: wxTreebook(), Page :: integer(), Text :: unicode:chardata().

設定指定頁面的文字。

連結到這個函數

setSelection(This, Page)

檢視原始碼
-spec setSelection(This, Page) -> integer() when This :: wxTreebook(), Page :: integer().

將選取項目設定為指定的頁面,並傳回先前的選取項目。

請注意,呼叫此函數會產生頁面變更事件,如果您不希望產生這些事件,請使用 changeSelection/2 函數。

請參閱:wxBookCtrlBase:getSelection/1