diff options
author | hut <hut@lavabit.com> | 2009-11-25 17:55:34 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2009-11-25 17:55:34 +0100 |
commit | 5822dff7d91472bf2fc337c68f144e0ce1de09ae (patch) | |
tree | 7d40218b67f13c9c95141aa5bcb4aa292c42924a /code/widget.py | |
parent | cfbb8c84355f28bc7f669105f90c7aae0a972569 (diff) | |
download | ranger-5822dff7d91472bf2fc337c68f144e0ce1de09ae.tar.gz |
implemented more stuff
Diffstat (limited to 'code/widget.py')
-rw-r--r-- | code/widget.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/code/widget.py b/code/widget.py new file mode 100644 index 00000000..e95e6a9d --- /dev/null +++ b/code/widget.py @@ -0,0 +1,39 @@ +import curses + +class OutOfBoundsException(Exception): pass + +class Widget(): + def __init__(self, win): + self.win = win + self.setdim(0, 0, 0, 0) + + def setdim(self, y, x, hei=None, wid=None): + maxy, maxx = self.win.getmaxyx() + wid = wid or maxx - x + hei = hei or maxy - y + if x + wid > maxx or y + hei > maxy: + raise OutOfBoundsException() + + self.x = x + self.y = y + self.wid = wid + self.hei = hei + + def contains_point(self, y, x): + return (x >= self.x and x < self.x + self.wid) and \ + (y >= self.y and y < self.y + self.hei) + + def feed_env(self): + pass + + def feed(self): + pass + + def click(self): + pass + + def draw(self): + pass + + def destroy(self): + pass |