Krotos Modules 3
Loading...
Searching...
No Matches
ImagePopup.h
Go to the documentation of this file.
1#pragma once
2
3namespace krotos
4{
9 class ImagePopup : public juce::Component
10 {
11 public:
12 ImagePopup(const String& headerText, const int& numOfHeaderLines, const String& descriptionText,
13 Image* primaryImage, const String& buttonText,
14 Justification justification = Justification::centredLeft, float headerFontSize = 18.6f,
15 float descriptionFontSize = 15.2f);
17
18 void resized() override;
19
20 void paint(Graphics& g) override;
21
22 // Getters for child components, simple interface for any further config.
23 ImageComponent& getPrimaryImage() { return m_image; };
24
25 Label& getHeaderLabel() { return m_header; };
26 Label& getDescriptionLabel() { return m_description; };
27
28 Button& getButton() { return m_button; };
29
30 void setHeaderText(const String& text) { m_header.setText(text, sendNotification); };
31 void setDescriptionText(const String& text) { m_description.setText(text, sendNotification); };
32
33 //==============================================================================
45 {
46 headerTextColourId = 0x1004280,
48 outlineColourId = 0x1001820
49 };
50
52 {
53 virtual Font getImagePopupHeaderFont() = 0;
54 virtual Font getImagePopupDescriptionFont() = 0;
55 };
56
57 void setLayout(float imageSize, int headerMargin, Rectangle<int> headerSize, Rectangle<int> descriptionSize,
58 Rectangle<int> buttonBounds)
59 {
60 m_primaryImagePropotion = imageSize;
61 m_headerDescriptionMargin = headerMargin;
62 m_headerSize = headerSize;
63 m_descriptionMargins = descriptionSize;
64 m_buttonBounds = buttonBounds;
65 }
66
67 private:
69
72
74
75 // widths are margins from right edge, not absolute
76 Rectangle<int> m_headerSize{18, 16, 16, 38};
77 Rectangle<int> m_descriptionMargins{18, 66, 18, 45};
78
79 // Relative to bottom right corner
80 Rectangle<int> m_buttonBounds{12, 12, 72, 22};
81
82 ImageComponent m_image;
84 TextButton m_button;
85 std::unique_ptr<DrawableButton> m_closePopupButton;
86 std::unique_ptr<Drawable> m_closeBtnDrawableDefault;
87 std::unique_ptr<Drawable> m_closeBtnDrawableHover;
88 std::unique_ptr<Drawable> m_closeBtnDrawableSelected;
89
90 Justification m_justification{Justification::centredLeft};
91
92 Rectangle<int> m_imageBounds;
93
95 };
96} // namespace krotos
A component with images, a header and a description used for info popup messages.
Definition ImagePopup.h:10
void resized() override
Definition ImagePopup.cpp:68
TextButton m_button
Definition ImagePopup.h:84
std::unique_ptr< Drawable > m_closeBtnDrawableHover
Definition ImagePopup.h:87
Label m_description
Definition ImagePopup.h:83
ImageComponent & getPrimaryImage()
Definition ImagePopup.h:23
Rectangle< int > m_descriptionMargins
Definition ImagePopup.h:77
Rectangle< int > m_headerSize
Definition ImagePopup.h:76
float m_primaryImagePropotion
Definition ImagePopup.h:71
std::unique_ptr< DrawableButton > m_closePopupButton
Definition ImagePopup.h:85
Button & getButton()
Definition ImagePopup.h:28
float m_headerFontSize
Definition ImagePopup.h:68
int m_headerDescriptionMargin
Definition ImagePopup.h:73
ImageComponent m_image
Definition ImagePopup.h:82
Label & getHeaderLabel()
Definition ImagePopup.h:25
void setHeaderText(const String &text)
Definition ImagePopup.h:30
~ImagePopup()
Definition ImagePopup.cpp:64
Rectangle< int > m_imageBounds
Definition ImagePopup.h:92
ColourIds
Definition ImagePopup.h:45
@ headerTextColourId
Definition ImagePopup.h:46
@ outlineColourId
Definition ImagePopup.h:48
@ descriptionTextColourId
Definition ImagePopup.h:47
void paint(Graphics &g) override
Definition ImagePopup.cpp:66
const int m_numberOfHeaderLines
Definition ImagePopup.h:70
Justification m_justification
Definition ImagePopup.h:90
ImagePopup(const String &headerText, const int &numOfHeaderLines, const String &descriptionText, Image *primaryImage, const String &buttonText, Justification justification=Justification::centredLeft, float headerFontSize=18.6f, float descriptionFontSize=15.2f)
Definition ImagePopup.cpp:3
Label & getDescriptionLabel()
Definition ImagePopup.h:26
Krotos_LookAndFeel::LinkButtonLAF m_buttonLAF
Definition ImagePopup.h:94
Label m_header
Definition ImagePopup.h:83
std::unique_ptr< Drawable > m_closeBtnDrawableSelected
Definition ImagePopup.h:88
std::unique_ptr< Drawable > m_closeBtnDrawableDefault
Definition ImagePopup.h:86
float m_descriptionFontSize
Definition ImagePopup.h:68
Rectangle< int > m_buttonBounds
Definition ImagePopup.h:80
void setLayout(float imageSize, int headerMargin, Rectangle< int > headerSize, Rectangle< int > descriptionSize, Rectangle< int > buttonBounds)
Definition ImagePopup.h:57
void setDescriptionText(const String &text)
Definition ImagePopup.h:31
Definition AirAbsorptionFilter.cpp:2
Definition ImagePopup.h:52