Update of /cvsroot/wnd/wnd/wnd/gdi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4773
Modified Files:
brush.py icon.py
Log Message:
bit of this and a bit of that
Index: icon.py
===================================================================
RCS file: /cvsroot/wnd/wnd/wnd/gdi/icon.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** icon.py 15 May 2005 09:39:35 -0000 1.2
--- icon.py 2 Jul 2005 09:16:28 -0000 1.3
***************
*** 1,7 ****
! """Bitmaps.
!
The module defines a list SYSTEM_ICONS with the string
identifiers all available predefined system icons to be used
with the 'systemicon' class.
"""
--- 1,7 ----
! """
The module defines a list SYSTEM_ICONS with the string
identifiers all available predefined system icons to be used
with the 'systemicon' class.
+
"""
***************
*** 17,21 ****
! __all__= ("GetShellIconSize", "GetShellSmallIconSize", "SYSTEM_ICONS", "IconFromHandle", "DisposableIcon", "IconFromFile", "FileIcon", "SystemIcon", "IconFromBytes", "GetSysIconIndex")
--- 17,21 ----
! __all__= ("GetShellIconSize", "GetShellSmallIconSize", "SYSTEM_ICONS", "IconFromHandle", "DisposableIcon", "IconFromFile", "FileIcon", "SystemIcon", "IconFromBytes", "IconFromInstance", "GetSysIconIndex")
***************
*** 38,41 ****
--- 38,51 ----
'shelliconsize' : 4} #'sysiconindex' : 4096
+ DI_FLAGS= {
+ 'mask':1,
+ 'image':2,
+ 'normal':3,
+ 'compat':4,
+ 'defaultsize':8,
+ 'nomirror':16,
+ }
+
+
#*********************************************
***************
*** 212,220 ****
raise RuntimeError("could not retrieve icon info")
bm=BITMAP()
! if not gdi32.GetObjectA(ii.hbmColor, sizeof(BITMAP), byref(bm)):
raise RuntimeError("could not retrieve bitmap info")
! gdi32.DeleteObject(ii.hbmMask)
! gdi32.DeleteObject(ii.hbmColor)
! return bm.bmWidth, bm.bmHeight
--- 222,233 ----
raise RuntimeError("could not retrieve icon info")
bm=BITMAP()
! if not gdi32.GetObjectA(ii.hbmMask, sizeof(BITMAP), byref(bm)):
raise RuntimeError("could not retrieve bitmap info")
! if ii.hbmMask:
! gdi32.DeleteObject(ii.hbmMask)
! if ii.hbmColor:
! gdi32.DeleteObject(ii.hbmColor)
! return bm.bmWidth, bm.bmHeight
! return bm.bmWidth, bm.bmHeight/2
***************
*** 230,233 ****
--- 243,255 ----
+
+ def DrawEx(self, dc, x, y, w, h, flag):
+ try: flag= DI_FLAGS[flag]
+ except: raise ValueError, "invalid flag: %s" % flag
+ if not user32.DrawIconEx(dc.handle, x, y, self.handle, w, h, 0, None, flag):
+ raise "could not draw icon"
+
+
+
def Draw(self, dc, x, y):
if not user32.DrawIcon(dc.handle, x, y, self.handle):
***************
*** 302,306 ****
self.handle = user32.LoadImageA(hInstance, resname, IMAGE_ICON, w, h, 0)
if not self.handle: raise RuntimeError("could not load icon: %s" % path)
! DisposableIcon.__init__(self, handle)
#**************************************************
--- 324,328 ----
self.handle = user32.LoadImageA(hInstance, resname, IMAGE_ICON, w, h, 0)
if not self.handle: raise RuntimeError("could not load icon: %s" % path)
! DisposableIcon.__init__(self, self.handle)
#**************************************************
Index: brush.py
===================================================================
RCS file: /cvsroot/wnd/wnd/wnd/gdi/brush.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** brush.py 15 May 2005 09:39:13 -0000 1.2
--- brush.py 2 Jul 2005 09:16:28 -0000 1.3
***************
*** 106,110 ****
try: color = SYSTEM_COLORS[colorname]
! except: raise ValueError("invalid color: %s" % color)
handle = user32.GetSysColorBrush(color)
if not handle: raise RuntimeError("could not create sys color brush")
--- 106,110 ----
try: color = SYSTEM_COLORS[colorname]
! except: raise ValueError("invalid color: %s" % colorname)
handle = user32.GetSysColorBrush(color)
if not handle: raise RuntimeError("could not create sys color brush")
|