Sunday, July 25, 2010

More NCurses

Since someone actually commented on my original post here is a status update
I've actually moved to starting again from scratch, with a wrapper that is more modern than the one I found (It still had semicolons at the end of each line). My new version is already somewhat more comprehensive though nowhere near complete.

One of the changes I've made is to allow method chaining so instead of adding the move and do X method for every single operation I have a Mv and Color and Set (as in attrset) which return the window you called them on. This allows calls like:

window.Mv(10,10).Set(curses.A_BOLD).COLOR(4).AddStr("Hello World")

or better yet:

fmt.FPrintf(window(10,10).Set(curses.A_BOLD).COLOR(4), "Hello World")

Yes I made Ncurses Window type implement the Writer interface : )

And as to releasing it back. I absolutely plan too. Though I still have a few Items I want to get working first such as:
  1. Make my InitScreen take configuration options so that it can set things like CBreak, NoEcho and Keypad for you (I already have it initilising the color system if required.
  2. Implement the border drawing primitives though this is just fairly mechanical work.
  3. Add basic wrappers for the related panel, and menu libraries. I'm still trying to decide how all this should be packaged.

No comments: