mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 20:50:29 +00:00
Allow altering the monitor arrangement control behavior flags
svn path=/trunk/; revision=29298
This commit is contained in:
parent
bfdb1965c9
commit
69f3c70b62
2 changed files with 88 additions and 16 deletions
|
@ -21,15 +21,15 @@ typedef struct _MONITORSELWND
|
||||||
DWORD UIState;
|
DWORD UIState;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
DWORD dwFlags;
|
DWORD dwInternalFlags;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
UINT Enabled : 1;
|
UINT Enabled : 1;
|
||||||
UINT HasFocus : 1;
|
UINT HasFocus : 1;
|
||||||
UINT CanDisplay : 1;
|
UINT CanDisplay : 1;
|
||||||
UINT AllowSelectNone : 1;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
DWORD ControlExStyle;
|
||||||
DWORD MonitorsCount;
|
DWORD MonitorsCount;
|
||||||
INT SelectedMonitor;
|
INT SelectedMonitor;
|
||||||
PMONSL_MONINFO MonitorInfo;
|
PMONSL_MONINFO MonitorInfo;
|
||||||
|
@ -363,7 +363,7 @@ MonSelSetMonitorsInfo(IN OUT PMONITORSELWND infoPtr,
|
||||||
if (infoPtr->SelectedMonitor >= (INT)infoPtr->MonitorsCount)
|
if (infoPtr->SelectedMonitor >= (INT)infoPtr->MonitorsCount)
|
||||||
infoPtr->SelectedMonitor = -1;
|
infoPtr->SelectedMonitor = -1;
|
||||||
|
|
||||||
if (!infoPtr->AllowSelectNone && infoPtr->SelectedMonitor < 0)
|
if (!(infoPtr->ControlExStyle & MSLM_EX_ALLOWSELECTNONE) && infoPtr->SelectedMonitor < 0)
|
||||||
infoPtr->SelectedMonitor = 0;
|
infoPtr->SelectedMonitor = 0;
|
||||||
|
|
||||||
MonSelUpdateMonitorsInfo(infoPtr,
|
MonSelUpdateMonitorsInfo(infoPtr,
|
||||||
|
@ -453,11 +453,20 @@ MonSelSetCurSelMonitor(IN OUT PMONITORSELWND infoPtr,
|
||||||
IN INT Index)
|
IN INT Index)
|
||||||
{
|
{
|
||||||
INT PrevSel;
|
INT PrevSel;
|
||||||
|
BOOL PreventSelect = FALSE;
|
||||||
BOOL Ret = FALSE;
|
BOOL Ret = FALSE;
|
||||||
|
|
||||||
if (Index == -1 || Index < (INT)infoPtr->MonitorsCount)
|
if (Index == -1 || Index < (INT)infoPtr->MonitorsCount)
|
||||||
{
|
{
|
||||||
if (Index != infoPtr->SelectedMonitor)
|
if (Index != infoPtr->SelectedMonitor)
|
||||||
|
{
|
||||||
|
if ((infoPtr->MonitorInfo[Index].Flags & MSL_MIF_DISABLED) &&
|
||||||
|
!(infoPtr->ControlExStyle & MSLM_EX_ALLOWSELECTDISABLED))
|
||||||
|
{
|
||||||
|
PreventSelect = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!PreventSelect)
|
||||||
{
|
{
|
||||||
PrevSel = infoPtr->SelectedMonitor;
|
PrevSel = infoPtr->SelectedMonitor;
|
||||||
infoPtr->SelectedMonitor = Index;
|
infoPtr->SelectedMonitor = Index;
|
||||||
|
@ -471,6 +480,7 @@ MonSelSetCurSelMonitor(IN OUT PMONITORSELWND infoPtr,
|
||||||
if (infoPtr->SelectedMonitor >= 0)
|
if (infoPtr->SelectedMonitor >= 0)
|
||||||
MonSelRepaintSelected(infoPtr);
|
MonSelRepaintSelected(infoPtr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ret = TRUE;
|
Ret = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -508,6 +518,29 @@ MonSelDestroy(IN OUT PMONITORSELWND infoPtr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static HFONT
|
||||||
MonSelGetMonitorFont(IN OUT PMONITORSELWND infoPtr,
|
MonSelGetMonitorFont(IN OUT PMONITORSELWND infoPtr,
|
||||||
IN HDC hDC,
|
IN HDC hDC,
|
||||||
|
@ -777,7 +810,7 @@ MonitorSelWndProc(IN HWND hwnd,
|
||||||
|
|
||||||
Index = MonSelHitTest(infoPtr,
|
Index = MonSelHitTest(infoPtr,
|
||||||
&pt);
|
&pt);
|
||||||
if (Index >= 0 || infoPtr->AllowSelectNone)
|
if (Index >= 0 || (infoPtr->ControlExStyle & MSLM_EX_ALLOWSELECTNONE))
|
||||||
{
|
{
|
||||||
MonSelSetCurSelMonitor(infoPtr,
|
MonSelSetCurSelMonitor(infoPtr,
|
||||||
Index);
|
Index);
|
||||||
|
@ -883,7 +916,7 @@ MonitorSelWndProc(IN HWND hwnd,
|
||||||
case WM_ENABLE:
|
case WM_ENABLE:
|
||||||
{
|
{
|
||||||
infoPtr->Enabled = ((BOOL)wParam != FALSE);
|
infoPtr->Enabled = ((BOOL)wParam != FALSE);
|
||||||
/* FIXME */
|
MonSelRepaint(infoPtr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -895,9 +928,7 @@ MonitorSelWndProc(IN HWND hwnd,
|
||||||
infoPtr->Enabled = !(((LPSTYLESTRUCT)lParam)->styleNew & WS_DISABLED);
|
infoPtr->Enabled = !(((LPSTYLESTRUCT)lParam)->styleNew & WS_DISABLED);
|
||||||
|
|
||||||
if (OldEnabled != infoPtr->Enabled)
|
if (OldEnabled != infoPtr->Enabled)
|
||||||
{
|
MonSelRepaint(infoPtr);
|
||||||
/* FIXME */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -960,6 +991,19 @@ MonitorSelWndProc(IN HWND hwnd,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case MSLM_SETEXSTYLE:
|
||||||
|
{
|
||||||
|
Ret = MonSelSetExtendedStyle(infoPtr,
|
||||||
|
(DWORD)lParam);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case MSLM_GETEXSTYLE:
|
||||||
|
{
|
||||||
|
Ret = MonSelGetExtendedStyle(infoPtr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
{
|
{
|
||||||
infoPtr = (PMONITORSELWND) HeapAlloc(GetProcessHeap(),
|
infoPtr = (PMONITORSELWND) HeapAlloc(GetProcessHeap(),
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#ifndef __MONSLCTL__H
|
#ifndef __MONSLCTL__H
|
||||||
#define __MONSLCTL__H
|
#define __MONSLCTL__H
|
||||||
|
|
||||||
|
/* Control extended styles */
|
||||||
|
#define MSLM_EX_ALLOWSELECTNONE 0x1
|
||||||
|
#define MSLM_EX_ALLOWSELECTDISABLED 0x2
|
||||||
|
|
||||||
/* MONSL_MONINFO Flags */
|
/* MONSL_MONINFO Flags */
|
||||||
#define MSL_MIF_DISABLED 0x1
|
#define MSL_MIF_DISABLED 0x1
|
||||||
|
|
||||||
|
@ -95,6 +99,30 @@ typedef struct _MONSL_MONINFO
|
||||||
*/
|
*/
|
||||||
#define MSLM_GETMONITORINFO (WM_USER + 0x17)
|
#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);
|
BOOL RegisterMonitorSelectionControl(IN HINSTANCE hInstance);
|
||||||
VOID UnregisterMonitorSelectionControl(IN HINSTANCE hInstance);
|
VOID UnregisterMonitorSelectionControl(IN HINSTANCE hInstance);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue