2012-09-03 09:03:03 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-10-02 08:13:40 -05:00
|
|
|
/*
|
|
|
|
* 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 .
|
|
|
|
*/
|
|
|
|
|
2013-10-23 12:15:52 -05:00
|
|
|
#ifndef INCLUDED_TOOLKIT_AWT_SCROLLABLEDIALOG_HXX
|
|
|
|
#define INCLUDED_TOOLKIT_AWT_SCROLLABLEDIALOG_HXX
|
2012-09-03 09:03:03 -05:00
|
|
|
|
|
|
|
#include <vcl/dialog.hxx>
|
|
|
|
#include <vcl/scrbar.hxx>
|
|
|
|
|
|
|
|
//........................................................................
|
|
|
|
namespace toolkit
|
|
|
|
{
|
2012-09-06 13:25:12 -05:00
|
|
|
class ScrollableInterface
|
|
|
|
{
|
|
|
|
public:
|
2012-09-11 10:19:26 -05:00
|
|
|
virtual ~ScrollableInterface() {}
|
2012-09-06 13:25:12 -05:00
|
|
|
virtual void SetScrollWidth( long nWidth ) = 0;
|
|
|
|
virtual long GetScrollWidth() = 0;
|
|
|
|
virtual void SetScrollHeight( long nHeight ) = 0;
|
|
|
|
virtual long GetScrollHeight() = 0;
|
|
|
|
virtual void SetScrollLeft( long nLeft ) = 0;
|
|
|
|
virtual long GetScrollLeft() = 0;
|
|
|
|
virtual void SetScrollTop( long Top ) = 0;
|
|
|
|
virtual long GetScrollTop() = 0;
|
|
|
|
};
|
|
|
|
|
2012-09-06 12:36:00 -05:00
|
|
|
template < class T >
|
2012-09-06 13:25:12 -05:00
|
|
|
class ScrollableWrapper : public T, public ScrollableInterface
|
2012-09-03 09:03:03 -05:00
|
|
|
{
|
|
|
|
ScrollBar maHScrollBar;
|
|
|
|
ScrollBar maVScrollBar;
|
2012-09-04 14:12:45 -05:00
|
|
|
Size maScrollArea;
|
2012-09-03 09:03:03 -05:00
|
|
|
bool mbHasHoriBar;
|
|
|
|
bool mbHasVertBar;
|
|
|
|
Point mnScrollPos;
|
2012-09-04 14:12:45 -05:00
|
|
|
long mnScrWidth;
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum ScrollBarVisibility { None, Vert, Hori, Both };
|
|
|
|
private:
|
|
|
|
ScrollBarVisibility maScrollVis;
|
|
|
|
void lcl_Scroll( long nX, long nY );
|
2012-09-03 09:03:03 -05:00
|
|
|
public:
|
2012-09-06 13:25:12 -05:00
|
|
|
ScrollableWrapper( Window* pParent, WinBits nStyle = WB_STDDIALOG );
|
|
|
|
virtual ~ScrollableWrapper();
|
|
|
|
virtual void SetScrollWidth( long nWidth );
|
|
|
|
virtual long GetScrollWidth() { return maScrollArea.Width(); }
|
|
|
|
virtual void SetScrollHeight( long nHeight );
|
|
|
|
virtual long GetScrollHeight() { return maScrollArea.Height(); }
|
|
|
|
virtual void SetScrollLeft( long nLeft );
|
|
|
|
virtual long GetScrollLeft() { return mnScrollPos.X(); }
|
|
|
|
virtual void SetScrollTop( long Top );
|
|
|
|
virtual long GetScrollTop() { return mnScrollPos.Y() ; }
|
|
|
|
|
2012-09-04 14:12:45 -05:00
|
|
|
void setScrollVisibility( ScrollBarVisibility rState );
|
2012-09-03 09:03:03 -05:00
|
|
|
DECL_LINK( ScrollBarHdl, ScrollBar* );
|
2012-09-05 13:49:10 -05:00
|
|
|
virtual void ResetScrollBars();
|
2012-09-03 09:03:03 -05:00
|
|
|
// Window
|
|
|
|
virtual void Resize();
|
|
|
|
};
|
|
|
|
//........................................................................
|
|
|
|
} // namespacetoolkit
|
|
|
|
//........................................................................
|
|
|
|
|
2013-10-23 12:15:52 -05:00
|
|
|
#endif // INCLUDED_TOOLKIT_AWT_SCROLLABLEDIALOG_HXX
|
2012-09-03 09:03:03 -05:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|