summaryrefslogtreecommitdiffstats
path: root/Project/RateLimiterForm.cpp
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2017-03-30 11:10:06 -0300
committerThales Lima Oliveira <thaleslima.ufu@gmail.com>2017-03-30 11:10:06 -0300
commit045037ce8f2b106acbe5425245746a2dbed65c26 (patch)
treef81b4003f1ec6f835681c768c945065b1976da42 /Project/RateLimiterForm.cpp
parent3985018cdb8508b9970646ae4b9886ba4df6dd78 (diff)
downloadPSP.git-045037ce8f2b106acbe5425245746a2dbed65c26.tar.gz
PSP.git-045037ce8f2b106acbe5425245746a2dbed65c26.tar.xz
PSP.git-045037ce8f2b106acbe5425245746a2dbed65c26.zip
Exponencial under implementation
Diffstat (limited to 'Project/RateLimiterForm.cpp')
-rw-r--r--Project/RateLimiterForm.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/Project/RateLimiterForm.cpp b/Project/RateLimiterForm.cpp
new file mode 100644
index 0000000..e0d11f2
--- /dev/null
+++ b/Project/RateLimiterForm.cpp
@@ -0,0 +1,35 @@
+#include "RateLimiterForm.h"
+#include "RateLimiter.h"
+
+RateLimiterForm::RateLimiterForm(wxWindow* parent, RateLimiter* rateLimiter) : RateLimiterFormBase(parent)
+{
+ m_rateLimiter = rateLimiter;
+ m_parent = parent;
+
+ m_textCtrlUpLimit->SetValue(m_rateLimiter->StringFromDouble(m_rateLimiter->GetUpLimit()));
+ m_textCtrlLowLimit->SetValue(m_rateLimiter->StringFromDouble(m_rateLimiter->GetLowLimit()));
+}
+
+RateLimiterForm::~RateLimiterForm() {}
+bool RateLimiterForm::ValidateData()
+{
+ double upLimit;
+ double lowLimit;
+
+ if(!m_rateLimiter->DoubleFromString(this, m_textCtrlUpLimit->GetValue(), upLimit,
+ _("Value entered incorrectly in the field \"Upper limit\".")))
+ return false;
+ if(!m_rateLimiter->DoubleFromString(this, m_textCtrlLowLimit->GetValue(), lowLimit,
+ _("Value entered incorrectly in the field \"Lower limit\".")))
+ return false;
+
+ m_rateLimiter->SetUpLimit(upLimit);
+ m_rateLimiter->SetLowLimit(lowLimit);
+
+ return true;
+}
+
+void RateLimiterForm::OnOKButtonClick(wxCommandEvent& event)
+{
+ if(ValidateData()) EndModal(wxID_OK);
+}