opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
tab.h
Go to the documentation of this file.
1#pragma once
2
6
7#include <future>
8#include <memory>
9
10namespace osc { class TabPrivate; }
11
12namespace osc
13{
14 class Tab : public Widget {
15 public:
16 UID id() const;
17 bool is_unsaved() const { return impl_is_unsaved(); }
18 std::future<TabSaveResult> try_save() { return impl_try_save(); }
20
21 protected:
22 explicit Tab(std::unique_ptr<TabPrivate>&&);
23
25 private:
26 // Implementors should return `true` if the contents of the `Tab`
27 // are "unsaved". The `Tab`-managing implementation may then use
28 // this to figure out whether it needs to schedule a call `try_save`
29 // or not.
30 virtual bool impl_is_unsaved() const { return false; }
31
32 // Implementors should return a `std::future<bool>` that yields
33 // its result once the save operation, which may be asynchronous,
34 // yields a result. The result yielded via the future should be
35 // `true` if the save operation was sucessful; otherwise, it
36 // should be `false`.
37 //
38 // By default, returns a `std::future<bool>` that immediately yields
39 // `TabSaveResult::Done`.
40 virtual std::future<TabSaveResult> impl_try_save();
41
42 virtual void impl_on_draw_main_menu() {}
43 };
44}
Definition tab_private.h:11
Definition tab.h:14
Tab(std::unique_ptr< TabPrivate > &&)
std::future< TabSaveResult > try_save()
Definition tab.h:18
void on_draw_main_menu()
Definition tab.h:19
virtual void impl_on_draw_main_menu()
Definition tab.h:42
OSC_WIDGET_DATA_GETTERS(TabPrivate)
UID id() const
bool is_unsaved() const
Definition tab.h:17
virtual bool impl_is_unsaved() const
Definition tab.h:30
virtual std::future< TabSaveResult > impl_try_save()
Definition uid.h:14
Definition widget.h:26
Definition custom_decoration_generator.h:5