示例#1
0
def cache_pointer_offset(self, event):
    #this overrides the window._get_pointer method
    #so we can cache the GTK position offset for synthetic wheel events
    gtk_x, gtk_y = event.x_root, event.y_root
    pos = POINT()
    GetCursorPos(ctypes.byref(pos))
    x, y = pos.x, pos.y
    self.win32_pointer_offset = gtk_x - x, gtk_y - y
    return gtk_x, gtk_y
示例#2
0
 def click_callback(button, pressed):
     menu = CreatePopupMenu()
     AppendMenu(menu, win32con.MF_STRING, 1024, u"Generate balloon")
     AppendMenu(menu, win32con.MF_STRING, 1025, u"Exit")
     pos = POINT()
     GetCursorPos(byref(pos))
     hwnd = tray.hwnd
     user32.SetForegroundWindow(hwnd)
     user32.TrackPopupMenu(menu, win32con.TPM_LEFTALIGN, pos.x, pos.y, 0, hwnd, None)
     PostMessageA(hwnd, win32con.WM_NULL, 0, 0)
示例#3
0
 def move_cb(self, *args):
     pos = wintypes.POINT()
     GetCursorPos(byref(pos))
     x, y = pos.x, pos.y
     w = GetSystemMetrics(win32con.SM_CXSMICON)
     h = GetSystemMetrics(win32con.SM_CYSMICON)
     x += self.offset_x
     y += self.offset_y
     log("move_cb%s x=%s, y=%s, size=%i, %i", args, x, y, w, h)
     self.recalculate_geometry(x, y, w, h)
     if self.mouseover_cb:
         self.mouseover_cb(x, y)
示例#4
0
 def click_callback(button, pressed):
     CreatePopupMenu = user32.CreatePopupMenu
     CreatePopupMenu.restype = ctypes.wintypes.HMENU
     CreatePopupMenu.argtypes = []
     AppendMenu = user32.AppendMenuW
     AppendMenu.restype = ctypes.wintypes.BOOL
     AppendMenu.argtypes = [
         ctypes.wintypes.HMENU, ctypes.wintypes.UINT, ctypes.wintypes.UINT,
         ctypes.wintypes.LPCWSTR
     ]
     menu = CreatePopupMenu()
     AppendMenu(menu, win32con.MF_STRING, 1024, u"Generate balloon")
     AppendMenu(menu, win32con.MF_STRING, 1025, u"Exit")
     pos = POINT()
     GetCursorPos(byref(pos))
     hwnd = tray.hwnd
     user32.SetForegroundWindow(hwnd)
     user32.TrackPopupMenu(menu, win32con.TPM_LEFTALIGN, pos.x, pos.y, 0,
                           hwnd, None)
     PostMessageA(hwnd, win32con.WM_NULL, 0, 0)