檢視原始碼 wxImageList (wx v2.4.3)
wxImageList
包含一個圖像列表,這些圖像以未指定的格式儲存。
圖像可以有透明繪圖的遮罩,並且可以從各種來源製作,包括點陣圖和圖示。
wxImageList
主要與 wxTreeCtrl
和 wxListCtrl
類別一起使用。
請參閱
wxWidgets 文件:wxImageList
摘要
函式
使用圖示新增一個新的圖像。
使用點陣圖和遮罩顏色新增一個或多個新的圖像。
初始化列表。
銷毀物件
在裝置上下文上繪製指定的圖像。
傳回與給定索引對應的點陣圖。
傳回與給定索引對應的圖示。
傳回列表中圖像的數量。
檢索列表中圖像的大小。
預設建構子。
建構子,指定圖像大小、是否應建立圖像遮罩以及列表的初始大小。
移除給定位置的圖像。
移除列表中所有圖像。
用新的圖像取代現有的圖像。
用新的圖像取代現有的圖像。
類型
-type wxImageList() :: wx:wx_object().
函式
-spec add(This, Icon) -> integer() when This :: wxImageList(), Icon :: wxIcon:wxIcon() | wxBitmap:wxBitmap().
使用圖示新增一個新的圖像。
回傳:新的從零開始的圖像索引。
備註:原始的點陣圖或圖示不受 add/3
操作的影響,並且可以在之後刪除。如果點陣圖比列表中的圖像寬,則點陣圖將自動分割成較小的圖像,每個圖像都符合圖像列表的尺寸。這不適用於新增圖示時。
僅適用於:wxmsw、wxosx
-spec add(This, Bitmap, Mask) -> integer() when This :: wxImageList(), Bitmap :: wxBitmap:wxBitmap(), Mask :: wxBitmap:wxBitmap(); (This, Bitmap, MaskColour) -> integer() when This :: wxImageList(), Bitmap :: wxBitmap:wxBitmap(), MaskColour :: wx:wx_colour().
使用點陣圖和遮罩顏色新增一個或多個新的圖像。
回傳:新的從零開始的圖像索引。
備註:原始的點陣圖或圖示不受 add/3
操作的影響,並且可以在之後刪除。如果點陣圖比列表中的圖像寬,則點陣圖將自動分割成較小的圖像,每個圖像都符合圖像列表的尺寸。這不適用於新增圖示時。
-spec create(This, Width, Height) -> boolean() when This :: wxImageList(), Width :: integer(), Height :: integer().
-spec create(This, Width, Height, [Option]) -> boolean() when This :: wxImageList(), Width :: integer(), Height :: integer(), Option :: {mask, boolean()} | {initialCount, integer()}.
初始化列表。
有關詳細資訊,請參閱 new/3
。
-spec destroy(This :: wxImageList()) -> ok.
銷毀物件
-spec draw(This, Index, Dc, X, Y, [Option]) -> boolean() when This :: wxImageList(), Index :: integer(), Dc :: wxDC:wxDC(), X :: integer(), Y :: integer(), Option :: {flags, integer()} | {solidBackground, boolean()}.
在裝置上下文上繪製指定的圖像。
-spec getBitmap(This, Index) -> wxBitmap:wxBitmap() when This :: wxImageList(), Index :: integer().
傳回與給定索引對應的點陣圖。
-spec getIcon(This, Index) -> wxIcon:wxIcon() when This :: wxImageList(), Index :: integer().
傳回與給定索引對應的圖示。
-spec getImageCount(This) -> integer() when This :: wxImageList().
傳回列表中圖像的數量。
-spec getSize(This, Index) -> Result when Result :: {Res :: boolean(), Width :: integer(), Height :: integer()}, This :: wxImageList(), Index :: integer().
檢索列表中圖像的大小。
目前,index
參數會被忽略,因為列表中所有圖像的大小都相同。
回傳:如果函式成功則為 true,如果失敗則為 false(例如,如果圖像列表尚未初始化)。
-spec new() -> wxImageList().
預設建構子。
-spec new(Width, Height) -> wxImageList() when Width :: integer(), Height :: integer().
-spec new(Width, Height, [Option]) -> wxImageList() when Width :: integer(), Height :: integer(), Option :: {mask, boolean()} | {initialCount, integer()}.
建構子,指定圖像大小、是否應建立圖像遮罩以及列表的初始大小。
請參閱:create/4
-spec remove(This, Index) -> boolean() when This :: wxImageList(), Index :: integer().
移除給定位置的圖像。
-spec removeAll(This) -> boolean() when This :: wxImageList().
移除列表中所有圖像。
-spec replace(This, Index, Icon) -> boolean() when This :: wxImageList(), Index :: integer(), Icon :: wxIcon:wxIcon() | wxBitmap:wxBitmap().
用新的圖像取代現有的圖像。
回傳:如果替換成功則為 true,否則為 false。
備註:原始的點陣圖或圖示不受 replace/4
操作的影響,並且可以在之後刪除。
僅適用於:wxmsw、wxosx
-spec replace(This, Index, Bitmap, Mask) -> boolean() when This :: wxImageList(), Index :: integer(), Bitmap :: wxBitmap:wxBitmap(), Mask :: wxBitmap:wxBitmap().
用新的圖像取代現有的圖像。
僅限 Windows。
回傳:如果替換成功則為 true,否則為 false。
備註:原始的點陣圖或圖示不受 replace/4
操作的影響,並且可以在之後刪除。