Author: weiden Date: Sat Sep 29 22:04:40 2007 New Revision: 29298
URL: http://svn.reactos.org/svn/reactos?rev=29298&view=rev Log: Allow altering the monitor arrangement control behavior flags
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... ============================================================================== --- trunk/reactos/dll/cpl/desk/monslctl.c (original) +++ trunk/reactos/dll/cpl/desk/monslctl.c Sat Sep 29 22:04:40 2007 @@ -21,15 +21,15 @@ DWORD UIState; union { - DWORD dwFlags; + DWORD dwInternalFlags; struct { UINT Enabled : 1; UINT HasFocus : 1; UINT CanDisplay : 1; - UINT AllowSelectNone : 1; }; }; + DWORD ControlExStyle; DWORD MonitorsCount; INT SelectedMonitor; PMONSL_MONINFO MonitorInfo; @@ -363,7 +363,7 @@ if (infoPtr->SelectedMonitor >= (INT)infoPtr->MonitorsCount) infoPtr->SelectedMonitor = -1;
- if (!infoPtr->AllowSelectNone && infoPtr->SelectedMonitor < 0) + if (!(infoPtr->ControlExStyle & MSLM_EX_ALLOWSELECTNONE) && infoPtr->SelectedMonitor < 0) infoPtr->SelectedMonitor = 0;
MonSelUpdateMonitorsInfo(infoPtr, @@ -453,23 +453,33 @@ IN INT Index) { INT PrevSel; + BOOL PreventSelect = FALSE; BOOL Ret = FALSE;
if (Index == -1 || Index < (INT)infoPtr->MonitorsCount) { if (Index != infoPtr->SelectedMonitor) { - PrevSel = infoPtr->SelectedMonitor; - infoPtr->SelectedMonitor = Index; - - if (PrevSel >= 0) - { - MonSelRepaintMonitor(infoPtr, - PrevSel); - } - - if (infoPtr->SelectedMonitor >= 0) - MonSelRepaintSelected(infoPtr); + if ((infoPtr->MonitorInfo[Index].Flags & MSL_MIF_DISABLED) && + !(infoPtr->ControlExStyle & MSLM_EX_ALLOWSELECTDISABLED)) + { + PreventSelect = TRUE; + } + + if (!PreventSelect) + { + PrevSel = infoPtr->SelectedMonitor; + infoPtr->SelectedMonitor = Index; + + if (PrevSel >= 0) + { + MonSelRepaintMonitor(infoPtr, + PrevSel); + } + + if (infoPtr->SelectedMonitor >= 0) + MonSelRepaintSelected(infoPtr); + } }
Ret = TRUE; @@ -506,6 +516,29 @@ DeleteObject(infoPtr->hbmDisabledPattern); infoPtr->hbmDisabledPattern = NULL; } +} + +static BOOL +MonSelSetExtendedStyle(IN OUT PMONITORSELWND infoPtr, + IN DWORD dwExtendedStyle) +{ + if (dwExtendedStyle != infoPtr->ControlExStyle) + { + infoPtr->ControlExStyle = dwExtendedStyle; + + /* Repaint the control */ + InvalidateRect(infoPtr->hSelf, + NULL, + TRUE); + } + + return TRUE; +} + +static DWORD +MonSelGetExtendedStyle(IN PMONITORSELWND infoPtr) +{ + return infoPtr->ControlExStyle; }
static HFONT @@ -777,7 +810,7 @@
Index = MonSelHitTest(infoPtr, &pt); - if (Index >= 0 || infoPtr->AllowSelectNone) + if (Index >= 0 || (infoPtr->ControlExStyle & MSLM_EX_ALLOWSELECTNONE)) { MonSelSetCurSelMonitor(infoPtr, Index); @@ -883,7 +916,7 @@ case WM_ENABLE: { infoPtr->Enabled = ((BOOL)wParam != FALSE); - /* FIXME */ + MonSelRepaint(infoPtr); break; }
@@ -895,9 +928,7 @@ infoPtr->Enabled = !(((LPSTYLESTRUCT)lParam)->styleNew & WS_DISABLED);
if (OldEnabled != infoPtr->Enabled) - { - /* FIXME */ - } + MonSelRepaint(infoPtr); } break; } @@ -957,6 +988,19 @@ Ret = MonSelGetMonitorInfo(infoPtr, (INT)wParam, (PMONSL_MONINFO)lParam); + break; + } + + case MSLM_SETEXSTYLE: + { + Ret = MonSelSetExtendedStyle(infoPtr, + (DWORD)lParam); + break; + } + + case MSLM_GETEXSTYLE: + { + Ret = MonSelGetExtendedStyle(infoPtr); break; }
Modified: trunk/reactos/dll/cpl/desk/monslctl.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/monslctl.h?rev... ============================================================================== --- trunk/reactos/dll/cpl/desk/monslctl.h (original) +++ trunk/reactos/dll/cpl/desk/monslctl.h Sat Sep 29 22:04:40 2007 @@ -1,5 +1,9 @@ #ifndef __MONSLCTL__H #define __MONSLCTL__H + +/* Control extended styles */ +#define MSLM_EX_ALLOWSELECTNONE 0x1 +#define MSLM_EX_ALLOWSELECTDISABLED 0x2
/* MONSL_MONINFO Flags */ #define MSL_MIF_DISABLED 0x1 @@ -95,6 +99,30 @@ */ #define MSLM_GETMONITORINFO (WM_USER + 0x17)
+/* + * MSLM_SETEXSTYLE + * wParam: Ignored. + * lParam: DWORD + * Can be a combination of the following flags: + * * MSLM_EX_ALLOWSELECTNONE + * Allow deselecting a monitor by clicking into + * unused areas of the control. + * * MSLM_EX_ALLOWSELECTDISABLED + * Allow selecting disabled monitors + * + * Returns non-zero value if successful. + */ +#define MSLM_SETEXSTYLE (WM_USER + 0x18) + +/* + * MSLM_GETEXSTYLE + * wParam: Ignored. + * lParam: Ignored + * + * Returns the control's extended style flags. + */ +#define MSLM_GETEXSTYLE (WM_USER + 0x19) + BOOL RegisterMonitorSelectionControl(IN HINSTANCE hInstance); VOID UnregisterMonitorSelectionControl(IN HINSTANCE hInstance);