Exemple #1
0
	def OnSystemMessage( self, hWnd, messageID, wParam, lParam ):
		"""Handle an appbar system message

		These messages come when the windows taskbar
		is moved or resized (or otherwise changed) and
		they have the effect of requiring a resize of
		our taskbar (normally).  Unfortunately, there's
		nothing I can see which tells us whether the
		taskbar is underneath our currently-reserved
		area, so we wind up with a possible overlap
		condition if the taskbar is dragged to our side
		of the screen :( .

		wParam == 3 -- cascade or tile of windows
			ABN_WINDOWARRANGE notification
		wParam == 1 -- position changed for the appbar
			(incl. resize window)
			ABN_POSCHANGED notification
		wParam == 0 -- auto-hide/always-on-top state
			changed for the taskbar
			ABN_STATECHANGE notification
		"""
		if wParam == 1:
			if self.FORCE_REDOCK_ON_SYSTEM_MESSAGE:
				self.Undock()
				self.Dock()
			else:
				self.OnMove()
		events.send(
			self,
			events.AppBarSystemMessageEvent,
			wParam = wParam,
			lParam = lParam,
		)
Exemple #2
0
	def Undock( self ):
		"""Undock the frame"""
		try:
			if self._data:
				self._data.remove()
			events.send(
				self,
				events.AppBarDockEvent,
				self.dockSide,
				0, # docking false
				self.dockedPosition[:2],
				self.dockedPosition[2:],
			)
		finally:
			try:
				while self._data in self._registeredBars:
					self._registeredBars.remove( self._data )
			finally:
				self.docked = 0
				self._data = None
Exemple #3
0
	def Dock( self, side = None ):
		"""Dock the AppFrame on the given side

		side {'l','r','t','b'} -- string indicating
			the side of the screen on which to dock,
			or None to dock on the currently-set side.
		"""
		if side and side != self.dockSide:
			if self.docked:
				self.Undock()
		if self.docked:
			return 0
		self._data = data = _appbar.ApplicationBar()
		# resize to be somewhat appropriate...
		side = side or self.dockSide
		self.dockSide = side
		data.new( self.GetHandle(), edge = side)
		x,y,w,h = self.dockedPosition = data.setPosition( self.CalculateRectangle(dockSide=side) )
		if not self._callback:
			self._callback = winmsgproc.MessageCallback(
				hWnd = self.GetHandle(),
				messageMap = {
					data.uCallbackMessage: self.OnSystemMessage,
				},
			)
		self.docked = 1
		self._registeredBars.append( data )
		self.SetSize( (w,h) )
		self.SetPosition( (x,y) )
		events.send(
			self,
			events.AppBarDockEvent,
			side,
			1, # docking true
			(x,y),
			(w,h),
		)