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

Diff of /gnue/common/src/cursing/ComboBox.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  # ComboBox.py  # ComboBox.py
# Line 31  from constants import * Line 31  from constants import *
31  from Menu import Menu  from Menu import Menu
32  from Button import Button  from Button import Button
33  from Control import Control  from Control import Control
34    from TextBox import TextBox
35    
36  class ComboBox(Control):  class ComboBox(TextBox):
37    def __init__(self,Parent,BoxName, Y, X, W, **properties):    def __init__(self,Parent,BoxName, Y, X, W, editable=0,**properties):
38      apply(Control.__init__,(self,Parent,BoxName),properties)      TextBox.__init__(self, Parent, BoxName, Y, X, W-4)
39      self.PARENT = Parent      self.PARENT = Parent
40      self.Y = Y      self.Y = Y
41      self.X = X      self.X = X
42      self.W = W      self.W = W - 4
43      self.H = 2      self.H = 1
44        self.EDITABLE = editable
45    
46      menuName = (W-5) * ' '      menuName = (W-5) * ' '
47      self._menu = Menu(Parent,'cbm',Y,X+1,menuName)      self._menu = Menu(Parent,'cbm',Y,X+1,menuName)
48      self._button = Button(Parent,'cbbutt',Y,X+W-4,3,chr(tiDAW))      self._button = Button(Parent,'cbbutt',Y,X+W-4,3,chr(tiDAW))
# Line 49  class ComboBox(Control): Line 52  class ComboBox(Control):
52      self._menu.maxLengthFixed = 1      self._menu.maxLengthFixed = 1
53      self._menu.maxLength = W - 4      self._menu.maxLength = W - 4
54      self._chosen = None      self._chosen = None
55      Parent.AddControl(self._menu)      self.VALUES = []
56    
57      Parent.AddControl(self._button)      Parent.AddControl(self._button)
58      self.SetMethod("SYSPAINT", self.Paint)  ##    Parent.AddControl(self._menu)
59    
60    def Paint(self,v1,v2,v3):  #  def Paint(self,v1,v2,v3):
61      Screen = self.PARENT.Screen()  #
62      Screen.AutoRefresh = 0  #    return
63      self.SetColor(1)  #    Screen = self.PARENT.Screen()
64      X = self._ABSX  #    Screen.AutoRefresh = 0
65      Y = self._ABSY  #    self.SetColor(1)
66      W = self.W  #    X = self._ABSX
67      Screen.PrintAt(Y,X,chr(tiVLINE))  #    Y = self._ABSY
68      Screen.PrintAt(Y,X+W-1,chr(tiVLINE))  #    W = self.W
69      Screen.PrintAt(Y+1,X, chr(tiLLC) + (W-2) * chr(tiHLINE) + chr(tiLRC))  ##    Screen.PrintAt(Y,X,chr(tiVLINE))
70      Screen.AutoRefresh = 1  ##    Screen.PrintAt(Y,X+W-1,chr(tiVLINE))
71    ##    Screen.PrintAt(Y+1,X, chr(tiLLC) + (W-2) * chr(tiHLINE) + chr(tiLRC))
72    #    Screen.AutoRefresh = 1
73    
74    def _Show(self,v1,v2,v3):    def _Show(self,v1,v2,v3):
75      self._menu.ShowOff(None,None,None)      self._menu.ShowOff(None,None,None)
# Line 77  class ComboBox(Control): Line 83  class ComboBox(Control):
83    
84    def AddItem(self,id,text):    def AddItem(self,id,text):
85      self._menu.AddItem(id,text)      self._menu.AddItem(id,text)
86        self.VALUES.append((id, text))
87    
88    def Clear(self):    def Clear(self):
89      self._menu.Clear()      self._menu.Clear()
90        self.VALUES = []
91    
92    def SetValue(self, value):  #  def SetValue(self, value):
93      GDebug.printMesg(0,'WARNING: SetValue called on a combo box... not yet implemented')  #    GDebug.printMesg(0,'WARNING: SetValue called on a combo box... not yet implemented')
   
   def GetValue(self):  
     GDebug.printMesg(0,'WARNING: GetValue called on a combo box... not yet implemented')  
   
94    
95    #  def GetValue(self):
96    #    GDebug.printMesg(0,'WARNING: GetValue called on a combo box... not yet implemented')
97    

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