diff options
author | Marco Pesenti Gritti <mpg@redhat.com> | 2007-08-16 14:46:21 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <mpg@redhat.com> | 2007-08-16 14:46:21 (GMT) |
commit | ba8a731aa171a47932010abc83fd51adb59de08c (patch) | |
tree | 8ed31325799783bd07ca2ce6263b91bdd8c6e00e /shell/view/frame/framewindow.py | |
parent | 4ad4fe9ec8caf64f99714bbc63435d4ffbc5bb8d (diff) |
Add a border to the frame.
Diffstat (limited to 'shell/view/frame/framewindow.py')
-rw-r--r-- | shell/view/frame/framewindow.py | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/shell/view/frame/framewindow.py b/shell/view/frame/framewindow.py index 469ea65..82dcb32 100644 --- a/shell/view/frame/framewindow.py +++ b/shell/view/frame/framewindow.py @@ -21,11 +21,12 @@ from sugar.graphics import style class FrameWindow(gtk.Window): __gtype_name__ = 'SugarFrameWindow' - def __init__(self, orientation): + + def __init__(self, position): gtk.Window.__init__(self) self.hover = False - self._orientation = orientation + self._position = position self.set_decorated(False) self.connect('realize', self._realize_cb) @@ -36,33 +37,55 @@ class FrameWindow(gtk.Window): self.add(self._canvas) self._canvas.show() - self._bg = hippo.CanvasBox(orientation=self._orientation) - self._canvas.set_root(self._bg) + box = hippo.CanvasBox() + self._canvas.set_root(box) + + padding = style.GRID_CELL_SIZE + if self._position == gtk.POS_TOP or self._position == gtk.POS_BOTTOM: + box.props.orientation = hippo.ORIENTATION_HORIZONTAL + box.props.padding_left = padding + box.props.padding_right = padding + box.props.padding_top = 0 + box.props.padding_bottom = 0 + else: + box.props.orientation = hippo.ORIENTATION_VERTICAL + box.props.padding_left = 0 + box.props.padding_right = 0 + box.props.padding_top = padding + box.props.padding_bottom = padding + + self._bg = hippo.CanvasBox( + border_color=style.COLOR_BUTTON_GREY.get_int()) + + border = style.LINE_WIDTH + if position == gtk.POS_TOP: + self._bg.props.orientation = hippo.ORIENTATION_HORIZONTAL + self._bg.props.border_bottom = border + elif position == gtk.POS_BOTTOM: + self._bg.props.orientation = hippo.ORIENTATION_HORIZONTAL + self._bg.props.border_top = border + elif position == gtk.POS_LEFT: + self._bg.props.orientation = hippo.ORIENTATION_VERTICAL + self._bg.props.border_right = border + elif position == gtk.POS_RIGHT: + self._bg.props.orientation = hippo.ORIENTATION_VERTICAL + self._bg.props.border_left = border + + box.append(self._bg, hippo.PACK_EXPAND) self._update_size() screen = gtk.gdk.screen_get_default() screen.connect('size-changed', self._size_changed_cb) - def get_root(self): - return self._bg + def append(self, child, flags=0): + self._bg.append(child, flags) def _update_size(self): - padding = style.GRID_CELL_SIZE - if self._orientation == hippo.ORIENTATION_HORIZONTAL: - self._bg.props.padding_left = padding - self._bg.props.padding_right = padding - self._bg.props.padding_top = 0 - self._bg.props.padding_bottom = 0 - + if self._position == gtk.POS_TOP or self._position == gtk.POS_BOTTOM: width = gtk.gdk.screen_width() height = style.GRID_CELL_SIZE else: - self._bg.props.padding_left = 0 - self._bg.props.padding_right = 0 - self._bg.props.padding_top = padding - self._bg.props.padding_bottom = padding - width = style.GRID_CELL_SIZE height = gtk.gdk.screen_height() self.resize(width, height) |