summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorLucas CHOLLET <lucas.chollet@free.fr>2023-01-15 23:09:33 -0500
committerAndreas Kling <kling@serenityos.org>2023-01-16 08:28:11 +0100
commit2372b3b8f9b6ff54e2be0593b4757a55ddee15af (patch)
tree65e0e7648a01049092b781042edcccc724aa267d /Userland/Applications
parent3ed9627f4e85cd632e7e95b681e3733bed9a2046 (diff)
downloadserenity-2372b3b8f9b6ff54e2be0593b4757a55ddee15af.zip
Presenter: Add `Presentation::has_a_[next,previous]_frame()`
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/Presenter/Presentation.cpp10
-rw-r--r--Userland/Applications/Presenter/Presentation.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/Userland/Applications/Presenter/Presentation.cpp b/Userland/Applications/Presenter/Presentation.cpp
index cdd6f7321f..fa4e86e028 100644
--- a/Userland/Applications/Presenter/Presentation.cpp
+++ b/Userland/Applications/Presenter/Presentation.cpp
@@ -41,6 +41,16 @@ StringView Presentation::author() const
return "Unknown Author"sv;
}
+bool Presentation::has_a_next_frame() const
+{
+ return m_current_slide < u32(m_slides.size() > 1 ? m_slides.size() - 1 : 0);
+}
+
+bool Presentation::has_a_previous_frame() const
+{
+ return m_current_slide > 0u;
+}
+
void Presentation::next_frame()
{
m_current_frame_in_slide++;
diff --git a/Userland/Applications/Presenter/Presentation.h b/Userland/Applications/Presenter/Presentation.h
index f2e6084d0a..210c9fefd1 100644
--- a/Userland/Applications/Presenter/Presentation.h
+++ b/Userland/Applications/Presenter/Presentation.h
@@ -32,6 +32,8 @@ public:
unsigned current_slide_number() const { return m_current_slide.value(); }
unsigned current_frame_in_slide_number() const { return m_current_frame_in_slide.value(); }
+ bool has_a_next_frame() const;
+ bool has_a_previous_frame() const;
void next_frame();
void previous_frame();
void go_to_first_slide();