Пример #1
0
 def SCIUnpackNotifyMessage(self, msg):
     format = "iiiiPiiiPPiiii"
     bytes = win32ui.GetBytes(msg, struct.calcsize(format))
     (
         position,
         ch,
         modifiers,
         modificationType,
         text_ptr,
         length,
         linesAdded,
         msg,
         wParam,
         lParam,
         line,
         foldLevelNow,
         foldLevelPrev,
         margin,
     ) = struct.unpack(format, bytes)
     return ScintillaNotification(
         position=position,
         ch=ch,
         modifiers=modifiers,
         modificationType=modificationType,
         text_ptr=text_ptr,
         length=length,
         linesAdded=linesAdded,
         msg=msg,
         wParam=wParam,
         lParam=lParam,
         line=line,
         foldLevelNow=foldLevelNow,
         foldLevelPrev=foldLevelPrev,
         margin=margin,
     )
        def __on_spin_change(self, hwnd, msg, wparam, lparam):
            id = win32api.LOWORD(wparam)

            # Read the NMUPDOWN structure
            format = 'Pqqii' if platform.architecture(
            )[0] == '64bit' else 'Piiii'
            bytes = win32ui.GetBytes(lparam, struct.calcsize(format))
            _, _, _, _, i_delta = struct.unpack(format, bytes)

            if id == self.resources.ids['IDC_SPIN_HOURS']:
                time = self.get_time() - i_delta * 60
                self.set_time(time)
            elif id == self.resources.ids['IDC_SPIN_MINUTES']:
                time = self.get_time() - i_delta
                self.set_time(time)
Пример #3
0
    def OnWindowPosChanged(self, msg):
        if self.GetSafeHwnd() == 0 or self.dialog is None:
            return 0
        lparam = msg[3]
        """ LPARAM used with WM_WINDOWPOSCHANGED:
			typedef struct {
				HWND hwnd;
				HWND hwndInsertAfter;
				int x;
				int y;
				int cx;
				int cy;
				UINT flags;} WINDOWPOS;
		"""
        format = "PPiiiii"
        bytes = win32ui.GetBytes(lparam, struct.calcsize(format))
        hwnd, hwndAfter, x, y, cx, cy, flags = struct.unpack(format, bytes)

        if self.bInRecalcNC:
            rc = self.GetClientRect()
            self.dialog.MoveWindow(rc)
            return 0
        # Find on which side are we docked
        nDockBarID = self.GetParent().GetDlgCtrlID()
        # Return if dropped at same location
        # no docking side change and no size change
        if ((nDockBarID == self.nDockBarID) and (flags & win32con.SWP_NOSIZE)
                and ((self._obj_.dwStyle & afxres.CBRS_BORDER_ANY) !=
                     afxres.CBRS_BORDER_ANY)):
            return
        self.nDockBarID = nDockBarID

        # Force recalc the non-client area
        self.bInRecalcNC = 1
        try:
            swpflags = (win32con.SWP_NOSIZE
                        | win32con.SWP_NOMOVE
                        | win32con.SWP_NOZORDER
                        | win32con.SWP_FRAMECHANGED)
            self.SetWindowPos(0, (0, 0, 0, 0), swpflags)
        finally:
            self.bInRecalcNC = 0
        return 0