mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 00:57:43 +00:00
LibGUI: Rename ProgressBar property caption => text and expose to GML
This commit is contained in:
parent
92afdd0c86
commit
de08e7b8c9
4 changed files with 6 additions and 5 deletions
|
@ -48,6 +48,7 @@
|
||||||
|
|
||||||
@GUI::ProgressBar {
|
@GUI::ProgressBar {
|
||||||
name: "progressbar"
|
name: "progressbar"
|
||||||
|
text: "Generating thumbnails: "
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,7 +341,6 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
|
||||||
auto& statusbar = (GUI::StatusBar&)*widget.find_descendant_by_name("statusbar");
|
auto& statusbar = (GUI::StatusBar&)*widget.find_descendant_by_name("statusbar");
|
||||||
|
|
||||||
auto& progressbar = (GUI::ProgressBar&)*widget.find_descendant_by_name("progressbar");
|
auto& progressbar = (GUI::ProgressBar&)*widget.find_descendant_by_name("progressbar");
|
||||||
progressbar.set_caption("Generating thumbnails: ");
|
|
||||||
progressbar.set_format(GUI::ProgressBar::Format::ValueSlashMax);
|
progressbar.set_format(GUI::ProgressBar::Format::ValueSlashMax);
|
||||||
progressbar.set_frame_shape(Gfx::FrameShape::Panel);
|
progressbar.set_frame_shape(Gfx::FrameShape::Panel);
|
||||||
progressbar.set_frame_shadow(Gfx::FrameShadow::Sunken);
|
progressbar.set_frame_shadow(Gfx::FrameShadow::Sunken);
|
||||||
|
|
|
@ -34,6 +34,7 @@ namespace GUI {
|
||||||
|
|
||||||
ProgressBar::ProgressBar()
|
ProgressBar::ProgressBar()
|
||||||
{
|
{
|
||||||
|
REGISTER_STRING_PROPERTY("text", text, set_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgressBar::~ProgressBar()
|
ProgressBar::~ProgressBar()
|
||||||
|
@ -70,7 +71,7 @@ void ProgressBar::paint_event(PaintEvent& event)
|
||||||
// Then we draw the progress text over the gradient.
|
// Then we draw the progress text over the gradient.
|
||||||
// We draw it twice, once offset (1, 1) for a drop shadow look.
|
// We draw it twice, once offset (1, 1) for a drop shadow look.
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append(m_caption);
|
builder.append(m_text);
|
||||||
if (m_format == Format::Percentage) {
|
if (m_format == Format::Percentage) {
|
||||||
float range_size = m_max - m_min;
|
float range_size = m_max - m_min;
|
||||||
float progress = (m_value - m_min) / range_size;
|
float progress = (m_value - m_min) / range_size;
|
||||||
|
|
|
@ -44,8 +44,8 @@ public:
|
||||||
int min() const { return m_min; }
|
int min() const { return m_min; }
|
||||||
int max() const { return m_max; }
|
int max() const { return m_max; }
|
||||||
|
|
||||||
String caption() const { return m_caption; }
|
String text() const { return m_text; }
|
||||||
void set_caption(const StringView& caption) { m_caption = caption; }
|
void set_text(String text) { m_text = move(text); }
|
||||||
|
|
||||||
enum Format {
|
enum Format {
|
||||||
NoText,
|
NoText,
|
||||||
|
@ -65,7 +65,7 @@ private:
|
||||||
int m_min { 0 };
|
int m_min { 0 };
|
||||||
int m_max { 100 };
|
int m_max { 100 };
|
||||||
int m_value { 0 };
|
int m_value { 0 };
|
||||||
String m_caption;
|
String m_text;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue