Hmm, if this is going to be the new look for Haiku, how close can I get to it with yab applications? I do want yab to remain a first-class citizen around here.
Time to experiment, do a little mockup …
Yes, it works. Only the About item has an action assigned to it, though.
#!yab
OpenWindow()
// Main Message Loop
dim msg$(1)
while(not leavingLoop)
nCommands = token(message$, msg$(), "|")
for everyCommand = 1 to nCommands
switch(msg$(everyCommand))
case "_QuitRequested"
case "MainWindow:_QuitRequested"
leavingLoop = true
break
default
end switch
if instr(msg$(everyCommand), "☂") then
if mid$(msg$(everyCommand), 16) = "About" then
a=alert "It works!", "OK","","","info"
endif
endif
next everyCommand
wend
CloseWindow()
exit
// Setup the main window here
sub OpenWindow()
window open 100,100 to 600,500, "MainWindow", "Main Window"
menu "☂", "About", "", "MainWindow"
menu "☂", "Settings", ",", "MainWindow"
menu "☂", "Quit", "Q", "MainWindow"
menu "File", "New", "", "MainWindow"
menu "File", "Save", "", "MainWindow"
menu "File", "Save As", "", "MainWindow"
end sub
// Close down the main window
sub CloseWindow()
window close "MainWindow"
return
end sub
Creating the menu head with a Unicode glyph is easy enough. The tricky part is catching it in the main loop. The standard yab SWITCH..END SWITCH loop chokes on multi-byte input, so you need to create a secondary loop in which you use INSTR and string-splitting to make up for the presence of two extra bytes (or more if you use a CJK character).
Now all I need is a program icon that looks like an umbrella!