bWidgets
Core widget toolkit designed for Blender
bwScrollView.h
Go to the documentation of this file.
1#pragma once
2
3#include <cmath>
4
5#include "bwContainerWidget.h"
6
7namespace bWidgets {
8
9namespace bwScreenGraph {
10class WidgetNode;
11}
12class bwScrollBar;
13
15 friend class bwScrollViewHandler;
16
17 public:
19 unsigned int width = 0,
20 unsigned int height = 0);
21
22 auto getTypeIdentifier() const -> std::string_view override;
23
24 void draw(bwStyle& style) override;
25
26 auto createHandler() -> std::unique_ptr<bwScreenGraph::EventHandler> override;
27
28 auto getScrollOffsetY() const -> int;
29 auto getContentBounds(float interface_scale) const -> bwRectanglePixel;
30
31 private:
32 auto getVerticalScrollBar() const -> bwScrollBar&;
33 auto getVerticalScrollbarRect(const bwStyle& style) const -> bwRectanglePixel;
34 void drawScrollBars(bwStyle& style);
35 auto isScrollable() const -> bool;
36 void validizeScrollValues();
37
38 static auto getScrollbarWidth(float interface_scale) -> int;
39
40 constexpr static int SCROLL_BAR_SIZE = 17;
41
42 std::unique_ptr<bwScreenGraph::WidgetNode> scrollbar_node;
43
44 int vert_scroll{0};
45};
46
47} // namespace bWidgets
Definition: bwContainerWidget.h:12
const bwScreenGraph::ContainerNode & node
Definition: bwContainerWidget.h:25
Node representing a widget with children.
Definition: Node.h:167
Definition: bwScrollBar.h:7
Definition: bwScrollView.cc:118
Definition: bwScrollView.h:14
auto getScrollOffsetY() const -> int
Definition: bwScrollView.cc:92
auto getContentBounds(float interface_scale) const -> bwRectanglePixel
Definition: bwScrollView.cc:97
auto createHandler() -> std::unique_ptr< bwScreenGraph::EventHandler > override
Definition: bwScrollView.cc:150
bwScrollView(bwScreenGraph::ContainerNode &node, unsigned int width=0, unsigned int height=0)
Definition: bwScrollView.cc:19
void draw(bwStyle &style) override
Definition: bwScrollView.cc:66
auto getTypeIdentifier() const -> std::string_view override
Definition: bwScrollView.cc:30
Definition: bwStyle.h:10
Definition: bwContext.h:3