Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SDFileSystem app epson mbed msp430 pl tests
Diff: book.cpp
- Revision:
- 0:c643d398cdb6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/book.cpp Thu Jan 11 13:42:27 2018 +0000
@@ -0,0 +1,56 @@
+//
+// Filename: book.h
+//
+// Container for Flexbook pages.
+//
+
+#include "book.h"
+
+#include "log.h"
+#include "pagefactory.h"
+#include "page.h"
+
+#include <iostream>
+
+namespace Flexbook {
+
+Book::Book(PageFactory &thefactory)
+: factory(thefactory),
+ pagetype(PageType_PageNull),
+ page(nullptr)
+{
+ Log("Creating Book");
+}
+
+Book::~Book()
+{
+ Log("Deleting Book");
+}
+
+void Book::PageChange(PageType type)
+{
+ Log("Page change");
+
+ // Delete the old page.
+ page.reset();
+ pagetype = PageType_PageNull;
+
+ // Create the new page and any of it's dependencies.
+ page = factory.CreatePages(type);
+ pagetype = type;
+}
+
+PageType Book::GetPageType() const
+{
+ return pagetype;
+}
+
+void Book::HandleActions()
+{
+ if(page.get())
+ page->HandlePageActions();
+}
+
+} // End Flexbook namespace.
+
+