SPH
Widgets.h
Go to the documentation of this file.
1 #pragma once
2 
5 #include <wx/combobox.h>
6 #include <wx/textctrl.h>
7 
9 
10 class FloatTextCtrl : public wxTextCtrl {
11 private:
12  double value;
13  double lastValidValue;
14  Interval range;
15 
16 public:
17  Function<bool(double)> onValueChanged;
18 
19  FloatTextCtrl(wxWindow* parent, const double value, const Interval range = Interval::unbounded());
20 
21  double getValue() const {
22  return value;
23  }
24 
25 private:
26  void validate();
27 };
28 
29 class ComboBox : public wxComboBox {
30 public:
31  ComboBox(wxWindow* parent, const wxString& title, const wxSize& size = { -1, -1 })
32  : wxComboBox(parent, wxID_ANY, title, wxDefaultPosition, size, {}, wxCB_READONLY) {}
33 };
34 
NAMESPACE_SPH_BEGIN
Definition: BarnesHut.cpp:13
Generic wrappers of lambdas, functors and other callables.
Object representing interval of real values.
#define NAMESPACE_SPH_END
Definition: Object.h:12
ComboBox(wxWindow *parent, const wxString &title, const wxSize &size={ -1, -1 })
Definition: Widgets.h:31
double getValue() const
Definition: Widgets.h:21
FloatTextCtrl(wxWindow *parent, const double value, const Interval range=Interval::unbounded())
Definition: Widgets.cpp:7
Function< bool(double)> onValueChanged
Definition: Widgets.h:17
Object representing a 1D interval of real numbers.
Definition: Interval.h:17
static Interval unbounded()
Returns an unbounded (infinite) interval.
Definition: Interval.h:109