I have been developing a GUI framework for World of Warcraft. It has been used on several of my addons and, as I've found it a robust concept, decided it was a good time to share it with the community.
Sushi-3.0
Sushi is a library that tries to follow a different approach from most of the current GUI frameworks. It tries to be:
Completely object oriented.
Versatile and easily extendable.
Similar to Blizzard's API and hence, easy to learn.
Wrapped in seaweed for extra flavor. Hey, taste matters!
Documentation can be found at this page. Here are some examples:
1) Simple drop down
local myDropdown = SushiDropdown()
myDropdown:SetPoint('CENTER')
myDropdown:SetLabel('My Awesome Dropdown')
myDropdown:AddLine('Salmon')
myDropdown:AddLine('Grouper')
myDropdown:AddLine('None')
myDropdown:SetCall('OnInput', function(self, v)
if v == 'None' then
print('Not hungry?')
else
print('You cannot have it.')
end
end)
2) Simple group (a container frame that holds other frames and layouts them in place) with two check buttons:
local myGroup = SushiGroup()
group:SetOrientation('HORIZONTAL')
group:SetResizing('VERTICAL') -- not necessary, vertical by default
group:SetChildren(function()
local firstCheck = group:Create('Check')
firstCheck:SetLabel('Banana')
local secondCheck = group:Create('Check')
secondCheck:SetLabel('Orange')
secondCheck:SetCall('OnClick', function()
Eat_Orange = not Eat_Orange
end)
end)
Feel free to post any questions, suggestions or dislikes you might have.
I have finally started to write the framework's documentation: class reference.
More than half of the classes are already documented, and all others should be as well in less than a week. I will also add images for the most visual classes.
IGAS (In-Game Addon System)
This is a full object-oriented system?and now just in beta version, maybe can be released before mop.
The system apply things like:
Class
Interface
Struct
Enum
Class and interface make custom widget more simple and efficient.Here is a sample for class and interface.It make a button class type that can be changed to movable & resizable mode.
IGAS:NewAddon "Test" -- Create Addon Test and make env to the addon
import "System.Widget" -- import namespace System.Widget,
--which contains useful wow widgets and interfaces.
class "MButton" -- Start define MButton class
inherit "NormalButton" -- NormalButton is a custom button type
extend "IFMovable" "IFResizable" -- IFMovable apply the ability to into move mode
-- IFResizable apply the ability to into resize mode
-- property definition, IFMovingGroup is difined in IFMovable, need override,
-- to point which group the MButton's object in.
property "IFMovingGroup" {
Get = function(self) return "MButton" end,
}
property "IFResizingGroup" {
Get = function(self) return "MButton" end,
}
-- the function with name as the class name, is the constructor
function MButton(name, parent)
local btn = Super(name, parent) -- Super is NormalButton here
-- Setup
btn.Style = "Classic"
btn.Height = 26
btn.Width = 60
btn.Text = name
btn:SetPoint("CENTER")
return btn
end
endclass "MButton" -- end the definition of MButton
----------------------------------
-- Frame set part
----------------------------------
f = Form("Test") -- no need use local because this code is running in add-on env
-- Form ,you know
for i = 1, 10 do
btn = MButton("Button_" .. i, f)
if i%3 == 0 then btn.Visible = false end
end
------------------------------------
-- Turn move & resize mode on
------------------------------------
IGAS.System.Widget.IFMovable._ModeOn("Mbutton")
IGAS.System.Widget.IFResizable._ModeOn("Mbutton")
Well, it's hard to explain all in one pic.I try to make all code more readable.
I'm starting to think about building a configuration GUI for my new addon and I encountered the problem that you found with other frameworks being data-driven.
Glad you lik!
That should not be hard to implement in Suhsi. I advice you to first make a "ListButton" class (you can use one of the button classes as a base for it, should make most of the work already), and then the List class. You can use Group as a base for the last one, which will take care of managing all the buttons for you!
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Sushi-3.0
Sushi is a library that tries to follow a different approach from most of the current GUI frameworks. It tries to be:
Documentation can be found at this page. Here are some examples:
1) Simple drop down
2) Simple group (a container frame that holds other frames and layouts them in place) with two check buttons:
Feel free to post any questions, suggestions or dislikes you might have.
I see you put a lot in gui system.If you have interesting for the code in this pic, you can contact me.
More than half of the classes are already documented, and all others should be as well in less than a week. I will also add images for the most visual classes.
What pic?
The one attached to his post. The link was invisible for some reason; I've fixed it now.
Not possible to view in fullscreen.
EDIT: Forget, now I can.
What framework are you using?
This is a full object-oriented system?and now just in beta version, maybe can be released before mop.
The system apply things like:
Class
Interface
Struct
Enum
Class and interface make custom widget more simple and efficient.Here is a sample for class and interface.It make a button class type that can be changed to movable & resizable mode.
Test sample pic: you can visit bbs.ngacn.cc first, then view these pics
http://img.ngacn.cc/attachments/mon_201207/27/-76204_501217b7158fe.jpeg
Code part:
http://img.ngacn.cc/attachments/mon_201207/27/-76204_501217c14832a.jpeg
Well, it's hard to explain all in one pic.I try to make all code more readable.
I like what I've read about Sushi so far and I'll give it a try. One particular class that I wish Sushi had is a Listbox widget that I could use to build a control like this: http://www.codeproject.com/KB/aspnet/List_Box_Control/ListBox.jpg
I may end up implementing it myself if I can't find what I need anywhere else.
That should not be hard to implement in Suhsi. I advice you to first make a "ListButton" class (you can use one of the button classes as a base for it, should make most of the work already), and then the List class. You can use Group as a base for the last one, which will take care of managing all the buttons for you!