Message
| Well mine don't look that great either. :)
I tested out my code in the Immediate window with this:
win = "test_" .. GetPluginID () -- get a unique name, ensure not empty if outside plugin
WindowCreate (win, 0, 0, 200, 60, miniwin.pos_center_all, 0, ColourNameToRGB("white")) -- create window
WindowShow (win, true) -- show it
-- Grid
for i = 1, math.max (WindowInfo (win, 3), WindowInfo (win, 4)) / 20 do
WindowLine (win, i * 20, 0, i * 20, WindowInfo (win, 4), 0xC0C0C0, miniwin.pen_solid, 1)
WindowLine (win, 0, i * 20, WindowInfo (win, 3), i * 20, 0xC0C0C0, miniwin.pen_solid, 1)
end -- for
tabwidth = 60
colour = ColourNameToRGB ("blue")
width = 2
local points = {
0, 2, -- start (top left) 1 .. 2
10, 2, 10, 2, 10, 2, -- top of tab, before curve 3 .. 8
10, 22, 10, 22, 30, 22, -- bottom of tab - left side 9 .. 14
10, 22, 10, 22, 10, 22, -- bottom of tab - right side 15 .. 20
20, 22, 20, 22, 20, 2, -- top of tab, after curve 21 .. 26
22, 2, 22, 2, 22, 2, -- finishing horizontal line 27 .. 32
} -- end points table
-- add width
for i = 15, #points, 2 do
points [i] = points [i] + tabwidth - 10
end -- for
WindowBezier (win, table.concat (points, ","), colour, 0, width)
WindowLine (win, tabwidth + 10, 2, tabwidth + 200, 2, colour, 0, width)
print (table.concat (points, ","))
The results were:
Basically it drew a Bezier curve with a line, the Bezier curve points were:
0,2,10,2,10,2,10,2,10,22,10,22,30,22,60,22,60,22,60,22,70,22,70,22,70,2,72,2,72,2,72,2
The code sort-of explains why, but I'm not that happy with the result anyway. It's explained here a bit:
http://www.gammon.com.au/mushclient/mw_shapes.htm#WindowBezier
But you might get a better result by just making a nice tab graphic in your favourite painting program, save as a PNG file, and just put a few of them next to each other (or do a separate graphic for each possible tab selected). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|