Ejemplo n.º 1
0
	def Tile(self, flag='vertical'):
		if flag=='vertical': flag= 0			# MDITILE_VERTICAL
		if flag=='horizontal': flag= 1		# MDITILE_HORIZONTAL
		#elif flag=='zorder': flag= 4			# MDITILE_ZORDER	## ??
		WM_MDITILE          = 550
		if not user32.SendMessageA(self.Hwnd, WM_MDITILE, flag, 0):
			raise "could not tile windows"
Ejemplo n.º 2
0
 def PressButton(self, button):
     if self.Hwnd:
         try:
             iButton = PROP_BUTTONS.index(button)
         except:
             raise ValueError, "invalid burron: %s" % button
         user32.SendMessageA(self.Hwnd, PSM_PRESSBUTTON, iButton, 0)
Ejemplo n.º 3
0
 def RemovePage(self, i):
     if self.Hwnd:
         user32.SendMessageA(self.Hwnd, PSM_REMOVEPAGE, i, 0)
         try:
             del self._client_pages[i]
         except:
             raise ValueError, "no such page: %s" % i
Ejemplo n.º 4
0
 def GetTabControl(self):
     if self.Hwnd:
         result = user32.SendMessageA(self.Hwnd, PSM_GETTABCONTROL, 0, 0)
         if result:
             from wnd.controls import tab
             t = tab.TabFromHandle(result)
             fw.SetFlagMsgReflect(t, False)
             return t
Ejemplo n.º 5
0
	def SetSelection(self, pIdlOrPath):
		if not self.Hwnd: raise "dialog box is not running"
		if isinstance(pIdlOrPath, (str, unicode)):	
			p=create_string_buffer(pIdlOrPath)
			flag=1
		else: 
			p=byref(pIdlOrPath)
			flag=0
		user32.SendMessageA(self.Hwnd, BFFM_SETSELECTIONA , flag, p)
Ejemplo n.º 6
0
    def AddPage(self, dlg, *flags, **kwargs):
        ## the propsheet takes care about the handle of the page

        if self.Hwnd:
            self._client_page(dlg, *flags, **kwargs)
            hPage = comctl32.CreatePropertySheetPage(
                byref(self._client_pages[-1]))
            if hPage:
                user32.SendMessageA(self.Hwnd, PSM_ADDPAGE, 0, hPage)
                return True
        return False
Ejemplo n.º 7
0
def IsDialogReflectMessage(hwnd, msg, wp, lp, dlgmode):
    #print dlgmode
    ## TODO: test

    ## filter WM_COMMAND for dialog boxes
    if msg == 273:  # WM_COMMAND

        #print wp, lp
        if lp:
            if dlgmode == 'modeless':
                return ReflectMessage(hwnd, lp, msg, wp, lp)

            if lp != 1:  # IDOK
                if lp != 2:  # IDCANCEL
                    #DM_GETDEFID      = WM_USER + 0
                    result = user32.SendMessageA(hwnd, 1024, 0, 0)

                    if HIWORD(result) == 21323:  # DC_HASDEFID
                        defID = user32.GetDlgItem(hwnd, LOWORD(result))

                        if defID != lp:
                            return ReflectMessage(hwnd, lp, msg, wp, lp)
                    else:
                        return ReflectMessage(hwnd, lp, msg, wp, lp)

    elif msg == 276:  # WM_HSCROLL
        if lp: return ReflectMessage(hwnd, lp, msg, wp, lp)

    elif msg == 277:  # WM_VSCROLL
        if lp: return ReflectMessage(hwnd, lp, msg, wp, lp)

    elif msg == 78:  # WM_NOTIFY
        nm = NMHDR.from_address(lp)
        return ReflectMessage(hwnd, nm.hwndFrom, msg, wp, lp)

    elif msg == 43:  # WM_DRAWITEM
        # NOTE
        # can not reflect to comboboxes (ODT_COMBOBOX)
        # they do block all messages here
        # ?? do it anyway
        return ReflectMessage(hwnd, user32.GetDlgItem(hwnd, wp), msg, wp, lp)

    elif msg == 44:  # WM_MEASUREITEN
        # NOTE
        # can not reflect to comboboxes (ODT_COMBOBOX)
        # they do block all messages here
        # ?? do it anyway
        return ReflectMessage(hwnd, user32.GetDlgItem(hwnd, wp), msg, wp, lp)

    return None
Ejemplo n.º 8
0
	def Destroy(self):
		"""Destroys the accelerator table."""
		if self.handle:
			if self._client_hwndParent:
				mn= WND_MENU(self.handle, fw.MNUT_ACCEL, fw.MNUF_REMOVE)
				user32.SendMessageA(self._client_hwndParent, 
										fw.WND_WM_NOTIFY,
										fw.WND_NM_MENU,
										byref(nm))
			TrackHandler.Unregister('acceleratortables', self.handle)
			if not user32.DestroyAcceleratorTable(self.handle):
				raise RuntimeError("could not destroy accelerator table")
			self.handle = 0
			self._client_hwndParent = None
Ejemplo n.º 9
0
	def IconArrange(self):
		user32.SendMessageA(self.Hwnd, WM_MDIICONARRANGE, 0, 0)
Ejemplo n.º 10
0
 def SetTitle(self, title, proptitle=False):
     #PSH_PROPTITLE   =        0x00000001
     if self.Hwnd:
         user32.SendMessageA(self.Hwnd, PSM_SETTITLE, proptitle and 1 or 0,
                             title)
Ejemplo n.º 11
0
	def Cascade(self, skipdisabled=True):
		if skipdisabled: flag= 2	# MDITILE_SKIPDISABLED
		else: flag= 0
		WM_MDICASCADE       = 551
		if not user32.SendMessageA(self.Hwnd, WM_MDICASCADE, flag, 0):
			raise "could not cascade windows"
Ejemplo n.º 12
0
	def IsMaximized(self, hwnd):
		b= BOOL()
		user32.SendMessageA(self.Hwnd, WM_MDIGETACTIVE, 0, byref(b))
		return bool(b.value)
Ejemplo n.º 13
0
	def Restore(self, hwnd):
		user32.SendMessageA(self.Hwnd, WM_MDIRESTORE, hwnd, 0)
Ejemplo n.º 14
0
 def SelectHwnd(self, hwnd):
     if self.Hwnd:
         return bool(user32.SendMessageA(self.Hwnd, PSM_SETCURSEL, 0, hwnd))
Ejemplo n.º 15
0
	def Maximize(self, hwnd):
		user32.SendMessageA(self.Hwnd, WM_MDIMAXIMIZE, hwnd, 0)
Ejemplo n.º 16
0
 def Reboot(self):
     if self.Hwnd:
         user32.SendMessageA(self.Hwnd, PSM_REBOOTSYSTEM, 0, 0)
         self._client_fReboot = 'reboot'
Ejemplo n.º 17
0
	def ActivatePrevious(self, hwnd=None):
		user32.SendMessageA(self.Hwnd, WM_MDINEXT, hwnd and hwnd or 0, 1)
Ejemplo n.º 18
0
def CopyData(hwndSource, hwndDest, lp, data, reserved=0):
    p = create_string_buffer(SZ_GUID_COPYDATA + data)
    ## do not include NULL byte in cbData
    cd = COPYDATASTRUCT(MAKELONG(lp, reserved), sizeof(p) - 1, addressof(p))
    return bool(
        user32.SendMessageA(hwndDest, WM_COPYDATA, hwndSource, byref(cd)))
Ejemplo n.º 19
0
 def Restart(self):
     if self.Hwnd:
         user32.SendMessageA(self.Hwnd, PSM_RESTARTWINDOWS, 0, 0)
         self._client_fReboot = 'restart'
Ejemplo n.º 20
0
 def QuerySiblings(self, param1, param2):
     result = user32.SendMessageA(self.Hwnd, PSM_QUERYSIBLINGS, param1,
                                  param2)
Ejemplo n.º 21
0
 def SetFinishText(self, text):
     if self.Hwnd:
         user32.SendMessageA(self.Hwnd, PSM_SETFINISHTEXT, 0, text)
Ejemplo n.º 22
0
 def GetCurrentPage(self):
     if self.Hwnd:
         return user32.SendMessageA(self.Hwnd, PSM_GETCURRENTPAGEHWND, 0, 0)
Ejemplo n.º 23
0
def ReflectMessage(hwnd, hwndTo, msg, wp, lp):

    msgr = WND_MSGREFLECT(hwnd, msg, wp, lp)
    result = user32.SendMessageA(hwndTo, WND_WM_NOTIFY, WND_NM_MSGREFLECT,
                                 addressof(msgr))
    if msgr.fReturn: return result
Ejemplo n.º 24
0
	def Destroy(self, hwnd):
		user32.SendMessageA(self.Hwnd, WM_MDIDESTROY, hwnd, 0)
Ejemplo n.º 25
0
	def Activate(self, hwnd):
		return user32.SendMessageA(self.Hwnd, WM_MDIACTIVATE, hwnd, 0)
Ejemplo n.º 26
0
 def Select(self, i):
     if self.Hwnd:
         return bool(user32.SendMessageA(self.Hwnd, PSM_SETCURSEL, i, 0))
Ejemplo n.º 27
0
	def EnableOK(self):
		"""Enables the OK button"""
		if not self.Hwnd: raise "dialog box is not running"
		user32.SendMessageA(self.Hwnd, BFFM_ENABLEOK , 0, 1)
Ejemplo n.º 28
0
	def GetActive(self):
		return user32.SendMessageA(self.Hwnd, WM_MDIGETACTIVE, 0, 0)
Ejemplo n.º 29
0
	def SetStatusText(self, text):
		"""Sets the status text."""
		if not self.Hwnd: raise "dialog box is not running"
		p=create_string_buffer(text)
		user32.SendMessageA(self.Hwnd, BFFM_SETSTATUSTEXTA, 0, p)
Ejemplo n.º 30
0
	def ActivateNext(self, hwnd=None):
		user32.SendMessageA(self.Hwnd, WM_MDINEXT, hwnd and hwnd or 0, 0)