Пример #1
0
    def onMouseMove(self, params):
        if self._tooltip is not None:
            self.notifyTooltipForMouseMove(params)
        msg = win32mu.Win32Msg(params)
        point = msg.pos()
        point = self._DPtoLP(point)
        # Find modifier keys. Code gleaned from the way Michael did this in the
        # HierarchyView, I'm pretty sure there must be a better way to do this.
        keystatus = params[2] # is a bunch of boolean flags for each key.
        ctrlstatus = keystatus & win32con.MK_CONTROL # i.e. 0x8 or 0x0
        if ctrlstatus:
            modifiers = 'add'
        else:
            modifiers = None
        self.onEvent(MouseMove, (point[0], point[1], None, modifiers))
        if self._enableNodeDragDrop and self._dragging:
            xp, yp = self._dragging
            x, y = win32mu.Win32Msg(params).pos()
            if math.fabs(xp-x)>4 or math.fabs(yp-y)>4:
                # experimental: get node at xp, yp
                xp, yp = self._DPtoLP((xp,yp))
                xp, yp = self._pxl2rel((xp, yp),self._canvas)
                flavor, args = self.onEventEx(QueryNode,(xp, yp))
                if flavor is None or args is None:
                    return
                flavorid, str = DropTarget.EncodeDragData(flavor, args)

                res = self.DoDragDrop(flavorid, str)
                self._dragging = None
                if not res:
                    self.onEvent(DragEnd, point)
Пример #2
0
    def OnCmd(self, params):
        if not self.is_showing():
            return
        editCtrl = self.GetRichEditCtrl()
        if not editCtrl:
            return

        # crack win32 message
        msg=win32mu.Win32Msg(params)
        nmsg=msg.getnmsg()
        code = msg.HIWORD_wParam()
        id = msg.LOWORD_wParam()
        hctrl = msg._lParam

        # response/dispatch cmd
        if hctrl == editCtrl.GetSafeHwnd():
            if code == win32con.EN_CHANGE:
                if self.__editctrl.GetModify() and not self.__setting:
                    self.enableDlgBarComponent(self.__apply, 1)
                    self.enableDlgBarComponent(self.__revert, 1)
                if self.__lineToSelect:
                    self.__lineToSelect = None
                    self.select_line(self.__lineToSelect)
        elif id == self.__ok._id:
            self.__ok_callback()
        elif id == self.__apply._id:
            self.__apply_callback()
        elif id == self.__revert._id:
            self.__revert_callback()
        elif id == self.__autoWrapCtrl._id:
            self.__autowrap_callback()
Пример #3
0
 def onParentSize(self, params):
     msg = win32mu.Win32Msg(params)
     if msg.minimized():
         self._isminimized = 1
         return
     self._isminimized = 0
     self.assertBmpHasMinSize(msg.width(), msg.height())
Пример #4
0
 def onMouseMove(self, params):
     if self._tooltip:
         self._tooltip.onMouseMove(params)
     msg = win32mu.Win32Msg(params)
     point = msg.pos()
     if not self.setcursor_from_point(point):
         self.setcursor(self._cursor)
Пример #5
0
 def OnRButtonDown(self, params):
     msg = win32mu.Win32Msg(params)
     point = msg.pos()
     flags = msg._wParam
     point = self.ClientToScreen(point)
     flags = win32con.TPM_LEFTALIGN | win32con.TPM_RIGHTBUTTON | win32con.TPM_LEFTBUTTON
     if self.popup:
         self.popup.TrackPopupMenu(point, flags, self.GetParent())
Пример #6
0
 def onLButtonUp(self, params):
     msg = win32mu.Win32Msg(params)
     point, flags = msg.pos(), msg._wParam
     self._lbuttondown = None
     point = self.DPtoLP(point)
     self._drawContext.onLButtonUp(flags, point)
     if self._tipwnd:
         self._tipwnd.hide()
Пример #7
0
 def OnCmd(self, params):
     msg = win32mu.Win32Msg(params)
     id = msg.cmdid()
     nmsg = msg.getnmsg()
     for k in self.keys():
         if self[k]._id == id:
             if self._cbdict.has_key(k):
                 apply(apply, self._cbdict[k])
             return
Пример #8
0
 def notifyTooltipForMouseMove(self, params):
     if self._tooltip is None:
         return
     msg=win32mu.Win32Msg(params)
     point=msg.pos()
     if self._active_displist and self._active_displist._inside_bbox(point):
         if 1: # over a tooltip source?
             self._tooltip.activate(1)
         else:
             self._tooltip.activate(0)
     else:
         self._tooltip.activate(0)
     self._tooltip.onMouseMove(params)
Пример #9
0
    def onMouseMove(self, params):
        msg = win32mu.Win32Msg(params)
        point, flags = msg.pos(), msg._wParam
        x, y = point
        # x and y are signed number
        x = win32mu.UInt16ToInt(x)
        y = win32mu.UInt16ToInt(y)
        point = x, y

        if self._lbuttondown is not None:
            self._lbuttondown = point
        point = self.DPtoLP(point)
        self._drawContext.onMouseMove(flags, point)
Пример #10
0
 def onMouseMove(self, params):
     msg = win32mu.Win32Msg(params)
     if self._dragging:
         xp, yp = self._dragging
         x, y = msg.pos()
         if math.fabs(xp - x) > 4 or math.fabs(yp - y) > 4:
             index = self.getItemAt(self._dragging)
             str = self.gettext(index)
             print 'dragging item:', str
             # start drag and drop
             self._mfcwnd.DoDragDrop(self.CF_LISTBOX_ITEM, str)
             self._dragging = None
     return 1
Пример #11
0
 def onLButtonUp(self, params):
     if self._tooltip:
         self._tooltip.onLButtonUp(params)
     msg = win32mu.Win32Msg(params)
     # Find modifier keys. Code gleaned from the way Michael did this in the
     # HierarchyView, I'm pretty sure there must be a better way to do this.
     keystatus = params[2]  # is a bunch of boolean flags for each key.
     ctrlstatus = keystatus & win32con.MK_CONTROL  # i.e. 0x8 or 0x0
     if ctrlstatus:
         params = 'add'
     else:
         params = None
     self.onMouseEvent(msg.pos(), Mouse0Release, params)
Пример #12
0
 def onDropFiles(self, params):
     msg = win32mu.Win32Msg(params)
     hDrop = msg._wParam
     inclient, point = Sdk.DragQueryPoint(hDrop)
     # convert from client to canvas pixel coordinates
     # for the benefit of scrolling views
     x, y = self._DPtoLP(point)
     # accept only drops in client area
     if inclient:
         numfiles = win32api.DragQueryFile(hDrop, -1)
         for ix in range(numfiles):
             filename = win32api.DragQueryFile(hDrop, ix)
             self.onDropEvent(DropFile, (x, y, filename))
     win32api.DragFinish(hDrop)
Пример #13
0
 def onMouseMove(self, params):
     if self._enableToolDrag and self._dragging:
         x, y = win32mu.Win32Msg(params).pos()
         xp, yp = self._dragpos
         if math.fabs(xp - x) > 4 or math.fabs(yp - y) > 4:
             str = ` self._dragging `
             # start drag and drop. Not much use
             # in using DropTarget.EncodeDragData here
             # because it wants the usercmd and we already
             # have the cmdid here.
             self.DoDragDrop(DropTarget.CF_TOOL, str)
             self._dragging = None
             self.ReleaseCapture()
     return 1  # continue normal processing
Пример #14
0
 def onCmd(self, params):
     msg = win32mu.Win32Msg(params)
     id = msg.cmdid()
     nmsg = msg.getnmsg()
     if self._mcb.has_key(id):
         self.menu_callback(id, 0)
         return
     for key in self.keys():
         if id == self[key]._id:
             if id in self._lists_ids:
                 if nmsg == win32con.LBN_SELCHANGE: self.call(key)
             else:
                 self.call(key)
             break
Пример #15
0
    def OnCmd(self, params):
        # crack message
        msg = win32mu.Win32Msg(params)
        id = msg.cmdid()
        nmsg = msg.getnmsg()

        # special response
        if id == self['Groups']._id: self.OnListCmd(id, nmsg)

        # std stuff
        for k in self.keys():
            if self[k]._id == id:
                if self._cmddict.has_key(k):
                    apply(apply, self._cmddict[k])
                return
Пример #16
0
    def OnCmd(self,params):
        # crack message
        msg=win32mu.Win32Msg(params)
        id=msg.cmdid()
        nmsg=msg.getnmsg()

        # delegate list notifications
        for name in self._lnames:
            if id==self[name]._id:
                self.OnListCmd(id,nmsg)
                return

        # process rest
        cmd=None
        contextcmds=self._activecmds
        if contextcmds.has_key(id):
            cmd=contextcmds[id]
        if cmd is not None and cmd.callback is not None:
            apply(apply,cmd.callback)
Пример #17
0
    def onRButtonDown(self, params):
        msg = win32mu.Win32Msg(params)
        xpos, ypos = msg.pos()

        if self._menu:
            self.onLButtonDown(params, 0)
            id = self._menu.FloatMenu(self, xpos, ypos)
            if self._cbld.has_key(id):
                callback = self._cbld[id]
                apply(callback[0], callback[1])
        elif self._topwindow == self:
            menu = None
            if self._popupmenu:
                self.onLButtonDown(params, 0)
                menu = self._popupmenu
            if not menu: return
            pt = (xpos, ypos)
            self._popup_point = pt
            pt = self.ClientToScreen(pt)
            menu.TrackPopupMenu(
                pt, win32con.TPM_RIGHTBUTTON | win32con.TPM_LEFTBUTTON,
                self._parent)
Пример #18
0
 def onSize(self, params):
     msg = win32mu.Win32Msg(params)
     if msg.minimized(): return
     self._rect = 0, 0, msg.width(), msg.height()
     if self.fitCanvas(msg.width(), msg.height()):
         self._resize_tree()
Пример #19
0
 def onLButtonUp(self, params):
     msg = win32mu.Win32Msg(params)
     if self._dragging:
         self._dragging = None
     return 1
Пример #20
0
 def onLButtonDown(self, params):
     msg = win32mu.Win32Msg(params)
     self._dragging = msg.pos()
     return 1
Пример #21
0
 def onLButtonDblClk(self, params):
     msg = win32mu.Win32Msg(params)
     point, flags = msg.pos(), msg._wParam
     self._lbuttondblclk = point
     point = self.DPtoLP(point)
     self._drawContext.onLButtonDblClk(flags, point)
Пример #22
0
 def onLButtonDblClk(self, params):
     msg = win32mu.Win32Msg(params)
     pt = msg.pos()
     self.onMouseEvent(pt, Mouse0Press)
     self.onMouseEvent(pt, Mouse0Press)
Пример #23
0
 def onLButtonDown(self, params, maystartdrag = 1):
     DisplayListView.onLButtonDown(self, params)
     if self._enableNodeDragDrop and maystartdrag:
         msgpos=win32mu.Win32Msg(params).pos()
         self._dragging = msgpos
Пример #24
0
 def OnCommand(self, params):
     msg = win32mu.Win32Msg(params)
     self.getView().onUserCmd(msg.cmdid())
Пример #25
0
 def onLButtonDown(self, params):
     if self._enableToolDrag:
         msgpos = win32mu.Win32Msg(params).pos()
         self._dragging = self._findcommand(msgpos)
         self._dragpos = msgpos
     return 1  # continue normal processing