Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- declare('PluginManager', {})
- local _, _, list3 = dofile('templates.lua')
- local examples = {
- {
- name = 'Example 1',
- author = 'Pseudonym 1',
- description = 'It does nothing.',
- version = '1.0',
- },
- {
- name = 'Example 2',
- author = 'Pseudonym 2',
- description = 'It does nothing.',
- version = '1.2',
- },
- {
- name = 'Example 3',
- author = 'Pseudonym 3',
- description = 'It does nothing.',
- version = '0.34',
- },
- }
- local function InitializePluginList()
- end
- local function CreateManagerUI()
- local toggle_size = 15
- local list_item_gap = 10
- local pluginlist = list3{size = '500x500'}
- function pluginlist:setup_list()
- self:SetCreateItemFunc(
- function(item)
- printtable(item)
- return iup.hbox{
- iup.stationtoggle{size = toggle_size},
- iup.label{title = item.name or 'Unnamed plugin'},
- iup.label{title = item.author or ''},
- iup.label{title = item.description or ''},
- iup.label{title = item.version or ''},
- gap = list_item_gap,
- }
- end
- )
- self:SetColors{'30 55 78 96', '42 74 96 96', [0] = '65 100 127 255'}
- self:AddItems(examples)
- self:PopulateList()
- end
- local closebutton = iup.stationbutton{title = 'Close', action = function(self) HideDialog(iup.GetDialog(self)) end}
- local listheaders = {
- name = iup.label{title = 'Name'},
- author = iup.label{title = 'Author'},
- description = iup.label{title = 'Description'},
- version = iup.label{title = 'Version'},
- }
- local body = iup.vbox{
- iup.hbox{
- iup.fill{size = toggle_size},
- listheaders.name,
- listheaders.author,
- listheaders.description,
- listheaders.version,
- gap = list_item_gap,
- },
- iup.hbox{
- pluginlist,
- },
- }
- local footer = iup.hbox{
- iup.fill{},
- closebutton,
- iup.fill{size = 15},
- }
- local main = iup.vbox{
- body,
- footer,
- gap = 10,
- }
- local dlg = iup.dialog{
- main,
- defaultesc=closebutton,
- bgcolor="0 0 0 *",
- fullscreen="YES",
- title = 'Plugin Manager Mockup',
- border="NO",
- resize="NO",
- menubox="YES",
- topmost="YES",
- }
- dlg:map()
- pluginlist:setup_list()
- return dlg
- end
- PluginManager.dlg = CreateManagerUI()
- RegisterUserCommand('pmanager', function() ShowDialog(PluginManager.dlg) end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement