--- a/WinWorkstation.st Fri Apr 15 15:20:41 2016 +0200
+++ b/WinWorkstation.st Wed Apr 20 11:46:10 2016 +0200
@@ -11,6 +11,8 @@
"
"{ Package: 'stx:libview' }"
+"{ NameSpace: Smalltalk }"
+
DeviceWorkstation subclass:#WinWorkstation
instanceVariableNames:'blackpixel whitepixel listOfFonts rootWin rootDC buttonsPressed
eventTrace eventBuffer lastClipboardSequenceNumber'
@@ -5322,6 +5324,8 @@
"/ but are also needed to update my view colors when the settings change.
"/ I dont know what exceed is doing there ...
"/ IgnoreSysColorChanges := true.
+ IgnoreSysColorChanges := false.
+ SystemColorValues := IdentityDictionary new.
"/ translation table from ST/X windowType symbol (system-independent)
"/ to Windows windowClass (windows-specific).
@@ -6668,154 +6672,7 @@
"retrieve a windows system color.
The styleSheet/View classes may use this to setup default colors"
- |rgb|
-
-%{
- int p;
- int __rgb, __bgr, r, g, b;
-
- if (aKey == @symbol(COLOR_WINDOW)) {
- p = COLOR_WINDOW;
- } else if (aKey == @symbol(COLOR_WINDOWTEXT)) {
- p = COLOR_WINDOWTEXT;
- } else if (aKey == @symbol(COLOR_MENU)) {
- p = COLOR_MENU;
- } else if (aKey == @symbol(COLOR_MENUTEXT)) {
- p = COLOR_MENUTEXT;
- } else if (aKey == @symbol(COLOR_BTNFACE)) {
- p = COLOR_BTNFACE;
- } else if (aKey == @symbol(COLOR_BTNSHADOW)) {
- p = COLOR_BTNSHADOW;
- } else if (aKey == @symbol(COLOR_BTNTEXT)) {
- p = COLOR_BTNTEXT;
- } else if (aKey == @symbol(COLOR_GRAYTEXT)) {
- p = COLOR_GRAYTEXT;
- } else if (aKey == @symbol(COLOR_HIGHLIGHT)) {
- p = COLOR_HIGHLIGHT;
- } else if (aKey == @symbol(COLOR_HIGHLIGHTTEXT)) {
- p = COLOR_HIGHLIGHTTEXT;
- } else if (aKey == @symbol(COLOR_MENU)) {
- p = COLOR_MENU;
- } else if (aKey == @symbol(COLOR_MENUTEXT)) {
- p = COLOR_MENUTEXT;
- } else if (aKey == @symbol(COLOR_SCROLLBAR)) {
- p = COLOR_SCROLLBAR;
-#ifdef COLOR_SHADOW
- } else if (aKey == @symbol(COLOR_SHADOW)) {
- p = COLOR_SHADOW;
-#endif
-#ifdef COLOR_BACKGROUND
- } else if (aKey == @symbol(COLOR_BACKGROUND)) {
- p = COLOR_BACKGROUND;
-#endif
-#ifdef COLOR_ACTIVECAPTION
- } else if (aKey == @symbol(COLOR_ACTIVECAPTION)) {
- p = COLOR_ACTIVECAPTION;
-#endif
-#ifdef COLOR_INACTIVECAPTION
- } else if (aKey == @symbol(COLOR_INACTIVECAPTION)) {
- p = COLOR_INACTIVECAPTION;
-#endif
-#ifdef COLOR_WINDOWFRAME
- } else if (aKey == @symbol(COLOR_WINDOWFRAME)) {
- p = COLOR_WINDOWFRAME;
-#endif
-#ifdef COLOR_CAPTIONTEXT
- } else if (aKey == @symbol(COLOR_CAPTIONTEXT)) {
- p = COLOR_CAPTIONTEXT;
-#endif
-#ifdef COLOR_ACTIVEBORDER
- } else if (aKey == @symbol(COLOR_ACTIVEBORDER)) {
- p = COLOR_ACTIVEBORDER;
-#endif
-#ifdef COLOR_INACTIVEBORDER
- } else if (aKey == @symbol(COLOR_INACTIVEBORDER)) {
- p = COLOR_INACTIVEBORDER;
-#endif
-#ifdef COLOR_APPWORKSPACE
- } else if (aKey == @symbol(COLOR_APPWORKSPACE)) {
- p = COLOR_APPWORKSPACE;
-#endif
-#ifdef COLOR_INACTIVECAPTIONTEXT
- } else if (aKey == @symbol(COLOR_INACTIVECAPTIONTEXT)) {
- p = COLOR_INACTIVECAPTIONTEXT;
-#endif
-#ifdef COLOR_BTNHIGHLIGHT
- } else if (aKey == @symbol(COLOR_BTNHIGHLIGHT)) {
- p = COLOR_BTNHIGHLIGHT;
-#endif
-#ifdef COLOR_3DDKSHADOW
- } else if (aKey == @symbol(COLOR_3DDKSHADOW)) {
- p = COLOR_3DDKSHADOW;
-#endif
-#ifdef COLOR_3DLIGHT
- } else if (aKey == @symbol(COLOR_3DLIGHT)) {
- p = COLOR_3DLIGHT;
-#endif
-#ifdef COLOR_INFOTEXT
- } else if (aKey == @symbol(COLOR_INFOTEXT)) {
- p = COLOR_INFOTEXT;
-#endif
-#ifdef COLOR_INFOBK
- } else if (aKey == @symbol(COLOR_INFOBK)) {
- p = COLOR_INFOBK;
-#endif
-#ifdef COLOR_HOTLIGHT
- } else if (aKey == @symbol(COLOR_HOTLIGHT)) {
- p = COLOR_HOTLIGHT;
-#endif
-#ifdef COLOR_GRADIENTACTIVECAPTION
- } else if (aKey == @symbol(COLOR_GRADIENTACTIVECAPTION)) {
- p = COLOR_GRADIENTACTIVECAPTION;
-#endif
-#ifdef COLOR_GRADIENTINACTIVECAPTION
- } else if (aKey == @symbol(COLOR_GRADIENTINACTIVECAPTION)) {
- p = COLOR_GRADIENTINACTIVECAPTION;
-#endif
-#ifdef COLOR_DESKTOP
- } else if (aKey == @symbol(COLOR_DESKTOP)) {
- p = COLOR_DESKTOP;
-#endif
-#ifdef COLOR_3DFACE
- } else if (aKey == @symbol(COLOR_3DFACE)) {
- p = COLOR_3DFACE;
-#endif
-#ifdef COLOR_3DSHADOW
- } else if (aKey == @symbol(COLOR_3DSHADOW)) {
- p = COLOR_3DSHADOW;
-#endif
-#ifdef COLOR_3DHIGHLIGHT
- } else if (aKey == @symbol(COLOR_3DHIGHLIGHT)) {
- p = COLOR_3DHIGHLIGHT;
-#endif
-#ifdef COLOR_3DHILIGHT
- } else if (aKey == @symbol(COLOR_3DHILIGHT)) {
- p = COLOR_3DHILIGHT;
-#endif
-#ifdef COLOR_BTNHILIGHT
- } else if (aKey == @symbol(COLOR_BTNHILIGHT)) {
- p = COLOR_BTNHILIGHT;
-#endif
- } else {
- goto getOutOfHere;
- }
- __bgr = GetSysColor(p);
-
- /* win uses BGR order */
- r = __bgr & 0xFF;
- g = (__bgr >> 8) & 0xFF;
- b = (__bgr >> 16) & 0xFF;
-
- __rgb = (((r << 8) | g) << 8) | b;
- rgb = __MKSMALLINT(__rgb);
-getOutOfHere: ;
-%}.
- rgb isNil ifTrue:[ ^ nil ].
-
- ^ Color
- redByte:((rgb bitShift:-16) bitAnd:16rFF)
- greenByte:((rgb bitShift:-8) bitAnd:16rFF)
- blueByte:(rgb bitAnd:16rFF)
+ ^ SystemColorValues at:aKey ifAbsentPut:[self primGetSystemColor:aKey].
"
Display getSystemColor:#COLOR_WINDOW
@@ -7246,6 +7103,167 @@
"
!
+primGetSystemColor:aKey
+ "retrieve a windows system color.
+ The styleSheet/View classes may use this to setup default colors"
+
+ |rgb|
+
+%{
+ int p;
+ int __rgb, __bgr, r, g, b;
+
+ if (aKey == @symbol(COLOR_WINDOW)) {
+ p = COLOR_WINDOW;
+ } else if (aKey == @symbol(COLOR_WINDOWTEXT)) {
+ p = COLOR_WINDOWTEXT;
+ } else if (aKey == @symbol(COLOR_MENU)) {
+ p = COLOR_MENU;
+ } else if (aKey == @symbol(COLOR_MENUTEXT)) {
+ p = COLOR_MENUTEXT;
+ } else if (aKey == @symbol(COLOR_BTNFACE)) {
+ p = COLOR_BTNFACE;
+ } else if (aKey == @symbol(COLOR_BTNSHADOW)) {
+ p = COLOR_BTNSHADOW;
+ } else if (aKey == @symbol(COLOR_BTNTEXT)) {
+ p = COLOR_BTNTEXT;
+ } else if (aKey == @symbol(COLOR_GRAYTEXT)) {
+ p = COLOR_GRAYTEXT;
+ } else if (aKey == @symbol(COLOR_HIGHLIGHT)) {
+ p = COLOR_HIGHLIGHT;
+ } else if (aKey == @symbol(COLOR_HIGHLIGHTTEXT)) {
+ p = COLOR_HIGHLIGHTTEXT;
+ } else if (aKey == @symbol(COLOR_MENU)) {
+ p = COLOR_MENU;
+ } else if (aKey == @symbol(COLOR_MENUTEXT)) {
+ p = COLOR_MENUTEXT;
+ } else if (aKey == @symbol(COLOR_SCROLLBAR)) {
+ p = COLOR_SCROLLBAR;
+#ifdef COLOR_SHADOW
+ } else if (aKey == @symbol(COLOR_SHADOW)) {
+ p = COLOR_SHADOW;
+#endif
+#ifdef COLOR_BACKGROUND
+ } else if (aKey == @symbol(COLOR_BACKGROUND)) {
+ p = COLOR_BACKGROUND;
+#endif
+#ifdef COLOR_ACTIVECAPTION
+ } else if (aKey == @symbol(COLOR_ACTIVECAPTION)) {
+ p = COLOR_ACTIVECAPTION;
+#endif
+#ifdef COLOR_INACTIVECAPTION
+ } else if (aKey == @symbol(COLOR_INACTIVECAPTION)) {
+ p = COLOR_INACTIVECAPTION;
+#endif
+#ifdef COLOR_WINDOWFRAME
+ } else if (aKey == @symbol(COLOR_WINDOWFRAME)) {
+ p = COLOR_WINDOWFRAME;
+#endif
+#ifdef COLOR_CAPTIONTEXT
+ } else if (aKey == @symbol(COLOR_CAPTIONTEXT)) {
+ p = COLOR_CAPTIONTEXT;
+#endif
+#ifdef COLOR_ACTIVEBORDER
+ } else if (aKey == @symbol(COLOR_ACTIVEBORDER)) {
+ p = COLOR_ACTIVEBORDER;
+#endif
+#ifdef COLOR_INACTIVEBORDER
+ } else if (aKey == @symbol(COLOR_INACTIVEBORDER)) {
+ p = COLOR_INACTIVEBORDER;
+#endif
+#ifdef COLOR_APPWORKSPACE
+ } else if (aKey == @symbol(COLOR_APPWORKSPACE)) {
+ p = COLOR_APPWORKSPACE;
+#endif
+#ifdef COLOR_INACTIVECAPTIONTEXT
+ } else if (aKey == @symbol(COLOR_INACTIVECAPTIONTEXT)) {
+ p = COLOR_INACTIVECAPTIONTEXT;
+#endif
+#ifdef COLOR_BTNHIGHLIGHT
+ } else if (aKey == @symbol(COLOR_BTNHIGHLIGHT)) {
+ p = COLOR_BTNHIGHLIGHT;
+#endif
+#ifdef COLOR_3DDKSHADOW
+ } else if (aKey == @symbol(COLOR_3DDKSHADOW)) {
+ p = COLOR_3DDKSHADOW;
+#endif
+#ifdef COLOR_3DLIGHT
+ } else if (aKey == @symbol(COLOR_3DLIGHT)) {
+ p = COLOR_3DLIGHT;
+#endif
+#ifdef COLOR_INFOTEXT
+ } else if (aKey == @symbol(COLOR_INFOTEXT)) {
+ p = COLOR_INFOTEXT;
+#endif
+#ifdef COLOR_INFOBK
+ } else if (aKey == @symbol(COLOR_INFOBK)) {
+ p = COLOR_INFOBK;
+#endif
+#ifdef COLOR_HOTLIGHT
+ } else if (aKey == @symbol(COLOR_HOTLIGHT)) {
+ p = COLOR_HOTLIGHT;
+#endif
+#ifdef COLOR_GRADIENTACTIVECAPTION
+ } else if (aKey == @symbol(COLOR_GRADIENTACTIVECAPTION)) {
+ p = COLOR_GRADIENTACTIVECAPTION;
+#endif
+#ifdef COLOR_GRADIENTINACTIVECAPTION
+ } else if (aKey == @symbol(COLOR_GRADIENTINACTIVECAPTION)) {
+ p = COLOR_GRADIENTINACTIVECAPTION;
+#endif
+#ifdef COLOR_DESKTOP
+ } else if (aKey == @symbol(COLOR_DESKTOP)) {
+ p = COLOR_DESKTOP;
+#endif
+#ifdef COLOR_3DFACE
+ } else if (aKey == @symbol(COLOR_3DFACE)) {
+ p = COLOR_3DFACE;
+#endif
+#ifdef COLOR_3DSHADOW
+ } else if (aKey == @symbol(COLOR_3DSHADOW)) {
+ p = COLOR_3DSHADOW;
+#endif
+#ifdef COLOR_3DHIGHLIGHT
+ } else if (aKey == @symbol(COLOR_3DHIGHLIGHT)) {
+ p = COLOR_3DHIGHLIGHT;
+#endif
+#ifdef COLOR_3DHILIGHT
+ } else if (aKey == @symbol(COLOR_3DHILIGHT)) {
+ p = COLOR_3DHILIGHT;
+#endif
+#ifdef COLOR_BTNHILIGHT
+ } else if (aKey == @symbol(COLOR_BTNHILIGHT)) {
+ p = COLOR_BTNHILIGHT;
+#endif
+ } else {
+ goto getOutOfHere;
+ }
+ __bgr = GetSysColor(p);
+
+ /* win uses BGR order */
+ r = __bgr & 0xFF;
+ g = (__bgr >> 8) & 0xFF;
+ b = (__bgr >> 16) & 0xFF;
+
+ __rgb = (((r << 8) | g) << 8) | b;
+ rgb = __MKSMALLINT(__rgb);
+getOutOfHere: ;
+%}.
+ rgb isNil ifTrue:[ ^ nil ].
+
+ ^ Color
+ redByte:((rgb bitShift:-16) bitAnd:16rFF)
+ greenByte:((rgb bitShift:-8) bitAnd:16rFF)
+ blueByte:(rgb bitAnd:16rFF)
+
+ "
+ Display getSystemColor:#COLOR_WINDOW
+ Display getSystemColor:#COLOR_HIGHLIGHT
+ "
+
+ "Modified: / 30-10-2007 / 15:06:02 / cg"
+!
+
primViewIdFromPoint:aPoint in:windowId
"given a point in rootWindow, return the viewId of the subview of windowId
hit by this coordinate. Return nil if no view was hit.
@@ -11485,35 +11503,34 @@
|anyChange|
- IgnoreSysColorChanges ~~ true ifTrue:[
- "/ first check, if there was really a change
- "/ (when exceed is running, we get plenty of those messages ...)
-
- SystemColorValues isNil ifTrue:[
- SystemColorValues := IdentityDictionary new.
- ].
- anyChange := false.
- self supportedSystemColorKeys do:[:key |
- |oldValue newValue|
-
- oldValue := SystemColorValues at:key ifAbsent:nil.
- newValue := self getSystemColor:key.
- oldValue ~= newValue ifTrue:[
- SystemColorValues at:key put:newValue.
- anyChange := true.
- ]
- ].
- anyChange ifTrue:[
- "/ TODO: this should go through the sensor ...
- "/ ...and be handled as an event by the views thread.
- SimpleView readStyleSheetAndUpdateAllStyleCaches.
- aWindow withAllSubViewsDo:[:aView |
- aView reinitStyle
- ]
- ]
+ IgnoreSysColorChanges ifFalse:[
+ "/ first check, if there was really a change of any color that
+ "/ we are interested in
+ "/ (when exceed is running, we get plenty of those messages ...)
+
+ anyChange := false.
+ SystemColorValues copy keysAndValuesDo:[:eachKey :eachOldColor|
+ |newColor|
+
+ newColor := self primGetSystemColor:eachKey.
+ newColor ~= eachOldColor ifTrue:[
+ SystemColorValues at:eachKey put:newColor.
+ anyChange := true.
+ ].
+ ].
+ anyChange ifTrue:[
+ "/ TODO: this should go through the sensor ...
+ "/ ...and be handled as an event by the views thread.
+ SimpleView readStyleSheetAndUpdateAllStyleCaches.
+ aWindow withAllSubViewsDo:[:eachView |
+ eachView reinitStyle
+ ]
+ ]
]
- "Modified: / 08-09-2006 / 19:39:20 / cg"
+ "
+ Display systemColorChange:StandardSystemView new
+ "
!
trayAction:eventCode view:aView
@@ -18264,23 +18281,6 @@
%}
!
-raiseWindowToTopMost:aWindowId
- "bring a window to the very front - above all others (even above non-st/x windows).
- Q: is this a windows-specific thing ?"
-
-%{ /* NOCONTEXT */
-
- if (__isExternalAddress(aWindowId)) {
- HWND hWnd = _HWNDVal(aWindowId);
-
- if (hWnd) {
- CPRINTF(("raiseWindow %x\n",hWnd));
- SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
- }
- }
-%}
-!
-
raiseWindowToTop:aWindowId
"bring a window to the very front - above all others (even above non-st/x windows).
Q: is this a windows-specific thing ?"
@@ -18317,6 +18317,23 @@
%}
!
+raiseWindowToTopMost:aWindowId
+ "bring a window to the very front - above all others (even above non-st/x windows).
+ Q: is this a windows-specific thing ?"
+
+%{ /* NOCONTEXT */
+
+ if (__isExternalAddress(aWindowId)) {
+ HWND hWnd = _HWNDVal(aWindowId);
+
+ if (hWnd) {
+ CPRINTF(("raiseWindow %x\n",hWnd));
+ SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ }
+ }
+%}
+!
+
reparentWindow:windowId to:newParentWindowId
"change a windows parent (an optional interface)"
@@ -19378,11 +19395,11 @@
!WinWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.487 2014-11-19 16:06:55 sr Exp $'
+ ^ '$Header$'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.487 2014-11-19 16:06:55 sr Exp $'
+ ^ '$Header$'
! !