[ros-diffs] [weiden] 29291: Add ability to change/query single monitors and change/query the current selection in the monitor arrangement control

weiden at svn.reactos.org weiden at svn.reactos.org
Sat Sep 29 08:22:44 CEST 2007


Author: weiden
Date: Sat Sep 29 10:22:44 2007
New Revision: 29291

URL: http://svn.reactos.org/svn/reactos?rev=29291&view=rev
Log:
Add ability to change/query single monitors and change/query the current selection in the monitor arrangement control

Modified:
    trunk/reactos/dll/cpl/desk/monslctl.c
    trunk/reactos/dll/cpl/desk/monslctl.h

Modified: trunk/reactos/dll/cpl/desk/monslctl.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/monslctl.c?rev=29291&r1=29290&r2=29291&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/desk/monslctl.c (original)
+++ trunk/reactos/dll/cpl/desk/monslctl.c Sat Sep 29 10:22:44 2007
@@ -39,6 +39,8 @@
     POINT ScrollPos;
     SIZE Margin;
     SIZE SelectionFrame;
+    HBITMAP hbmDisabledPattern;
+    HBRUSH hbrDisabled;
 } MONITORSELWND, *PMONITORSELWND;
 
 static HFONT
@@ -313,9 +315,9 @@
 }
 
 static BOOL
-MonSelSetMonitorInfo(IN OUT PMONITORSELWND infoPtr,
-                     IN DWORD dwMonitors,
-                     IN const MONSL_MONINFO *MonitorsInfo)
+MonSelSetMonitorsInfo(IN OUT PMONITORSELWND infoPtr,
+                      IN DWORD dwMonitors,
+                      IN const MONSL_MONINFO *MonitorsInfo)
 {
     DWORD Index;
     BOOL Ret = TRUE;
@@ -393,9 +395,9 @@
 }
 
 static DWORD
-MonSelGetMonitorInfo(IN PMONITORSELWND infoPtr,
-                     IN DWORD dwMonitors,
-                     IN OUT PMONSL_MONINFO MonitorsInfo)
+MonSelGetMonitorsInfo(IN PMONITORSELWND infoPtr,
+                      IN DWORD dwMonitors,
+                      IN OUT PMONSL_MONINFO MonitorsInfo)
 {
     if (dwMonitors != 0)
     {
@@ -412,6 +414,41 @@
 }
 
 static BOOL
+MonSelSetMonitorInfo(IN OUT PMONITORSELWND infoPtr,
+                     IN INT Index,
+                     IN const MONSL_MONINFO *MonitorsInfo)
+{
+    if (Index >= 0 && Index < (INT)infoPtr->MonitorsCount)
+    {
+        CopyMemory(&infoPtr->MonitorInfo[Index],
+                   MonitorsInfo,
+                   sizeof(MONSL_MONINFO));
+
+        MonSelUpdateMonitorsInfo(infoPtr,
+                                 TRUE);
+        return TRUE;
+    }
+
+    return FALSE;
+}
+
+static BOOL
+MonSelGetMonitorInfo(IN PMONITORSELWND infoPtr,
+                     IN INT Index,
+                     IN OUT PMONSL_MONINFO MonitorsInfo)
+{
+    if (Index >= 0 && Index < (INT)infoPtr->MonitorsCount)
+    {
+        CopyMemory(MonitorsInfo,
+                   &infoPtr->MonitorInfo[Index],
+                   sizeof(MONSL_MONINFO));
+        return TRUE;
+    }
+
+    return FALSE;
+}
+
+static BOOL
 MonSelSetCurSelMonitor(IN OUT PMONITORSELWND infoPtr,
                        IN INT Index)
 {
@@ -454,9 +491,21 @@
 MonSelDestroy(IN OUT PMONITORSELWND infoPtr)
 {
     /* Free all monitors */
-    MonSelSetMonitorInfo(infoPtr,
-                         0,
-                         NULL);
+    MonSelSetMonitorsInfo(infoPtr,
+                          0,
+                          NULL);
+
+    if (infoPtr->hbrDisabled != NULL)
+    {
+        DeleteObject(infoPtr->hbrDisabled);
+        infoPtr->hbrDisabled = NULL;
+    }
+
+    if (infoPtr->hbmDisabledPattern != NULL)
+    {
+        DeleteObject(infoPtr->hbmDisabledPattern);
+        infoPtr->hbmDisabledPattern = NULL;
+    }
 }
 
 static HFONT
@@ -508,12 +557,44 @@
     return hFont;
 }
 
+static BOOL
+MonSelDrawDisabledRect(IN OUT PMONITORSELWND infoPtr,
+                       IN HDC hDC,
+                       IN const RECT *prc)
+{
+    BOOL Ret = FALSE;
+
+    if (infoPtr->hbrDisabled == NULL)
+    {
+        static const DWORD Pattern[4] = {0x5555AAAA, 0x5555AAAA, 0x5555AAAA, 0x5555AAAA};
+
+        if (infoPtr->hbmDisabledPattern == NULL)
+        {
+            infoPtr->hbmDisabledPattern = CreateBitmap(8,
+                                                       8,
+                                                       1,
+                                                       1,
+                                                       Pattern);
+        }
+
+        if (infoPtr->hbmDisabledPattern != NULL)
+            infoPtr->hbrDisabled = CreatePatternBrush(infoPtr->hbmDisabledPattern);
+    }
+
+    if (infoPtr->hbrDisabled != NULL)
+    {
+        /* FIXME - implement */
+    }
+
+    return Ret;
+}
+
 static VOID
 MonSelPaint(IN OUT PMONITORSELWND infoPtr,
             IN HDC hDC,
-            IN LPRECT prcUpdate)
-{
-    COLORREF crPrevText;
+            IN const RECT *prcUpdate)
+{
+    COLORREF crPrevText, crPrevText2;
     HFONT hFont, hPrevFont;
     HBRUSH hbBk, hbOldBk;
     HPEN hpFg, hpOldFg;
@@ -556,8 +637,17 @@
 
             if (infoPtr->HasFocus && !(infoPtr->UIState & UISF_HIDEFOCUS))
             {
+                /* NOTE: We need to switch the text color to the default, because
+                         DrawFocusRect draws a solid line if the text is white! */
+
+                crPrevText2 = SetTextColor(hDC,
+                                           crPrevText);
+
                 DrawFocusRect(hDC,
                               &rc);
+
+                SetTextColor(hDC,
+                             crPrevText2);
             }
         }
 
@@ -591,6 +681,17 @@
 
             SelectObject(hDC,
                          hPrevFont);
+        }
+
+        if (infoPtr->MonitorInfo[Index].Flags & MSL_MIF_DISABLED)
+        {
+            InflateRect(&rc,
+                        1,
+                        1);
+
+            MonSelDrawDisabledRect(infoPtr,
+                                   hDC,
+                                   &rc);
         }
     }
 
@@ -801,19 +902,19 @@
             break;
         }
 
-        case MSLM_SETMONITORINFO:
-        {
-            Ret = MonSelSetMonitorInfo(infoPtr,
-                                       (DWORD)wParam,
-                                       (const MONSL_MONINFO *)lParam);
-            break;
-        }
-
-        case MSLM_GETMONITORINFO:
-        {
-            Ret = MonSelGetMonitorInfo(infoPtr,
-                                       (DWORD)wParam,
-                                       (PMONSL_MONINFO)lParam);
+        case MSLM_SETMONITORSINFO:
+        {
+            Ret = MonSelSetMonitorsInfo(infoPtr,
+                                        (DWORD)wParam,
+                                        (const MONSL_MONINFO *)lParam);
+            break;
+        }
+
+        case MSLM_GETMONITORSINFO:
+        {
+            Ret = MonSelGetMonitorsInfo(infoPtr,
+                                        (DWORD)wParam,
+                                        (PMONSL_MONINFO)lParam);
             break;
         }
 
@@ -827,6 +928,35 @@
         {
             Ret = MonSelHitTest(infoPtr,
                                 (const POINT *)wParam);
+            break;
+        }
+
+        case MSLM_SETCURSEL:
+        {
+            Ret = MonSelSetCurSelMonitor(infoPtr,
+                                         (INT)wParam);
+            break;
+        }
+
+        case MSLM_GETCURSEL:
+        {
+            Ret = infoPtr->SelectedMonitor;
+            break;
+        }
+
+        case MSLM_SETMONITORINFO:
+        {
+            Ret = MonSelSetMonitorInfo(infoPtr,
+                                       (INT)wParam,
+                                       (const MONSL_MONINFO *)lParam);
+            break;
+        }
+
+        case MSLM_GETMONITORINFO:
+        {
+            Ret = MonSelGetMonitorInfo(infoPtr,
+                                       (INT)wParam,
+                                       (PMONSL_MONINFO)lParam);
             break;
         }
 

Modified: trunk/reactos/dll/cpl/desk/monslctl.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/monslctl.h?rev=29291&r1=29290&r2=29291&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/desk/monslctl.h (original)
+++ trunk/reactos/dll/cpl/desk/monslctl.h Sat Sep 29 10:22:44 2007
@@ -13,7 +13,7 @@
 } MONSL_MONINFO, *PMONSL_MONINFO;
 
 /*
- * MSLM_SETMONITORINFO
+ * MSLM_SETMONITORSINFO
  *   wParam: DWORD
  *           Count of MONSL_MONINFO structures provided as lParam.
  *   lParam: PMONSL_MONINFO
@@ -21,10 +21,10 @@
  *
  *   Returns non-zero value if successful.
  */
-#define MSLM_SETMONITORINFO (WM_USER + 0x10)
+#define MSLM_SETMONITORSINFO (WM_USER + 0x10)
 
 /*
- * MSLM_GETMONITORINFO
+ * MSLM_GETMONITORSINFO
  *   wParam: DWORD
  *           Length of MONSL_MONINFO array buffer provided in lParam.
  *   lParam: PMONSL_MONINFO
@@ -32,7 +32,7 @@
  *
  *   Returns number of structures copied.
  */
-#define MSLM_GETMONITORINFO (WM_USER + 0x11)
+#define MSLM_GETMONITORSINFO (WM_USER + 0x11)
 
 /*
  * MSLM_GETMONITORINFOCOUNT
@@ -54,6 +54,47 @@
  */
 #define MSLM_HITTEST    (WM_USER + 0x13)
 
+/*
+ * MSLM_SETCURSEL
+ *   wParam: INT
+ *           Selects the monitor with this index. Pass -1 to clear the selection.
+ *   lParam: Ignored.
+ *
+ *   Returns a non-zero value if successful.
+ */
+#define MSLM_SETCURSEL  (WM_USER + 0x14)
+
+/*
+ * MSLM_GETCURSEL
+ *   wParam: Ignored.
+ *   lParam: Ignored.
+ *
+ *   Returns the index of the selected monitor, or -1 if none is currently selected.
+ */
+#define MSLM_GETCURSEL  (WM_USER + 0x15)
+
+/*
+ * MSLM_SETMONITORINFO
+ *   wParam: INT
+ *           Index of the monitor information that is queried.
+ *   lParam: PMONSL_MONINFO
+ *           Pointer to a MONSL_MONINFO structures.
+ *
+ *   Returns non-zero value if successful.
+ */
+#define MSLM_SETMONITORINFO (WM_USER + 0x16)
+
+/*
+ * MSLM_GETMONITORINFO
+ *   wParam: INT
+ *           Index of the monitor information to be changed.
+ *   lParam: PMONSL_MONINFO
+ *           Pointer to a MONSL_MONINFO structures.
+ *
+ *   Returns non-zero value if successful.
+ */
+#define MSLM_GETMONITORINFO (WM_USER + 0x17)
+
 BOOL RegisterMonitorSelectionControl(IN HINSTANCE hInstance);
 VOID UnregisterMonitorSelectionControl(IN HINSTANCE hInstance);
 




More information about the Ros-diffs mailing list