/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// Using WB_AUTOHSCROLL, WB_AUTOVSCROLL here sucks big time, there is a // problem in the toolkit class where there are some clashing IDs // ( css::awt::VclWindowPeerAttribute::VSCROLL has the same value // as css::awt::WindowAttribute::NODECORATION and they are used // in the same bitmap :-( WB_VSCROLL & WB_HSCROLL apparently are only for // child classes ( whole thing is a mess if you ask me )
ScrollableDialog::ScrollableDialog( vcl::Window* pParent, WinBits nStyle, Dialog::InitFlag eFlag )
: Dialog( pParent, nStyle & ~( WB_AUTOHSCROLL | WB_AUTOVSCROLL ), eFlag ),
maHScrollBar( VclPtr<ScrollBar>::Create(this, WB_HSCROLL | WB_DRAG) ),
maVScrollBar( VclPtr<ScrollBar>::Create(this, WB_VSCROLL | WB_DRAG) ),
mbHasHoriBar( false ),
mbHasVertBar( false ),
maScrollVis( None )
{
Link<ScrollBar*,void> aLink( LINK( this, ScrollableDialog, ScrollBarHdl ) );
maVScrollBar->SetScrollHdl( aLink );
maHScrollBar->SetScrollHdl( aLink );
ScrollBarVisibility aVis = None;
if ( nStyle & ( WB_AUTOHSCROLL | WB_AUTOVSCROLL ) )
{ if ( nStyle & WB_AUTOHSCROLL )
aVis = Hori; if ( nStyle & WB_AUTOVSCROLL )
{ if ( aVis == Hori )
aVis = Both; else
aVis = Vert;
}
}
setScrollVisibility( aVis );
mnScrWidth = Dialog::GetSettings().GetStyleSettings().GetScrollBarSize();
}
void ScrollableDialog::setScrollVisibility( ScrollBarVisibility rVisState )
{
maScrollVis = rVisState; if ( maScrollVis == Hori || maScrollVis == Both )
{
mbHasHoriBar = true;
maHScrollBar->Show();
} if ( maScrollVis == Vert || maScrollVis == Both )
{
mbHasVertBar = true;
maVScrollBar->Show();
} if ( mbHasHoriBar || mbHasVertBar )
SetStyle( Dialog::GetStyle() | WB_CLIPCHILDREN );
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.