mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-11 08:48:06 +01:00
Before putting dialog into landscape mode, make sure it won't be wider
than the screen. That is, don't be fooled when in portrait mode by a screen height that's SIP-reduced.
This commit is contained in:
parent
054fd21981
commit
fde2ef1ee2
1 changed files with 26 additions and 22 deletions
|
@ -249,10 +249,11 @@ ceStackButtonsRight( CEAppGlobals* globals, HWND hDlg )
|
||||||
|
|
||||||
if ( ceIsLandscape( globals ) ) {
|
if ( ceIsLandscape( globals ) ) {
|
||||||
XP_U16 resIDs[] = { IDOK, IDCANCEL };
|
XP_U16 resIDs[] = { IDOK, IDCANCEL };
|
||||||
RECT rect;
|
RECT wrect, crect;
|
||||||
XP_U16 left, top;
|
XP_U16 left, top;
|
||||||
XP_U16 butWidth, butHeight;
|
XP_U16 butWidth, butHeight;
|
||||||
XP_U16 barHt, i, nButtons, spacing;
|
XP_U16 barHt, i, nButtons, spacing;
|
||||||
|
XP_U16 newWidth;
|
||||||
|
|
||||||
/* First, figure height and width to use */
|
/* First, figure height and width to use */
|
||||||
butHeight = 0;
|
butHeight = 0;
|
||||||
|
@ -274,34 +275,37 @@ ceStackButtonsRight( CEAppGlobals* globals, HWND hDlg )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GetWindowRect( hDlg, &rect );
|
/* Make sure we're not proposing to make the dialog wider than the
|
||||||
barHt = rect.bottom - rect.top;
|
screen */
|
||||||
|
GetClientRect( hDlg, &crect );
|
||||||
|
newWidth = crect.right - crect.left + butWidth + (HPADDING*2);
|
||||||
|
GetWindowRect( globals->hWnd, &wrect );
|
||||||
|
if ( newWidth <= wrect.right - wrect.left ) {
|
||||||
|
|
||||||
GetClientRect( hDlg, &rect );
|
GetWindowRect( hDlg, &wrect );
|
||||||
barHt -= rect.bottom;
|
barHt = wrect.bottom - wrect.top - crect.bottom;
|
||||||
|
|
||||||
spacing = rect.bottom - (nButtons * (butHeight + (VPADDING*2)));
|
spacing = crect.bottom - (nButtons * (butHeight + (VPADDING*2)));
|
||||||
spacing /= nButtons + 1;
|
spacing /= nButtons + 1;
|
||||||
|
|
||||||
top = spacing - (butHeight / 2) + VPADDING;
|
top = spacing - (butHeight / 2) + VPADDING;
|
||||||
left = rect.right + HPADDING;
|
left = crect.right + HPADDING;
|
||||||
|
|
||||||
for ( i = 0; i < sizeof(resIDs)/sizeof(resIDs[0]); ++i ) {
|
for ( i = 0; i < sizeof(resIDs)/sizeof(resIDs[0]); ++i ) {
|
||||||
HWND itemH = GetDlgItem( hDlg, resIDs[i] );
|
HWND itemH = GetDlgItem( hDlg, resIDs[i] );
|
||||||
if ( ceIsVisible( itemH ) ) {
|
if ( ceIsVisible( itemH ) ) {
|
||||||
(void)MoveWindow( itemH, left, top, butWidth, butHeight, TRUE );
|
(void)MoveWindow( itemH, left, top, butWidth, butHeight,
|
||||||
|
TRUE );
|
||||||
top += butHeight + spacing + (VPADDING * 2);
|
top += butHeight + spacing + (VPADDING * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
butWidth += HPADDING*2;
|
butWidth += HPADDING*2;
|
||||||
GetWindowRect( hDlg, &rect );
|
MoveWindow( hDlg, wrect.left - (butWidth/2), wrect.top,
|
||||||
|
newWidth, wrect.bottom - wrect.top - butHeight - 2,
|
||||||
MoveWindow( hDlg, rect.left - (butWidth/2), rect.top,
|
|
||||||
rect.right - rect.left + butWidth,
|
|
||||||
rect.bottom - rect.top - butHeight - 2,
|
|
||||||
FALSE );
|
FALSE );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} /* ceStackButtonsRight */
|
} /* ceStackButtonsRight */
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
Loading…
Add table
Reference in a new issue