Difference between revisions of "ListBox (日本語)"

(not yet.)
 
m (そのほかの言語)
 
(3 intermediate revisions by the same user not shown)
Line 147: Line 147:
 
listbox:unselect() or listbox:deselect() -- listbox の選択解除を行いますが、返値はありません。
 
listbox:unselect() or listbox:deselect() -- listbox の選択解除を行いますが、返値はありません。
  
listbox:setexpand(mode) -- set expand mode true enables or "size" and enables or "pos" and enables or false disable, no returns
+
listbox:setexpand(mode) -- 伸張方法であり "size" または  "pos" が有効ならばtrue であり無効ならば false ですが、返値はありません。
 
ex: list:setexpand("size")
 
ex: list:setexpand("size")
 
ex: list:setexpand("pos")
 
ex: list:setexpand("pos")
Line 158: Line 158:
 
listbox:setdata(index,data) -- 項目データの置換であり、成功時は true を返します。
 
listbox:setdata(index,data) -- 項目データの置換であり、成功時は true を返します。
  
listbox:setitem(index,text,[data]) -- replaces item text and data, return true if successfully
+
listbox:setitem(index,text,[data]) -- 項目テキストおよびデータの置換であり、成功時は true を返します。
 
ex = list:setitem(2,"Second","SecondData")
 
ex = list:setitem(2,"Second","SecondData")
  
 
listbox:setfont(font) -- listbox のフォント設定であり、成功時は true を返します。
 
listbox:setfont(font) -- listbox のフォント設定であり、成功時は true を返します。
  
listbox:setselected(index) -- selects a item in the listbox, return true if successfully
+
listbox:setselected(index) -- listbox にある項目の選択であり、成功時は true を返します。
  
listbox:newprop(tlist) -- creates a new property for the listbox  
+
listbox:newprop(tlist) -- listbox 用の特性を新規作成作します。
  
listbox:setrounded(boolean) -- listbox is rounded or rectangle
+
listbox:setrounded(boolean) -- listbox を丸角または長方形にするかどうか。
  
listbox:findlist(str,[mode],[sensible]) or listbox:search(str,[mode],[sensible]) -- return (table) index of all found str if successfully, or false (boolean)
+
listbox:findlist(str,[mode],[sensible]) または listbox:search(str,[mode],[sensible]) -- 成功時は str で発見された索引を  (table) ですべて返しますが、それ以外は false (boolean) です。
 
ex: result = list:findlist("love","text",true)
 
ex: result = list:findlist("love","text",true)
 
if result then print(result[1]) end
 
if result then print(result[1]) end
Line 179: Line 179:
 
if result then list:setdata(result[1],"Love2D") end
 
if result then list:setdata(result[1],"Love2D") end
  
listbox:resort(mode,update) -- sort the listbox in asceding or descending, no returns
+
listbox:resort(mode,update) -- listbox を昇順または降順で整列しますが、返値はありません。
 
ex: list:resort("asc",true)
 
ex: list:resort("asc",true)
ex: list:resort(true,true) -- ascending
+
ex: list:resort(true,true) -- 昇順
 
ex: list:resort("desc",true)
 
ex: list:resort("desc",true)
ex: list:resort(false) -- disables, but not defaults sorted itens
+
ex: list:resort(false) -- 整列しませんが、標準では項目の整列を行いません。
  
 
listbox:setsize(Width,Height) -- 寸法の設定 (number)
 
listbox:setsize(Width,Height) -- 寸法の設定 (number)
Line 189: Line 189:
 
listbox:setpos(X,Y) -- 位置の設定 (number)
 
listbox:setpos(X,Y) -- 位置の設定 (number)
  
listbox:setindex(boolean) -- show or hide index numbers counted, no returns
+
listbox:setindex(boolean) -- 項目番号の表示または非表示ですが、返値はありません。
  
listbox:setvisible(boolean) -- visible or invisible, the listbox may interact invisibly if it is not disabled
+
listbox:setvisible(boolean) -- 可視または不可視であっても無効でないならば listbox は不可視であっても相互に影響します。
  
listbox:setenabled(boolean) -- enable or disable the listbox, it remains visible, but does not interact (boolean)
+
listbox:setenabled(boolean) -- istbox を有効または無効にします。それは可視状態のままになりますが、相互に影響しません (boolean)
  
listbox:isvisible() -- get if is visible, return boolean
+
listbox:isvisible() -- 可視状態どうかをブーリアンで返します。
  
listbox:isenabled() -- get if is enabled, return boolean
+
listbox:isenabled() -- 有効状態どうかをブーリアンで返します。
  
listbox:isover() -- get if is pointed(over) in the listbox, return boolean
+
listbox:isover() -- listbox にポインタが重なっているかどうかをブーリアンで返します。
  
listbox:isselectchange() -- get if item selected is changed, return boolean
+
listbox:isselectchange() -- 選択項目が変更されたかどうかをブーリアンで返します。
  
listbox:isdoublec() -- get if is double click in the selected item, return boolean
+
listbox:isdoublec() -- 選択項目がダブルクリックされたかかどうかをブーリアンで返します。
  
listbox:autosize(boolean) -- auto size the listbox, no returns
+
listbox:autosize(boolean) -- listbox の大きさを自動で変更するかどうかですが、返値はありません。
  
listbox:center(boolean) -- auto center in the screen, no returns
+
listbox:center(boolean) -- 自動で画面中央に配置するかどうかですが、返値はありません。
  
listbox:export(file,[mode1],[mode2]) or listbox:save(file,[mode1],[mode2]) -- save all itens in a file to save directory or on the side
+
listbox:export(file,[mode1],[mode2]) or listbox:save(file,[mode1],[mode2]) -- 保存ディレクトリへのファイル保存または別に全項目を保存します。
ex: list:export("list.txt",true,"text") -- ("text" or true) exports only itens texts in save directory (and index if enabled)
+
ex: list:export("list.txt",true,"text") -- ("text" または true) ならば項目テキストのみを保存ディレクトリへ書き出します (有効ならば索引を)
ex: list:export("list.txt",false,false) -- exports all itens text..separator..data on the side (and index if enabled)
+
ex: list:export("list.txt",false,false) -- すべての項目にある  text..separator..data を別々に書き出します (有効ならば索引も)
ex: list:export("list.txt") -- exports all itens text..separator..data on the side (and index if enabled)
+
ex: list:export("list.txt") -- すべての項目にある  text..separator..data を別々に書き出します (有効ならば索引も)
NOTE: on the side (mode1-false) not works in android or ios, automatically exports in your save directory (mode1-true)
+
注釈: Android または iOS では個別方式  (mode1-false) は動作しないため、自動的に保存ディレクトリへ書き出します (mode1-true)
  
listbox:import(file) or listbox:open(file) -- load all lines in the listbox, if have separator will add as data, return true if successfully
+
listbox:import(file) or listbox:open(file) -- すべての行を listbox へ読み込み、分離子があるなばら追加します。成功時は true を返します。
 
ex: list:import("newlist.list")  
 
ex: list:import("newlist.list")  
 
</source>
 
</source>
Line 227: Line 227:
 
listbox:getdirname(path) -- ディレクトリ名を返します
 
listbox:getdirname(path) -- ディレクトリ名を返します
  
listbox:onlynumbers(str) -- return only numbers of a given string
+
listbox:onlynumbers(str) -- 指定された文字列の番号のみを返します。
  
listbox:onlyletters(str) -- return only letters of a given string
+
listbox:onlyletters(str) -- 指定された文字列の文字のみを返します。
  
listbox:insensible(string) -- return string insensible "aA"=="aa"
+
listbox:insensible(string) -- 同一視の文字列 "aA"=="aa" を返します。
  
listbox:enudir(path,[extensions]) -- return (table) of all files enumerated with a specific extension (or no), or false
+
listbox:enudir(path,[extensions]) -- 特定の拡張子を有する全ファイルを列挙 (table) したものを返しますが、それ以外は false です。
 
ex: result = list:enudir("music/rock",".wav .mp3 .ogg")
 
ex: result = list:enudir("music/rock",".wav .mp3 .ogg")
 
ex: result = list:enudir("images",".png .jpeg .bmp")
 
ex: result = list:enudir("images",".png .jpeg .bmp")
 
ex: result = list:enudir("contents")
 
ex: result = list:enudir("contents")
  
listbox:sectotime(seconds,[milliseconds]) -- return a time of a given number, or "00:00:00"
+
listbox:sectotime(seconds,[milliseconds]) -- 指定された数値を時間で、または "00:00:00" で返します。
ex: result = list:sectotime(1000) -- return 00:16:40
+
ex: result = list:sectotime(1000) -- 00:16:40 を返します。
ex: result = list:sectotime(1e3,true) -- return 00:16:40.0
+
ex: result = list:sectotime(1e3,true) -- 00:16:40.0 を返します。
  
listbox:rgbtohex(tcolor) -- return hexadecimal (string) of a given RGB color (table)
+
listbox:rgbtohex(tcolor) -- 指定された RGB 色 (table) を十六進数 (string) で返します
 
ex: tcolor = {100,200,255}
 
ex: tcolor = {100,200,255}
result = list:rgbtohex(tcolor) -- return 64C8FF
+
result = list:rgbtohex(tcolor) -- 64C8FF を返します。
  
ex: print("#"..list:rgbtohex({100,200,255})) -- print #64C8FF
+
ex: print("#"..list:rgbtohex({100,200,255})) -- #64C8FF を表示します。
  
listbox:mount(path) -- mounts a directory outside of its executable
+
listbox:mount(path) -- 実行可能ファイル本体の外部にあるディレクトリをマウントします。
 
</source>
 
</source>
  
 
'''主要関数:'''
 
'''主要関数:'''
 
<source lang="lua">
 
<source lang="lua">
listbox:key(key,shortcut) -- required if you want to interacts the listbox using keyboards, returns key pressed
+
listbox:key(key,shortcut) -- キーボードの使用による listbox の相互作用を望むならばキーの打鍵を返すことが必要です。
  
 
ex: function love.keypressed(key)
 
ex: function love.keypressed(key)
list:key(key,true) -- if shortcut is enabled, select the first item character found while pressed a key
+
list:key(key,true) -- ショートカットが有効ならば、キーが押されている間に最初の項目を対象とした文字を検出します。
 
end
 
end
  
listbox:mousew(x,y) -- required if you want to interacts the listbox using mouse wheel
+
listbox:mousew(x,y) -- マウスホイールを使用して listbox に相互影響を与えたいならば必要です。
  
 
ex: function love.wheelmoved(x,y)
 
ex: function love.wheelmoved(x,y)
Line 265: Line 265:
 
end
 
end
  
listbox:update(dt) -- required if you want to interacts the listbox...
+
listbox:update(dt) -- listbox に相互影響を与えたいならば必要です……。
  
 
ex: function love.update(dt)
 
ex: function love.update(dt)
Line 271: Line 271:
 
end
 
end
  
listbox:press(x,y) or list.ispress=true -- optional for mouses, required for touches
+
listbox:press(x,y) or list.ispress=true -- タッチのために必要になる選択制のマウス機能です。
  
 
ex: function love.touchpressed(id, x, y, dx, dy, pressure)
 
ex: function love.touchpressed(id, x, y, dx, dy, pressure)
Line 281: Line 281:
 
end
 
end
  
listbox:moved(x,y) or list.ispress=true -- optional for mouses, required for touches
+
listbox:moved(x,y) or list.ispress=true -- タッチのために必要になる選択制のマウス機能です。
  
listbox:released(x,y) or list.ispress=false -- optional for mouses, required for touches
+
listbox:released(x,y) or list.ispress=false -- タッチのために必要になる選択制のマウス機能です。
  
listbox:resize() -- required if you want to autosize the listbox on resize
+
listbox:resize() -- listbox の縮尺に対して自動的に大きさの変更するかどうかを望むならば必要です。
  
 
ex: function love.resize(w,h)
 
ex: function love.resize(w,h)
Line 291: Line 291:
 
end
 
end
  
listbox:draw() -- required if you want to use the listbox
+
listbox:draw() -- listbox を使用したいならば必要です。
  
 
ex: function love.draw()
 
ex: function love.draw()
Line 299: Line 299:
  
 
[[File:IMGDEMO.png]]
 
[[File:IMGDEMO.png]]
 
 
== そのほかの言語 ==
 
{{i18n|ListBox}}
 
  
 
{{#set:Name=DynamicListBox}}
 
{{#set:Name=DynamicListBox}}
Line 310: Line 306:
 
{{#set:Keyword=GUI}}
 
{{#set:Keyword=GUI}}
 
[[Category:Libraries (日本語)]]
 
[[Category:Libraries (日本語)]]
 +
 +
== そのほかの言語 ==
 +
{{i18n (日本語)|ListBox}}

Latest revision as of 00:52, 16 December 2019

Luiz Renato (ルイズ・レナト) 製作による LÖVE 2D 用の動的 ListBox (リストボックス) 型 GUI ライブラリです。タッチ、マウスおよびキーボード操作に対応しています。

https://github.com/darkmetalic/ListBox

実演:

function love.load()

font = love.graphics.newFont(15)

list = require "listbox"

local tlist={
x=200, y=100,
font=font,ismouse=true,
rounded=true,
w=200,h=300,showindex=true}

list:newprop(tlist)

list:additem("MySite","www.MySite.com")
list:additem("MyNumber",123456)
end

function love.keypressed(key)
list:key(key,true)
end

function love.wheelmoved(x,y)
list:mousew(x,y)
end

function love.update(dt)
list:update(dt)
end

function love.draw()
list:draw()
end

初期値:

listbox={

x=100,y=100, -- listbox の x,y 位置 (number)

w=200,h=400, -- listbox の幅(W) × 高さ(H) (number)

hor=true,ver=true, -- 水平および垂直スクロールバーの表示 (boolean)

sort=false, -- 整列方法:文字列 "asc" または "desc" あるいは true (asc) または false (disable)

enabled=true, -- listbox を有効または無効にします。それは可視状態のままになりますが、相互に影響しません (boolean)

visible=true, -- 可視または不可視であっても無効でないならば listbox は不可視であっても相互に影響します。

adjust=true, -- 調整 (boolean)

rounded=false, -- 丸角の長方形 (boolean)

expand=false, -- listbox の伸張 (boolean)

expandmode="size", -- 伸張方法: 大きさ true (boolean|string) または位置 "pos" (string)

expx=12, -- ピクセルの伸張 (number)

radius=15, -- スクロール用の円球カーソルにおける大きさと半径 (number)

sep=";;", -- テキストの終端およびデータにおける索引の始点を制限するための分離子 (string)

ismouse=true, -- マウスを使用するかどうか (boolean)

istouch=false, -- タッチを使用するかどうか (boolean)

gw = love.graphics.getWidth(), -- 尺度変更のために取得した最初の幅ですが、全画面表示 (または gw にの設定) で構成 (conf.lua) した場合は動作しません。

gh = love.graphics.getHeight(), -- 尺度変更のために取得した最初の高さですが、全画面表示 (または gh にの設定) で構成 (conf.lua) した場合は動作しません。

incenter=false, -- 画面の中央 (boolean)

asize=false, -- 自動で listbox の大きさを決定するかどうか (boolean)

font = love.graphics.newFont(12), -- listbox のフォント (object)

fcolor={0,190,0}, -- RGB によるフォントの色 (table)

bordercolor={50,50,50}, -- RGB による水平線の色 (table)

selectedcolor={50,50,50}, -- RGB による選択項目の色 (table)

fselectedcolor={200,200,200}, -- RGB による選択項目にあるフォントの色 (table)

selectedtip="fill", -- 選択方式 "fill" (塗り潰し) または "line" (下線) (string)

bgcolor={20,20,20}, -- RGB による選択項目の背景色 (table)

showindex=false, -- 索引の表示 (boolean)

indexzeros=1, -- 索引を 0 から開始するかどうか (number)

selected=false, -- 最初の索引 (number) または無選択 (false)

gpadding=5 -- 全体の余白 (number) }

関数:

--[[NOTE: すべての初期値および関数は小文字です。

text = string または number
data = string または number
str = string または number
index = integer (number)
item = index (テキストおよびデータ)
tlist = table
mode = boolean または string
update = boolean (アップリスト)
font = object
[] = 選択制]]

listbox:additem(text,[data],[update]) or listbox:insert(text,[data],[update]) -- 項目の新規追加であり成功時は true を返します。
ex: list:additem("MySite","www,mysite.com",true)
ex: list:insert("MySite","www,mysite.com",false)

listbox:delitem(index) or listbox:remove(index) -- 指定項目の削除であり、成功時は true を返します。
ex: list:delitem(16)

listbox:delall() or listbox:empty() -- 項目の全削除であり、なにも返しません。

listbox:getcount() or listbox:maxn() -- 成功時は最大項目数 (number) または false  (boolean) を返します。

listbox:getselected() -- 成功時は選択された項目 (number) または false  (boolean) を返します。

listbox:getdata(index) -- 成功時は項目データ (string) または  "" (空文字列) を返します。

listbox:gettext(index) -- 成功時は項目テキスト (string) または  "" (空文字列) を返します。

listbox:getfusion(index) or listbox:concat(index) -- 成功時は連結された項目テキスト text..data (string) であり、それ以外は (false) です。

listbox:getsize() -- listbox の幅と高さを計測した二種類の寸法を返します。 (number)

listbox:getpos() -- listbox におけるX と Y の二種類の位置を返します (number)

listbox:uplist() -- listbox の更新・実現を行いますが、返値はありません。

listbox:unselect() or listbox:deselect() -- listbox の選択解除を行いますが、返値はありません。

listbox:setexpand(mode) -- 伸張方法であり "size" または  "pos" が有効ならばtrue であり無効ならば false ですが、返値はありません。
ex: list:setexpand("size")
ex: list:setexpand("pos")
ex: list:setexpand(true)
ex: list:setexpand(false)

listbox:settext(index,text) -- 項目テキストの置換であり、成功時は true を返します。
ex = list:settext(2,"Second")

listbox:setdata(index,data) -- 項目データの置換であり、成功時は true を返します。

listbox:setitem(index,text,[data]) -- 項目テキストおよびデータの置換であり、成功時は true を返します。
ex = list:setitem(2,"Second","SecondData")

listbox:setfont(font) -- listbox のフォント設定であり、成功時は true を返します。

listbox:setselected(index) -- listbox にある項目の選択であり、成功時は true を返します。

listbox:newprop(tlist) -- listbox 用の特性を新規作成作します。

listbox:setrounded(boolean) -- listbox を丸角または長方形にするかどうか。

listbox:findlist(str,[mode],[sensible]) または listbox:search(str,[mode],[sensible]) -- 成功時は str で発見された索引を  (table) ですべて返しますが、それ以外は false  (boolean) です。
ex: result = list:findlist("love","text",true)
if result then print(result[1]) end

ex: result = list:search("love","textdata",false)
if result then list:setselected(table.maxn(result)) end

ex: result = list:findlist("love","data",false)
if result then list:setdata(result[1],"Love2D") end

listbox:resort(mode,update) -- listbox を昇順または降順で整列しますが、返値はありません。
ex: list:resort("asc",true)
ex: list:resort(true,true) -- 昇順
ex: list:resort("desc",true)
ex: list:resort(false) -- 整列しませんが、標準では項目の整列を行いません。

listbox:setsize(Width,Height) -- 寸法の設定 (number)

listbox:setpos(X,Y) -- 位置の設定 (number)

listbox:setindex(boolean) -- 項目番号の表示または非表示ですが、返値はありません。

listbox:setvisible(boolean) -- 可視または不可視であっても無効でないならば listbox は不可視であっても相互に影響します。

listbox:setenabled(boolean) -- istbox を有効または無効にします。それは可視状態のままになりますが、相互に影響しません (boolean)

listbox:isvisible() -- 可視状態どうかをブーリアンで返します。

listbox:isenabled() -- 有効状態どうかをブーリアンで返します。

listbox:isover() -- listbox にポインタが重なっているかどうかをブーリアンで返します。

listbox:isselectchange() -- 選択項目が変更されたかどうかをブーリアンで返します。

listbox:isdoublec() -- 選択項目がダブルクリックされたかかどうかをブーリアンで返します。

listbox:autosize(boolean) -- listbox の大きさを自動で変更するかどうかですが、返値はありません。

listbox:center(boolean) -- 自動で画面中央に配置するかどうかですが、返値はありません。

listbox:export(file,[mode1],[mode2]) or listbox:save(file,[mode1],[mode2]) -- 保存ディレクトリへのファイル保存または別に全項目を保存します。
ex: list:export("list.txt",true,"text") -- ("text" または true) ならば項目テキストのみを保存ディレクトリへ書き出します (有効ならば索引を)。
ex: list:export("list.txt",false,false) -- すべての項目にある  text..separator..data を別々に書き出します (有効ならば索引も)。
ex: list:export("list.txt") -- すべての項目にある  text..separator..data を別々に書き出します (有効ならば索引も)。
注釈: Android または iOS では個別方式  (mode1-false) は動作しないため、自動的に保存ディレクトリへ書き出します (mode1-true)

listbox:import(file) or listbox:open(file) -- すべての行を listbox へ読み込み、分離子があるなばら追加します。成功時は true を返します。
ex: list:import("newlist.list")

追加のツール:

listbox:getfileext(filepath) -- ファイル拡張子を返します

listbox:getfilename(filepath) -- ファイル名を返します

listbox:getdirname(path) -- ディレクトリ名を返します

listbox:onlynumbers(str) -- 指定された文字列の番号のみを返します。

listbox:onlyletters(str) -- 指定された文字列の文字のみを返します。

listbox:insensible(string) -- 同一視の文字列 "aA"=="aa" を返します。

listbox:enudir(path,[extensions]) -- 特定の拡張子を有する全ファイルを列挙 (table)  したものを返しますが、それ以外は false です。
ex: result = list:enudir("music/rock",".wav .mp3 .ogg")
ex: result = list:enudir("images",".png .jpeg .bmp")
ex: result = list:enudir("contents")

listbox:sectotime(seconds,[milliseconds]) -- 指定された数値を時間で、または "00:00:00" で返します。
ex: result = list:sectotime(1000) -- 00:16:40 を返します。
ex: result = list:sectotime(1e3,true) -- 00:16:40.0 を返します。

listbox:rgbtohex(tcolor) -- 指定された RGB 色 (table) を十六進数 (string) で返します
ex: tcolor = {100,200,255}
result = list:rgbtohex(tcolor) -- 64C8FF を返します。

ex: print("#"..list:rgbtohex({100,200,255})) -- #64C8FF を表示します。

listbox:mount(path) -- 実行可能ファイル本体の外部にあるディレクトリをマウントします。

主要関数:

listbox:key(key,shortcut) -- キーボードの使用による listbox の相互作用を望むならばキーの打鍵を返すことが必要です。

ex: function love.keypressed(key)
list:key(key,true) -- ショートカットが有効ならば、キーが押されている間に最初の項目を対象とした文字を検出します。
end

listbox:mousew(x,y) -- マウスホイールを使用して listbox に相互影響を与えたいならば必要です。

ex: function love.wheelmoved(x,y)
list:mousew(x,y)
end

listbox:update(dt) -- listbox に相互影響を与えたいならば必要です……。

ex: function love.update(dt)
list:update(dt)
end

listbox:press(x,y) or list.ispress=true -- タッチのために必要になる選択制のマウス機能です。

ex: function love.touchpressed(id, x, y, dx, dy, pressure)
list:press(x,y)
end

ex: function love.touchpressed(id, x, y, dx, dy, pressure)
list.ispress=true
end

listbox:moved(x,y) or list.ispress=true -- タッチのために必要になる選択制のマウス機能です。

listbox:released(x,y) or list.ispress=false -- タッチのために必要になる選択制のマウス機能です。

listbox:resize() -- listbox の縮尺に対して自動的に大きさの変更するかどうかを望むならば必要です。

ex: function love.resize(w,h)
list:resize()
end

listbox:draw() -- listbox を使用したいならば必要です。

ex: function love.draw()
list:draw()
end

IMGDEMO.png

そのほかの言語