[Python-checkins] CVS: python/dist/src/Mac/Tools/IDE Wcontrols.py,1.10,1.10.2.1

Jack Jansen jackjansen@users.sourceforge.net
Tue, 20 Nov 2001 15:21:32 -0800


Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE
In directory usw-pr-cvs1:/tmp/cvs-serv8289/Python/Mac/Tools/IDE

Modified Files:
      Tag: r22b2-branch
	Wcontrols.py 
Log Message:
Merged Just's trunk changes.

Index: Wcontrols.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wcontrols.py,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -C2 -d -r1.10 -r1.10.2.1
*** Wcontrols.py	2001/11/02 22:51:42	1.10
--- Wcontrols.py	2001/11/20 23:21:30	1.10.2.1
***************
*** 18,21 ****
--- 18,22 ----
  		self._max = max
  		self._enabled = 1
+ 		self._viewsize = 0
  	
  	def open(self):
***************
*** 30,35 ****
  						self._procID, 
  						0)
! 		self.SetPort()
! 		#self.GetWindow().ValidWindowRect(self._bounds)
  		self.enable(self._enabled)
  	
--- 31,36 ----
  						self._procID, 
  						0)
! 		if self._viewsize:
! 			self._control.SetControlViewSize(self._viewsize)
  		self.enable(self._enabled)
  	
***************
*** 76,82 ****
  	
  	def test(self, point):
! 		ctltype, control = Ctl.FindControl(point, self._parentwindow.wid)
! 		if self._enabled and control == self._control:
  			return 1
  	
  	def click(self, point, modifiers):
--- 77,85 ----
  	
  	def test(self, point):
! 		if Qd.PtInRect(point, self._bounds) and self._enabled:
  			return 1
+ 		#ctltype, control = Ctl.FindControl(point, self._parentwindow.wid)
+ 		#if self._enabled and control == self._control:
+ 		#	return 1
  	
  	def click(self, point, modifiers):
***************
*** 113,119 ****
  	"""Standard push button."""
  	
  	def __init__(self, possize, title = "Button", callback = None):
! 		procID = Controls.pushButProc | Controls.useWFont
! 		ControlWidget.__init__(self, possize, title, procID, callback, 0, 0, 1)
  		self._isdefault = 0
  	
--- 116,123 ----
  	"""Standard push button."""
  	
+ 	procID = Controls.pushButProc | Controls.useWFont
+ 	
  	def __init__(self, possize, title = "Button", callback = None):
! 		ControlWidget.__init__(self, possize, title, self.procID, callback, 0, 0, 1)
  		self._isdefault = 0
  	
***************
*** 121,126 ****
--- 125,132 ----
  		if not self._enabled:
  			return
+ 		# emulate the pushing of the button
  		import time
  		self._control.HiliteControl(Controls.kControlButtonPart)
+ 		Qd.QDFlushPortBuffer(self._parentwindow.wid, None)  # needed under OSX
  		time.sleep(0.1)
  		self._control.HiliteControl(0)
***************
*** 140,144 ****
--- 146,168 ----
  			self._control.Draw1Control()
  	
+ 	def open(self):
+ 		ControlWidget.open(self)
+ 		if self._isdefault:
+ 			self._setdefault(self._isdefault)
+ 	
  	def _setdefault(self, onoff):
+ 		c = self._control
+ 		if c is not None:
+ 			if onoff:
+ 				data = "\xFF"
+ 			else:
+ 				data = "\0"
+ 			# hide before changing state, otherwise the button isn't always
+ 			# redrawn correctly, although it's quite different under Aqua
+ 			# and Classic...
+ 			c.HideControl()
+ 			c.SetControlData(Controls.kControlNoPart,
+ 					Controls.kControlPushButtonDefaultTag, data)
+ 			c.ShowControl()
  		self._isdefault = onoff
  	
***************
*** 153,156 ****
--- 177,184 ----
  
  
+ class BevelButton(Button):
+ 	procID = Controls.kControlBevelButtonNormalBevelProc | Controls.useWFont
+ 
+ 
  class CheckBox(ControlWidget):
  	
***************
*** 251,261 ****
  	
  	def setmin(self, min):
! 		self._control.SetControl32BitMinimum(min)
  	
  	def setmax(self, max):
! 		self._control.SetControl32BitMaximum(max)
  	
! 	def setviewsize(self, view):
! 		self._control.SetControlViewSize(view)
  	
  	def getmin(self):
--- 279,298 ----
  	
  	def setmin(self, min):
! 		if self._control is not None:
! 			self._control.SetControl32BitMinimum(min)
! 		else:
! 			self._min = min
  	
  	def setmax(self, max):
! 		if self._control is not None:
! 			self._control.SetControl32BitMaximum(max)
! 		else:
! 			self._max = max
  	
! 	def setviewsize(self, viewsize):
! 		if self._control is not None:
! 			self._control.SetControlViewSize(viewsize)
! 		else:
! 			self._viewsize = viewsize
  	
  	def getmin(self):
***************
*** 313,317 ****
  		if self._visible:
  			self._control.Draw1Control()
! 			Qd.FrameRect(self._bounds)
  	
  	def adjust(self, oldbounds):
--- 350,354 ----
  		if self._visible:
  			self._control.Draw1Control()
! 			#Qd.FrameRect(self._bounds)
  	
  	def adjust(self, oldbounds):