API Documentation
Loading...
Searching...
No Matches
ButtonGallery.h
Go to the documentation of this file.
1#pragma once
2#include <NDEVR/QCustomScrollArea.h>
3#include <NDEVR/RibbonSubGroup.h>
4#include <NDEVR/TouchScrollManager.h>
5#include <QVBoxLayout>
6namespace NDEVR
7{
9 {
10 public:
11 ButtonGallery(QWidget* parent = nullptr)
12 : QCustomScrollArea(parent)
13 {
14
17#ifdef ANDROID
19#else
21#endif
24
25 setWidgetResizable(true);
26 setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
27 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
28 setAlignment(Qt::AlignCenter);
29 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
30 //gallery_scroll_area->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
31 QWidget* widget = new QWidget();
32 widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
33 widget->setAutoFillBackground(true);
34 widget->setBackgroundRole(QPalette::Base);
35 QVBoxLayout* scroll_layout = new QVBoxLayout();
36 scroll_layout->addWidget(m_gallery);
37 widget->setLayout(scroll_layout);
38 setWidget(widget);
39
41 }
43 {
46 }
47 virtual void sortButtons(const std::function<bool(Button*, Button*)>& sorter)
48 {
49 m_gallery->sortButtons(sorter);
50 }
51 virtual void addButton(Button* button)
52 {
53 m_gallery->addButton(button);
54 }
55 virtual void sortButtons()
56 {
57 m_gallery->sortButtons([](Button* a, Button* b)->bool
58 {
60 });
61 }
62 virtual void removeButton(Button* button)
63 {
64 m_gallery->removeButton(button);
65 }
66 virtual void clear()
67 {
69 }
74 const Buffer<Button*>& buttons() const
75 {
76 return m_gallery->buttons();
77 }
78 protected:
80 };
81}
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition Button.h:60
const TranslatedString & title() const
Definition Button.cpp:1111
Definition QCustomScrollArea.h:9
void setWidget(QWidget *w)
Definition QCustomScrollArea.cpp:32
Definition RibbonSubGroup.h:43
void setSpacing(int spacing)
Definition RibbonSubGroup.cpp:367
virtual void sortButtons(const std::function< bool(Button *, Button *)> &sorter)
Definition RibbonSubGroup.cpp:729
void setIconSizeMultiplier(fltp04 size_multiplier)
Definition RibbonSubGroup.cpp:399
void setLayoutMode(RibbonLayoutMode layout_mode)
Definition RibbonSubGroup.h:69
void updateRibbonLayout()
Definition RibbonSubGroup.cpp:749
void setIgnoredSize(bool ignored)
Definition RibbonSubGroup.cpp:323
const Buffer< Button * > & buttons() const
Definition RibbonSubGroup.h:51
Button * addButton(Button *button, uint04 index=Constant< uint04 >::NaN, bool update_layout=false)
Definition RibbonSubGroup.cpp:66
void removeButton(Button *button)
Definition RibbonSubGroup.cpp:93
void clear()
Definition RibbonSubGroup.cpp:310
static NDEVR_BASE_API bool AlphaNumericCompare(const String &left, const String &right)
Definition String.cpp:521
static void Run(QWidget *widget)
Definition TouchScrollManager.cpp:11
NDEVR_BASE_API const String & translation() const
Definition TranslatedString.cpp:104
Definition ACIColor.h:37
float fltp04
Defines an alias representing a 4 byte floating-point number.
Definition BaseValues.hpp:157
@ e_vertical
Definition RibbonLayoutMode.hpp:38