richedit: Suppress scrollbar if missing WS_[VH]SCROLL style.
Dylan Smith
dylan.ah.smith at gmail.com
Wed Jan 28 00:35:02 CST 2009
If the scrollbar style isn't initially used, then the scrollbar should
be shown. Otherwise this can be a problem when the horizontal scrollbar
is shown for a single line richedit control, since it will cover all the
text (See bug 12088).
---
dlls/riched20/paint.c | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
-------------- next part --------------
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index 3de26e1..afb8608 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -1068,14 +1068,16 @@ void ME_ScrollAbs(ME_TextEditor *editor, int x, int y)
{
LONG winStyle = GetWindowLongW(editor->hWnd, GWL_STYLE);
bScrollBarIsVisible = (winStyle & WS_HSCROLL) != 0;
- bScrollBarWillBeVisible = (editor->nTotalWidth > editor->sizeWindow.cx)
+ bScrollBarWillBeVisible = (editor->nTotalWidth > editor->sizeWindow.cx
+ && (editor->styleFlags & WS_HSCROLL))
|| (editor->styleFlags & ES_DISABLENOSCROLL);
if (bScrollBarIsVisible != bScrollBarWillBeVisible)
ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ,
bScrollBarWillBeVisible);
bScrollBarIsVisible = (winStyle & WS_VSCROLL) != 0;
- bScrollBarWillBeVisible = (editor->nTotalLength > editor->sizeWindow.cy)
+ bScrollBarWillBeVisible = (editor->nTotalLength > editor->sizeWindow.cy
+ && (editor->styleFlags & WS_VSCROLL))
|| (editor->styleFlags & ES_DISABLENOSCROLL);
if (bScrollBarIsVisible != bScrollBarWillBeVisible)
ITextHost_TxShowScrollBar(editor->texthost, SB_VERT,
@@ -1164,8 +1166,14 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
}
}
- if (si.fMask & SIF_DISABLENOSCROLL)
+ if (si.fMask & SIF_DISABLENOSCROLL) {
bScrollBarWillBeVisible = TRUE;
+ } else if (!(editor->styleFlags & WS_HSCROLL)) {
+ /* SetScrollInfo or SetScrollRange may cause the scrollbar to be
+ * shown, so hide the scrollbar if necessary. */
+ bScrollBarWasVisible = bScrollBarWillBeVisible;
+ bScrollBarWillBeVisible = FALSE;
+ }
if (bScrollBarWasVisible != bScrollBarWillBeVisible)
ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ, bScrollBarWillBeVisible);
@@ -1204,8 +1212,14 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
}
}
- if (si.fMask & SIF_DISABLENOSCROLL)
+ if (si.fMask & SIF_DISABLENOSCROLL) {
bScrollBarWillBeVisible = TRUE;
+ } else if (!(editor->styleFlags & WS_VSCROLL)) {
+ /* SetScrollInfo or SetScrollRange may cause the scrollbar to be
+ * shown, so hide the scrollbar if necessary. */
+ bScrollBarWasVisible = bScrollBarWillBeVisible;
+ bScrollBarWillBeVisible = FALSE;
+ }
if (bScrollBarWasVisible != bScrollBarWillBeVisible)
ITextHost_TxShowScrollBar(editor->texthost, SB_VERT,
More information about the wine-patches
mailing list