/*
 * Curses.js
 */

class CFrame
{
        // constructor(frame: Rect)
	constructor(frame){
                this.mFrame             = frame ;
                this.mForegroundColor   = Curses.foregroundColor ;
                this.mBackgroundColor   = Curses.backgroundColor ;
	}

        // foregroundColor: Int
        get foregroundColor()       { return this.mForegroundColor ;    }
        set foregroundColor(newcol) { this.mForegroundColor = newcol ;  }

        // backgroundColor: Int
        get backgroundColor()       { return this.mBackgroundColor ;    }
        set backgroundColor(newcol) { this.mBackgroundColor = newcol ;  }

        // fill(pat: Character)
        fill(pat){
                const x         = this.mFrame.x ;
                const y         = this.mFrame.y ;
                const width     = this.mFrame.width ;
                const height    = this.mFrame.height ; 
                Curses.fill(x, y, width, height, pat) ;
        }
}

@@ -136,16 +136,108 @@
 frame ;%0A
+                this.mCursorX           = 0 ;%0A                this.mCursorY           = 0 ;%0A
         
@@ -366,16 +366,114 @@
 r ;%0A%09%7D%0A%0A
+        // frame: Rect%0A        get frame()                 %7B return this.mFrame ;              %7D%0A%0A
         
@@ -1089,62 +1089,1155 @@
 ht ;
- %0A                Curses.fill(x, y, width, height, pat
+%0A                Curses.foregroundColor = this.mForegroundColor ;%0A                Curses.backgroundColor = this.mBackgroundColor ;%0A                Curses.fill(x, y, width, height, pat) ;%0A        %7D%0A%0A%09// moveTo(x:Int, y:Int) -%3E Bool%0A%09moveTo(x, y) %7B%0A%09%09if(0%3C=x && x%3Cthis.mFrame.width && 0%3C=y && y%3Cthis.mFrame.height) %7B%0A                        this.mCursorX = x ;%0A                        this.mCursorY = y ;%0A                        return true ;%0A                %7D else %7B%0A                        return false ;%0A                %7D%0A%09%7D%0A%0A        // put(str: Stting)%0A        put(str)%7B%0A                let   mstr   = %60$%7Bstr%7D%60 ;%0A                const maxlen = this.mFrame.width - this.mCursorX ;%0A                if(maxlen %3C= 0)%7B%0A                        return ; // No spaces to put%0A                %7D else if(maxlen %3C mstr.length) %7B%0A                        mstr = mstr.substr(0, maxlen) ;%0A                %7D%0A                Curses.foregroundColor = this.mForegroundColor ;%0A                Curses.backgroundColor = this.mBackgroundColor ;%0A                Curses.moveTo(this.mFrame.x + this.mCursorX, this.mFrame.y + this.mCursorY) ;%0A                Curses.put(mstr
 ) ;%0A

Update built-in class: CFrame