Project

General

Profile

Bug #44 » menuDeco.lua

DropDown menu prototype - Emmanuel Lepage Vallee, 03/24/2012 08:16 PM

 
1
local capi = { mouse = mouse,image=image,widget=widget }
2
local setmetatable = setmetatable
3
local print        = print
4
local math         = math
5
local type         = type
6
local ipairs       = ipairs
7
local util         = require("awful.util")
8
local wibox        = require( "awful.wibox"  )
9
local common       = require( "ultiLayout.common" )
10
local clientGroup  = require( "ultiLayout.clientGroup" )
11
local beautiful    = require( "beautiful" )
12

    
13
module("widgets.menuDeco")
14

    
15
local function gen_top(width, height)
16
    local aWb = wibox({position="free"})
17
    aWb.x = 100
18
    aWb.y =100
19
    aWb.width  = 200
20
    aWb.height = 25
21
    aWb.ontop = true
22
    aWb.bg = beautiful.fg_normal
23
    local img = capi.image.argb32(width, 25, nil)
24
    img:draw_rectangle(0, 0, width, 25, true, "#FFFFFF")
25
    for i=0,(50/2) do
26
        img:draw_rectangle(width-70+i, 25-i, 1, i, true, "#000000")
27
        img:draw_rectangle(width-20-i, 25-i, 1, i, true, "#000000")
28
    end
29
    img:draw_rectangle(10, 15, width-25, 10, true, "#000000")
30
    img:draw_circle (10, 26, 10, 10, true, "#000000")
31
    img:draw_circle (width-20, 26, 10, 10, true, "#000000")
32
    aWb.shape_clip = img
33
    aWb.shape_bounding = img
34
    return aWb
35
end
36

    
37
local function gen_bottom(width)
38
    local aWb = wibox({position="free"})
39
    aWb.bg = beautiful.fg_normal
40
    aWb.x = 100
41
    aWb.y = 200
42
    aWb.width  = width
43
    aWb.height = 10
44
    local img = capi.image.argb32(width, 10, nil)
45
    img:draw_rectangle(0, 0, width, 10, true, "#FFFFFF")
46
    img:draw_rectangle(10, 0, width-30, 10, true, "#000000")
47
    img:draw_circle (10, 0, 10, 10, true, "#000000")
48
    img:draw_circle (width-20, 0, 10, 10, true, "#000000")
49
    aWb.shape_clip = img
50
    aWb.shape_bounding = img
51
end
52

    
53
local function create_splitter(cg,args)
54
    local args = args or {}
55
    local data = {x=args.x,y=args.y}
56

    
57
    gen_top(200)
58
    
59
    function data:update()
60
        
61
    end
62
    data:update()
63
    gen_bottom(200)
64
    return data
65
end
66

    
67
setmetatable(_M, { __call = function(_, ...) return create_splitter(...) end })
(3-3/4)