SPH
Utils.h
Go to the documentation of this file.
1 #pragma once
2 
7 
8 #include "common/Globals.h"
10 #include "objects/Object.h"
11 #include "objects/wrappers/Flags.h"
12 #include "run/VirtualSettings.h"
13 #include <wx/window.h>
14 
15 class wxDC;
16 
18 
19 class Path;
20 
22 
23 Optional<Path> doSaveFileDialog(const std::string& title, Array<FileFormat>&& formats);
24 
25 Optional<Path> doOpenFileDialog(const std::string& title, Array<FileFormat>&& formats);
26 
29 void drawTextWithSubscripts(wxDC& dc, const std::wstring& text, const wxPoint point);
30 
31 void drawTextWithSubscripts(wxDC& dc, const std::string& text, const wxPoint point);
32 
34 std::wstring toPrintableString(const Float value,
35  const Size precision = 5,
36  const Float decimalThreshold = 1000._f);
37 
39 
40 class BusyCursor {
41 private:
42  wxWindow* window;
43 
44 public:
45  BusyCursor(wxWindow* window)
46  : window(window) {
47  window->SetCursor(*wxHOURGLASS_CURSOR);
48  wxYield();
49  }
50 
52  window->SetCursor(*wxSTANDARD_CURSOR);
53  }
54 };
55 
NAMESPACE_SPH_BEGIN
Definition: BarnesHut.cpp:13
Wrapper over enum allowing setting (and querying) individual bits of the stored value.
Global parameters of the code.
uint32_t Size
Integral type used to index arrays (by default).
Definition: Globals.h:16
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
Definition: Globals.h:13
Interface for renderers.
Common macros and basic objects.
#define NAMESPACE_SPH_END
Definition: Object.h:12
void printLabels(wxDC &dc, ArrayView< const IRenderOutput::Label > labels)
Definition: Utils.cpp:186
void drawTextWithSubscripts(wxDC &dc, const std::wstring &text, const wxPoint point)
Definition: Utils.cpp:86
std::wstring toPrintableString(const Float value, const Size precision=5, const Float decimalThreshold=1000._f)
Converts the value to a printable string.
Definition: Utils.cpp:121
Optional< Path > doSaveFileDialog(const std::string &title, Array< FileFormat > &&formats)
Definition: Utils.cpp:56
Optional< Path > doOpenFileDialog(const std::string &title, Array< FileFormat > &&formats)
Definition: Utils.cpp:45
IVirtualEntry::FileFormat FileFormat
Definition: Utils.h:21
Object providing connection between component parameters and values exposed to the user.
Object providing safe access to continuous memory of data.
Definition: ArrayView.h:17
Generic dynamically allocated resizable storage.
Definition: Array.h:43
~BusyCursor()
Definition: Utils.h:51
BusyCursor(wxWindow *window)
Definition: Utils.h:45
Wrapper of type value of which may or may not be present.
Definition: Optional.h:23
Object representing a path on a filesystem.
Definition: Path.h:17