Go Back   WowAce Forums > Addon Chat > Libraries
Libraries Threads for new libraries and mixins.

Reply
 
Thread Tools
Old 04-17-2012   #1
Jaliborc
Junior Member
 
Jaliborc's Avatar
 
Join Date: Mar 2008
Posts: 65
Default Sushi-3.0

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

Code:
	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:

Code:
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.
__________________
Developer of addons such as Bagnon, OmniCC and PetTracker.

Last edited by Jaliborc; 07-18-2012 at 08:28 AM.
Jaliborc is offline   Reply With Quote
Old 06-01-2012   #2
kurapica
Member
 
Join Date: Jun 2007
Posts: 13
Default Re: Sushi-3.0



I see you put a lot in gui system.If you have interesting for the code in this pic, you can contact me.
Attached Images
File Type: jpg DataGrid.jpg (97.2 KB, 138 views)

Last edited by Phanx; 07-12-2012 at 10:54 PM. Reason: Fixed attachment link
kurapica is offline   Reply With Quote
Old 07-12-2012   #3
Jaliborc
Junior Member
 
Jaliborc's Avatar
 
Join Date: Mar 2008
Posts: 65
Default Re: Sushi-3.0

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.
__________________
Developer of addons such as Bagnon, OmniCC and PetTracker.
Jaliborc is offline   Reply With Quote
Old 07-12-2012   #4
Jaliborc
Junior Member
 
Jaliborc's Avatar
 
Join Date: Mar 2008
Posts: 65
Default Re: Sushi-3.0

Quote:
Originally Posted by kurapica View Post
Attachment 4025

I see you put a lot in gui system.If you have interesting for the code in this pic, you can contact me.
What pic?
__________________
Developer of addons such as Bagnon, OmniCC and PetTracker.
Jaliborc is offline   Reply With Quote
Old 07-12-2012   #5
Phanx
Seal Cub Clubbing Club
 
Phanx's Avatar
 
Join Date: May 2005
Location: United States
Posts: 8,100
Default Re: Sushi-3.0

Quote:
Originally Posted by Jaliborc View Post
What pic?
The one attached to his post. The link was invisible for some reason; I've fixed it now.
__________________
Author/maintainer of Grid, PhanxChat, and many more. | PM me on CurseForge
Troubleshoot an addon | Turn any code into an addon | More addon resources
Need help with your code? Attach or paste your whole, real files.
Please don't PM me about addon bugs, requests, or code help. Post a comment, ticket, or thread instead!
Phanx is offline   Reply With Quote
Old 07-17-2012   #6
Jaliborc
Junior Member
 
Jaliborc's Avatar
 
Join Date: Mar 2008
Posts: 65
Default Re: Sushi-3.0

Quote:
Originally Posted by Phanx View Post
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.
__________________
Developer of addons such as Bagnon, OmniCC and PetTracker.
Jaliborc is offline   Reply With Quote
Old 07-17-2012   #7
Jaliborc
Junior Member
 
Jaliborc's Avatar
 
Join Date: Mar 2008
Posts: 65
Default Re: Sushi-3.0

Quote:
Originally Posted by kurapica View Post


I see you put a lot in gui system.If you have interesting for the code in this pic, you can contact me.
What framework are you using?
__________________
Developer of addons such as Bagnon, OmniCC and PetTracker.
Jaliborc is offline   Reply With Quote
Old 07-27-2012   #8
kurapica
Member
 
Join Date: Jun 2007
Posts: 13
Default Re: Sushi-3.0

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.

Test sample pic: you can visit bbs.ngacn.cc first, then view these pics
http://img.ngacn.cc/attachments/mon_...17b7158fe.jpeg

Code part:
http://img.ngacn.cc/attachments/mon_...17c14832a.jpeg
Code:
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.
Attached Images
File Type: jpg 0.jpg (21.6 KB, 15 views)

Last edited by kurapica; 10-06-2012 at 02:35 PM.
kurapica is offline   Reply With Quote
Old 08-25-2012   #9
Realfriend
Newbie
 
Join Date: Sep 2010
Posts: 2
Default Re: Sushi-3.0

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.

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...ol/ListBox.jpg

I may end up implementing it myself if I can't find what I need anywhere else.
Realfriend is offline   Reply With Quote
Old 10-12-2012   #10
Jaliborc
Junior Member
 
Jaliborc's Avatar
 
Join Date: Mar 2008
Posts: 65
Default Re: Sushi-3.0

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!
__________________
Developer of addons such as Bagnon, OmniCC and PetTracker.
Jaliborc is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:07 AM.