• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • workspace API Reference
  • KDE Home
  • Contact Us
 

liblancelot

  • sources
  • kde-4.14
  • workspace
  • kdeplasma-addons
  • libs
  • lancelot
  • widgets
ScrollPane.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007, 2008, 2009, 2010 Ivan Cukic <ivan.cukic(at)kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser/Library General Public License version 2,
6  * or (at your option) any later version, as published by the Free
7  * Software Foundation
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser/Library General Public License for more details
13  *
14  * You should have received a copy of the GNU Lesser/Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef LANCELOT_SCROLL_PANE_H
21 #define LANCELOT_SCROLL_PANE_H
22 
23 #include <lancelot/lancelot_export.h>
24 #include <lancelot/widgets/Panel.h>
25 
26 namespace Lancelot
27 {
28 
29 class ScrollPane;
30 
34 class LANCELOT_EXPORT Scrollable {
35 public:
39  Scrollable();
40 
44  virtual ~Scrollable();
45 
52  virtual QSizeF sizeFor(QSizeF viewportSize) const = 0;
53 
63  virtual void viewportChanged(QRectF viewport) = 0;
64 
70  virtual qreal scrollUnit(Qt::Orientation direction) const = 0;
71 
77  virtual void setScrollPane(ScrollPane * pane);
78 
82  virtual ScrollPane * scrollPane() const;
83 
84 private:
85  class Private;
86  Private * const d;
87 };
88 
94 class LANCELOT_EXPORT ScrollPane: public Lancelot::Widget {
95  Q_OBJECT
96 
97  Q_PROPERTY(QPointF scrollPosition READ scrollPosition WRITE setScrollPosition)
98  Q_PROPERTY(QSizeF contentsSize READ contentsSize)
99  Q_PROPERTY(QRectF viewportGeometry READ viewportGeometry)
100 
101  // @puck L_WIDGET
102  // @puck L_INCLUDE(lancelot/widgets/ScrollPane.h)
103 
104 public:
105  enum Flag {
106  ClipScrollable = 1,
107  HoverShowScrollbars = 2
108  };
109  Q_DECLARE_FLAGS(Flags, Flag)
110 
111 
115  ScrollPane(QGraphicsItem * parent = 0);
116 
120  virtual ~ScrollPane();
121 
127  void setScrollableWidget(Scrollable * widget);
128 
133  QSizeF maximumViewportSize() const;
134 
140  QSizeF currentViewportSize() const;
141 
145  void setFlag(Flag flag);
146 
150  void clearFlag(Flag flag);
151 
155  Flags flags() const;
156 
160  void setFlags(Flags flags);
161 
165  void setFlip(Plasma::Flip flip);
166 
171  void scrollTo(QRectF rect);
172 
176  QSizeF contentsSize() const;
177 
181  void setScrollPosition(const QPointF &position);
182 
186  QPointF scrollPosition() const;
187 
191  QRectF viewportGeometry() const;
192 
193 
194 protected:
195  L_Override void hoverEnterEvent(QGraphicsSceneHoverEvent * event);
196  L_Override void hoverLeaveEvent(QGraphicsSceneHoverEvent * event);
197  L_Override void resizeEvent(QGraphicsSceneResizeEvent * event);
198 
199 public Q_SLOTS:
204  void scrollableWidgetSizeUpdateNeeded();
205 
209  void scrollHorizontal(int value);
210 
214  void scrollVertical(int value);
215 
216 private:
217  class Private;
218  Private * const d;
219 };
220 
221 } // namespace Lancelot
222 
223 Q_DECLARE_OPERATORS_FOR_FLAGS(Lancelot::ScrollPane::Flags)
224 
225 #endif // LANCELOT_SCROLL_PANE_H
226 
Panel.h
QGraphicsItem
L_Override
#define L_Override
Definition: lancelot_export.h:41
QPointF
lancelot_export.h
Lancelot::Widget
Base class for Widgets that want to use Lancelot framework.
Definition: Widget.h:37
LANCELOT_EXPORT
#define LANCELOT_EXPORT
Definition: lancelot_export.h:32
QGraphicsSceneResizeEvent
QGraphicsSceneHoverEvent
Lancelot::ScrollPane
Pane for containing scrollable items.
Definition: ScrollPane.h:94
Lancelot::Scrollable
Interface for items that support scrolling.
Definition: ScrollPane.h:34
Lancelot::ScrollPane::Flag
Flag
Definition: ScrollPane.h:105
QSizeF
QRectF
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:43:01 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

liblancelot

Skip menu "liblancelot"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

workspace API Reference

Skip menu "workspace API Reference"
  • kdeplasma-addons
  •       GroupingDesktop
  •     liblancelot

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal