/[papo]/gnue/common/src/cursing/Dialog.py
ViewVC logotype

Diff of /gnue/common/src/cursing/Dialog.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by styxman, Fri Nov 15 15:32:55 2002 UTC revision 1.1.2.1 by anthonyl, Tue Mar 4 22:09:33 2003 UTC
# Line 16  Line 16 
16  # write to the Free Software Foundation, Inc., 59 Temple Place  # write to the Free Software Foundation, Inc., 59 Temple Place
17  # - Suite 330, Boston, MA 02111-1307, USA.  # - Suite 330, Boston, MA 02111-1307, USA.
18  #  #
19  # Copyright 2002 Free Software Foundation  # Copyright 2002-2003 Free Software Foundation
20  #  #
21  # FILE:  # FILE:
22  # Dialog.py  # Dialog.py
# Line 60  class Dialog(ScreenContainer): Line 60  class Dialog(ScreenContainer):
60      self.C2 = c2      self.C2 = c2
61      self.DROPSHADOW = dropshadow      self.DROPSHADOW = dropshadow
62      self.BORDER = border      self.BORDER = border
63        self._ChildOffsetX = 2
64        self._ChildOffsetY = 1
65    
66      # need to add some sanity checks for bad params here:      # need to add some sanity checks for bad params here:
67      #if r1 > 0 and r1 <= SIOInstance.MAXROW:      #if r1 > 0 and r1 <= SIOInstance.MAXROW:
# Line 76  class Dialog(ScreenContainer): Line 78  class Dialog(ScreenContainer):
78      self.INSET = 0      self.INSET = 0
79      self.buffer = self.Screen().CaptureScreen(self.R1,      self.buffer = self.Screen().CaptureScreen(self.R1,
80          self.C1, self.R2 + dropshadow + border*2, self.C2 + dropshadow + border*2)          self.C1, self.R2 + dropshadow + border*2, self.C2 + dropshadow + border*2)
81      self.SetColor(sio.C_DIALOG)      self.SetColor('DIALOG')
82    
83    def __del__(self):    def __del__(self):
84       pass       pass
85    
86    def AddDialogControl(self, TheControl):    def AddDialogControl(self, TheControl):
87      """      self.AddControl(TheControl)
       Make sure the control is visible in the limited area of the  
       dialog box  
     """  
     cRow = TheControl.Y  
     cRow = cRow + self.R1 + self.BORDER  
     cCol = TheControl.X  
     cCol = cCol + self.C1 + self.BORDER  
     TheControl.Y = cRow  
     TheControl.X = cCol  
     ScreenContainer.AddControl(self,TheControl)  
88      return TheControl      return TheControl
89    
   def AddControl(self,control):  
     return self.AddDialogControl(control)  
   
90    def _PaintBorder(self):    def _PaintBorder(self):
91      if not self.BORDER:      if not self.BORDER:
92        return        return
93    
     self.LoLight()  
94      _paintBorder( self, self._Y,self._X, self._DialogHeight + 2,      _paintBorder( self, self._Y,self._X, self._DialogHeight + 2,
95        self._DialogWidth + 2, self.INSET, caption=self.CAPTION,        self._DialogWidth + 2, self.INSET, caption=self.CAPTION,
96        captionColor=sio.C_DIALOG_TITLE)        color = self.COLOR,
97          captionColor=self.SCREEN.colors.C_DIALOG_TITLE)
98    
99    def _PaintDropShadow(self):    def _PaintDropShadow(self):
100      if not self.DROPSHADOW:      if not self.DROPSHADOW:
101        return        return
102    
     color = self.SCREEN.GetColor()  
     self.SCREEN.SetColor(0)  
   
103      self.SCREEN.PrintAt( self.R2 + self.BORDER*2, self.C1 + 1,      self.SCREEN.PrintAt( self.R2 + self.BORDER*2, self.C1 + 1,
104             (self._DialogWidth + self.BORDER*2) * " ")             (self._DialogWidth + self.BORDER*2) * " ", self.SCREEN.colors.C_DROPSHADOW)
105      for i in range(1,self._DialogHeight + self.BORDER*2):      for i in range(1,self._DialogHeight + self.BORDER*2):
106        self.SCREEN.PrintAt( self.R1 + i, self.C2 + self.BORDER*2, " ")        self.SCREEN.PrintAt( self.R1 + i, self.C2 + self.BORDER*2, " ", self.SCREEN.colors.C_DROPSHADOW)
   
     self.SCREEN.SetColor(color)  
107    
108    def RunDialog(self):    def RunDialog(self):
109      self._PaintBorder()      self._PaintBorder()

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26