LibreOffice Module svtools (master) 1
scrolladaptor.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
21
23 : InterimItemWindow(pWin, "svt/ui/scrollbars.ui", "ScrollBars")
24 , m_xScrollBar(
25 m_xBuilder->weld_scrollbar(bHoriz ? OUString("horizontal") : OUString("vertical")))
26 , m_bHori(bHoriz)
27{
28 m_xScrollBar->show();
30}
31
33{
34 m_xScrollBar.reset();
36}
37
38void ScrollAdaptor::SetRange(const Range& rRange)
39{
40 m_xScrollBar->adjustment_set_lower(rRange.Min());
41 m_xScrollBar->adjustment_set_upper(rRange.Max());
42}
43
45{
46 return Range(m_xScrollBar->adjustment_get_lower(), m_xScrollBar->adjustment_get_upper());
47}
48
50{
51 m_xScrollBar->adjustment_set_lower(nNewRange);
52}
53
54tools::Long ScrollAdaptor::GetRangeMin() const { return m_xScrollBar->adjustment_get_lower(); }
55
57{
58 m_xScrollBar->adjustment_set_upper(nNewRange);
59}
60
61tools::Long ScrollAdaptor::GetRangeMax() const { return m_xScrollBar->adjustment_get_upper(); }
62
64{
65 m_xScrollBar->adjustment_set_step_increment(nNewSize);
66}
67
69{
70 return m_xScrollBar->adjustment_get_step_increment();
71}
72
74{
75 m_xScrollBar->adjustment_set_page_increment(nNewSize);
76}
77
79{
80 return m_xScrollBar->adjustment_get_page_increment();
81}
82
84{
85 m_xScrollBar->adjustment_set_page_size(nNewSize);
86}
87
89{
90 return m_xScrollBar->adjustment_get_page_size();
91}
92
94{
95 m_xScrollBar->adjustment_set_value(nThumbPos);
96}
97
98tools::Long ScrollAdaptor::GetThumbPos() const { return m_xScrollBar->adjustment_get_value(); }
99
100ScrollType ScrollAdaptor::GetScrollType() const { return m_xScrollBar->get_scroll_type(); }
101
102void ScrollAdaptor::EnableRTL(bool bEnable) { m_xScrollBar->set_direction(bEnable); }
103
105{
106 m_aLink = rLink;
107 m_xScrollBar->connect_adjustment_changed(rLink);
108}
109
111{
112 m_xScrollBar->connect_mouse_release(rLink);
113}
114
116{
117 const auto nOrig = m_xScrollBar->adjustment_get_value();
118 m_xScrollBar->adjustment_set_value(nNewPos);
120 return m_xScrollBar->adjustment_get_value() - nOrig;
121}
122
123void ScrollAdaptor::SetThickness(int nThickness) { m_xScrollBar->set_scroll_thickness(nThickness); }
124
125/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void dispose() override
virtual Size GetOptimalSize() const override
tools::Long Max() const
tools::Long Min() const
void SetScrollHdl(const Link< weld::Scrollbar &, void > &rLink)
virtual void SetRange(const Range &rRange) override
virtual void SetRangeMin(tools::Long nNewRange) override
void SetThickness(int nThickness)
virtual void EnableRTL(bool bEnable=true) override
virtual void dispose() override
Link< weld::Scrollbar &, void > m_aLink
virtual tools::Long GetThumbPos() const override
virtual Range GetRange() const override
ScrollType GetScrollType() const
virtual void SetPageSize(tools::Long nNewSize) override
virtual tools::Long GetVisibleSize() const override
virtual tools::Long DoScroll(tools::Long nNewPos) override
ScrollAdaptor(vcl::Window *pParent, bool bHori)
void SetMouseReleaseHdl(const Link< const MouseEvent &, bool > &rLink)
std::unique_ptr< weld::Scrollbar > m_xScrollBar
virtual tools::Long GetPageSize() const override
virtual void SetVisibleSize(tools::Long nNewSize) override
virtual tools::Long GetRangeMin() const override
virtual void SetRangeMax(tools::Long nNewRange) override
virtual tools::Long GetRangeMax() const override
virtual void SetLineSize(tools::Long nNewSize) override
virtual void SetThumbPos(tools::Long nThumbPos) override
virtual tools::Long GetLineSize() const override
virtual void SetSizePixel(const Size &rNewSize)
long Long
ScrollType