mirror of
https://github.com/reactos/reactos.git
synced 2024-08-01 09:01:13 +00:00
Add ability to change/query single monitors and change/query the current selection in the monitor arrangement control
svn path=/trunk/; revision=29291
This commit is contained in:
parent
dd55de2665
commit
a3e70b2317
|
@ -39,6 +39,8 @@ typedef struct _MONITORSELWND
|
||||||
POINT ScrollPos;
|
POINT ScrollPos;
|
||||||
SIZE Margin;
|
SIZE Margin;
|
||||||
SIZE SelectionFrame;
|
SIZE SelectionFrame;
|
||||||
|
HBITMAP hbmDisabledPattern;
|
||||||
|
HBRUSH hbrDisabled;
|
||||||
} MONITORSELWND, *PMONITORSELWND;
|
} MONITORSELWND, *PMONITORSELWND;
|
||||||
|
|
||||||
static HFONT
|
static HFONT
|
||||||
|
@ -313,7 +315,7 @@ MonSelUpdateMonitorsInfo(IN OUT PMONITORSELWND infoPtr,
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
MonSelSetMonitorInfo(IN OUT PMONITORSELWND infoPtr,
|
MonSelSetMonitorsInfo(IN OUT PMONITORSELWND infoPtr,
|
||||||
IN DWORD dwMonitors,
|
IN DWORD dwMonitors,
|
||||||
IN const MONSL_MONINFO *MonitorsInfo)
|
IN const MONSL_MONINFO *MonitorsInfo)
|
||||||
{
|
{
|
||||||
|
@ -393,7 +395,7 @@ MonSelSetMonitorInfo(IN OUT PMONITORSELWND infoPtr,
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD
|
static DWORD
|
||||||
MonSelGetMonitorInfo(IN PMONITORSELWND infoPtr,
|
MonSelGetMonitorsInfo(IN PMONITORSELWND infoPtr,
|
||||||
IN DWORD dwMonitors,
|
IN DWORD dwMonitors,
|
||||||
IN OUT PMONSL_MONINFO MonitorsInfo)
|
IN OUT PMONSL_MONINFO MonitorsInfo)
|
||||||
{
|
{
|
||||||
|
@ -411,6 +413,41 @@ MonSelGetMonitorInfo(IN PMONITORSELWND infoPtr,
|
||||||
return infoPtr->MonitorsCount;
|
return infoPtr->MonitorsCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static BOOL
|
||||||
MonSelSetCurSelMonitor(IN OUT PMONITORSELWND infoPtr,
|
MonSelSetCurSelMonitor(IN OUT PMONITORSELWND infoPtr,
|
||||||
IN INT Index)
|
IN INT Index)
|
||||||
|
@ -454,9 +491,21 @@ static VOID
|
||||||
MonSelDestroy(IN OUT PMONITORSELWND infoPtr)
|
MonSelDestroy(IN OUT PMONITORSELWND infoPtr)
|
||||||
{
|
{
|
||||||
/* Free all monitors */
|
/* Free all monitors */
|
||||||
MonSelSetMonitorInfo(infoPtr,
|
MonSelSetMonitorsInfo(infoPtr,
|
||||||
0,
|
0,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
if (infoPtr->hbrDisabled != NULL)
|
||||||
|
{
|
||||||
|
DeleteObject(infoPtr->hbrDisabled);
|
||||||
|
infoPtr->hbrDisabled = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (infoPtr->hbmDisabledPattern != NULL)
|
||||||
|
{
|
||||||
|
DeleteObject(infoPtr->hbmDisabledPattern);
|
||||||
|
infoPtr->hbmDisabledPattern = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static HFONT
|
static HFONT
|
||||||
|
@ -508,12 +557,44 @@ MonSelGetMonitorFont(IN OUT PMONITORSELWND infoPtr,
|
||||||
return hFont;
|
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
|
static VOID
|
||||||
MonSelPaint(IN OUT PMONITORSELWND infoPtr,
|
MonSelPaint(IN OUT PMONITORSELWND infoPtr,
|
||||||
IN HDC hDC,
|
IN HDC hDC,
|
||||||
IN LPRECT prcUpdate)
|
IN const RECT *prcUpdate)
|
||||||
{
|
{
|
||||||
COLORREF crPrevText;
|
COLORREF crPrevText, crPrevText2;
|
||||||
HFONT hFont, hPrevFont;
|
HFONT hFont, hPrevFont;
|
||||||
HBRUSH hbBk, hbOldBk;
|
HBRUSH hbBk, hbOldBk;
|
||||||
HPEN hpFg, hpOldFg;
|
HPEN hpFg, hpOldFg;
|
||||||
|
@ -556,8 +637,17 @@ MonSelPaint(IN OUT PMONITORSELWND infoPtr,
|
||||||
|
|
||||||
if (infoPtr->HasFocus && !(infoPtr->UIState & UISF_HIDEFOCUS))
|
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,
|
DrawFocusRect(hDC,
|
||||||
&rc);
|
&rc);
|
||||||
|
|
||||||
|
SetTextColor(hDC,
|
||||||
|
crPrevText2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -592,6 +682,17 @@ MonSelPaint(IN OUT PMONITORSELWND infoPtr,
|
||||||
SelectObject(hDC,
|
SelectObject(hDC,
|
||||||
hPrevFont);
|
hPrevFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (infoPtr->MonitorInfo[Index].Flags & MSL_MIF_DISABLED)
|
||||||
|
{
|
||||||
|
InflateRect(&rc,
|
||||||
|
1,
|
||||||
|
1);
|
||||||
|
|
||||||
|
MonSelDrawDisabledRect(infoPtr,
|
||||||
|
hDC,
|
||||||
|
&rc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetTextColor(hDC,
|
SetTextColor(hDC,
|
||||||
|
@ -801,17 +902,17 @@ MonitorSelWndProc(IN HWND hwnd,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MSLM_SETMONITORINFO:
|
case MSLM_SETMONITORSINFO:
|
||||||
{
|
{
|
||||||
Ret = MonSelSetMonitorInfo(infoPtr,
|
Ret = MonSelSetMonitorsInfo(infoPtr,
|
||||||
(DWORD)wParam,
|
(DWORD)wParam,
|
||||||
(const MONSL_MONINFO *)lParam);
|
(const MONSL_MONINFO *)lParam);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MSLM_GETMONITORINFO:
|
case MSLM_GETMONITORSINFO:
|
||||||
{
|
{
|
||||||
Ret = MonSelGetMonitorInfo(infoPtr,
|
Ret = MonSelGetMonitorsInfo(infoPtr,
|
||||||
(DWORD)wParam,
|
(DWORD)wParam,
|
||||||
(PMONSL_MONINFO)lParam);
|
(PMONSL_MONINFO)lParam);
|
||||||
break;
|
break;
|
||||||
|
@ -830,6 +931,35 @@ MonitorSelWndProc(IN HWND hwnd,
|
||||||
break;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
{
|
{
|
||||||
infoPtr = (PMONITORSELWND) HeapAlloc(GetProcessHeap(),
|
infoPtr = (PMONITORSELWND) HeapAlloc(GetProcessHeap(),
|
||||||
|
|
|
@ -13,7 +13,7 @@ typedef struct _MONSL_MONINFO
|
||||||
} MONSL_MONINFO, *PMONSL_MONINFO;
|
} MONSL_MONINFO, *PMONSL_MONINFO;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MSLM_SETMONITORINFO
|
* MSLM_SETMONITORSINFO
|
||||||
* wParam: DWORD
|
* wParam: DWORD
|
||||||
* Count of MONSL_MONINFO structures provided as lParam.
|
* Count of MONSL_MONINFO structures provided as lParam.
|
||||||
* lParam: PMONSL_MONINFO
|
* lParam: PMONSL_MONINFO
|
||||||
|
@ -21,10 +21,10 @@ typedef struct _MONSL_MONINFO
|
||||||
*
|
*
|
||||||
* Returns non-zero value if successful.
|
* Returns non-zero value if successful.
|
||||||
*/
|
*/
|
||||||
#define MSLM_SETMONITORINFO (WM_USER + 0x10)
|
#define MSLM_SETMONITORSINFO (WM_USER + 0x10)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MSLM_GETMONITORINFO
|
* MSLM_GETMONITORSINFO
|
||||||
* wParam: DWORD
|
* wParam: DWORD
|
||||||
* Length of MONSL_MONINFO array buffer provided in lParam.
|
* Length of MONSL_MONINFO array buffer provided in lParam.
|
||||||
* lParam: PMONSL_MONINFO
|
* lParam: PMONSL_MONINFO
|
||||||
|
@ -32,7 +32,7 @@ typedef struct _MONSL_MONINFO
|
||||||
*
|
*
|
||||||
* Returns number of structures copied.
|
* Returns number of structures copied.
|
||||||
*/
|
*/
|
||||||
#define MSLM_GETMONITORINFO (WM_USER + 0x11)
|
#define MSLM_GETMONITORSINFO (WM_USER + 0x11)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MSLM_GETMONITORINFOCOUNT
|
* MSLM_GETMONITORINFOCOUNT
|
||||||
|
@ -54,6 +54,47 @@ typedef struct _MONSL_MONINFO
|
||||||
*/
|
*/
|
||||||
#define MSLM_HITTEST (WM_USER + 0x13)
|
#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);
|
BOOL RegisterMonitorSelectionControl(IN HINSTANCE hInstance);
|
||||||
VOID UnregisterMonitorSelectionControl(IN HINSTANCE hInstance);
|
VOID UnregisterMonitorSelectionControl(IN HINSTANCE hInstance);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue