[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r6258 - trunk/gnue-forms/src/uidrivers/win32
From: |
btami |
Subject: |
r6258 - trunk/gnue-forms/src/uidrivers/win32 |
Date: |
Mon, 6 Sep 2004 05:45:42 -0500 (CDT) |
Author: btami
Date: 2004-09-06 05:45:42 -0500 (Mon, 06 Sep 2004)
New Revision: 6258
Modified:
trunk/gnue-forms/src/uidrivers/win32/ToolBar.py
Log:
nicer disabled icons on XP
Modified: trunk/gnue-forms/src/uidrivers/win32/ToolBar.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/win32/ToolBar.py 2004-09-06 09:36:10 UTC
(rev 6257)
+++ trunk/gnue-forms/src/uidrivers/win32/ToolBar.py 2004-09-06 10:45:42 UTC
(rev 6258)
@@ -34,6 +34,9 @@
from gnue.forms.uidrivers.win32.common import getNextId
from gnue.common.apps import GDebug, GConfig
from gnue.common import events
+
+winver = sys.getwindowsversion()
+XP = winver[0]==5 and winver[1]==1 and winver[3]==2
class ToolBar(_BaseToolBar):
@@ -52,18 +55,23 @@
style = win32con.WS_CHILD | win32con.SS_SUNKEN
Win32Window(self.driver, 0, 'STATIC', '', style, 0, 30, 9999, 2,
self.toolbar)
+
+ if XP:
+ self.himl = himl = win32gui.ImageList_Create(24, 24,
commctrl.ILC_COLOR32, 0, 3)
+ else:
+ iconpath = GConfig.getInstalledBase('form_images', 'common_images')
+ iconloc = os.path.join(iconpath, 'forms/default', 'toolbar-24x24.bmp')
+ if not os.path.isfile(iconloc):
+ print "*** WARNING: Cannot add 'toolbar-24x24.bmp' to toolbar"
+ return
+ else:
+ # commctrl.CLR_DEFAULT = 0xFF000000L produces OverflowError...
+ himl = win32gui.ImageList_LoadImage(0, iconloc, 24, 0, 0xFF000000,
win32con.IMAGE_BITMAP,
+ win32con.LR_LOADFROMFILE | win32con.LR_SHARED |
win32con.LR_CREATEDIBSECTION)
+
+ tbab = struct.pack("ii", 0, himl)
+ win32gui.SendMessage(mainToolBar.GetHwnd(), commctrl.TB_SETIMAGELIST, 0,
himl)
- iconpath = GConfig.getInstalledBase('form_images', 'common_images')
- iconloc = os.path.join(iconpath, 'forms/default', 'toolbar-24x24.bmp')
- if not os.path.isfile(iconloc):
- print "*** WARNING: Cannot add 'toolbar-24x24.bmp' to toolbar"
- else:
- # commctrl.CLR_DEFAULT = 0xFF000000L produces OverflowError...
- himl = win32gui.ImageList_LoadImage(0, iconloc, 24, 0, 0xFF000000,
win32con.IMAGE_BITMAP,
- win32con.LR_LOADFROMFILE | win32con.LR_SHARED |
win32con.LR_CREATEDIBSECTION)
- tbab = struct.pack("ii", 0, himl)
- win32gui.SendMessage(mainToolBar.GetHwnd(), commctrl.TB_SETIMAGELIST, 0,
himl)
-
self._htt = win32gui.SendMessage(mainToolBar.GetHwnd(),
commctrl.TB_GETTOOLTIPS, 0, 0)
win32gui.SendMessage(self._htt, commctrl.TTM_SETMAXTIPWIDTH , 0, 250)
@@ -80,7 +88,20 @@
# Create an event binding in windows
id = getNextId()
- event = 'request' + userAction.event
+ event = 'request' + userAction.event
+
+ if XP:
+ iconloc = userAction.getIconLocation(format="bmp", size="24x24")
+
+ # Set the action icon if available
+ if iconloc:
+ icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_SHARED
+ him = win32gui.LoadImage(0, iconloc, win32con.IMAGE_BITMAP, 24, 24,
icon_flags)
+ win32gui.ImageList_Add(self.himl, him, 0)
+ else:
+ print "** WARNING: Cannot add '%s' to toolbar; no icon" %
userAction.event
+ return
+
self.container.Connect(id, lambda l=self.driver, e=event, f=self.form:
l.dispatchEvent(events.Event(e,_form=f)))
# TBBUTTON stru (iBitmap, idCommand, fsState, fsStyle, dwData, iString)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r6258 - trunk/gnue-forms/src/uidrivers/win32,
btami <=