X-Git-Url: https://scm.cri.ensmp.fr/git/minwii.git/blobdiff_plain/346a9b8e1fcfe30629f0d1ee4675e9e8f89890cf..4c4732c6ed8cb0aaa70fb2d4c6e5a958868c5349:/src/pgu/gui/document.py?ds=inline
diff --git a/src/pgu/gui/document.py b/src/pgu/gui/document.py
deleted file mode 100644
index 1bd96df..0000000
--- a/src/pgu/gui/document.py
+++ /dev/null
@@ -1,112 +0,0 @@
-"""
-"""
-import pygame
-
-import container
-import layout
-
-class _document_widget:
- def __init__(self,w,align=None):
- #w.rect.w,w.rect.h = w.resize()
- #self.rect = w.rect
- self.widget = w
- if align != None: self.align = align
-
-class Document(container.Container):
- """A document container contains many widgets strung together in a document format. (How informative!)
-
-
Document()
-
- """
- def __init__(self,**params):
- params.setdefault('cls','document')
- container.Container.__init__(self,**params)
- self.layout = layout.Layout(pygame.Rect(0,0,self.rect.w,self.rect.h))
-
- def add(self,e,align=None):
- """Add a widget.
-
- Document.add(e,align=None)
-
-
- - e
- widget
-
- align
- alignment (None,-1,0,1)
-
- """
- dw = _document_widget(e,align)
- self.layout.add(dw)
- e.container = self
- e._c_dw = dw
- self.widgets.append(e)
- self.chsize()
-
- def remove(self,e):
- self.layout._widgets.remove(e._c_dw)
- self.widgets.remove(e)
- self.chsize()
-
-
- def block(self,align):
- """Start a new block.
-
- Document.block(align)
-
-
- - align
- alignment of block (-1,0,1)
-
- """
- self.layout.add(align)
-
- def space(self,e):
- """Add a spacer.
-
- Document.space(e)
-
-
- - e
- a (w,h) size for the spacer
-
- """
- self.layout.add(e)
-
- def br(self,height):
- """Add a line break.
-
- Document.br(height)
-
-
- - height
- height of line break
-
- """
- self.layout.add((0,height))
-
- def resize(self,width=None,height=None):
- if self.style.width: width = self.style.width
- if self.style.height: height = self.style.height
-
- for w in self.widgets:
- w.rect.w,w.rect.h = w.resize()
-
- if (width != None and w.rect.w > width) or (height != None and w.rect.h > height):
- w.rect.w,w.rect.h = w.resize(width,height)
-
- dw = w._c_dw
- dw.rect = pygame.Rect(0,0,w.rect.w,w.rect.h)
-
- if width == None: width = 65535
- self.layout.rect = pygame.Rect(0,0,width,0)
- self.layout.resize()
-
- _max_w = 0
-
- for w in self.widgets:
- #xt,xl,xb,xr = w.getspacing()
- dw = w._c_dw
- w.style.x,w.style.y,w.rect.w,w.rect.h = dw.rect.x,dw.rect.y,dw.rect.w,dw.rect.h
- #w.resize()
- w.rect.x,w.rect.y = w.style.x,w.style.y
- _max_w = max(_max_w,w.rect.right)
-
- #self.rect.w = _max_w #self.layout.rect.w
- #self.rect.h = self.layout.rect.h
- #print 'document',_max_w,self.layout.rect.h
- return _max_w,self.layout.rect.h