1f5d564a1SRene Gollent /* 2*fce4895dSRene Gollent * Copyright 2015-2016, Rene Gollent, rene@gollent.com. 3f5d564a1SRene Gollent * Distributed under the terms of the MIT License. 4f5d564a1SRene Gollent */ 5f5d564a1SRene Gollent 6f5d564a1SRene Gollent #include "TableCellFloatEditor.h" 7f5d564a1SRene Gollent 8f5d564a1SRene Gollent #include <ctype.h> 9f5d564a1SRene Gollent 10f5d564a1SRene Gollent #include <Variant.h> 11f5d564a1SRene Gollent 12f5d564a1SRene Gollent #include "IntegerValue.h" 13*fce4895dSRene Gollent #include "ValueFormatter.h" 14f5d564a1SRene Gollent 15f5d564a1SRene Gollent TableCellFloatEditor(::Value * initialValue,ValueFormatter * formatter)16f5d564a1SRene GollentTableCellFloatEditor::TableCellFloatEditor(::Value* initialValue, 17f5d564a1SRene Gollent ValueFormatter* formatter) 18f5d564a1SRene Gollent : 19f5d564a1SRene Gollent TableCellTextControlEditor(initialValue, formatter) 20f5d564a1SRene Gollent { 21f5d564a1SRene Gollent } 22f5d564a1SRene Gollent 23f5d564a1SRene Gollent ~TableCellFloatEditor()24f5d564a1SRene GollentTableCellFloatEditor::~TableCellFloatEditor() 25f5d564a1SRene Gollent { 26f5d564a1SRene Gollent } 27f5d564a1SRene Gollent 28f5d564a1SRene Gollent 29f5d564a1SRene Gollent bool ValidateInput() const30f5d564a1SRene GollentTableCellFloatEditor::ValidateInput() const 31f5d564a1SRene Gollent { 32f5d564a1SRene Gollent BVariant variantValue; 33f5d564a1SRene Gollent if (!InitialValue()->ToVariant(variantValue)) 34f5d564a1SRene Gollent return false; 35f5d564a1SRene Gollent 36f5d564a1SRene Gollent return GetValueFormatter()->ValidateFormattedValue(Text(), 37f5d564a1SRene Gollent variantValue.Type()); 38f5d564a1SRene Gollent } 39f5d564a1SRene Gollent 40f5d564a1SRene Gollent 41f5d564a1SRene Gollent status_t GetValueForInput(::Value * & _output) const42f5d564a1SRene GollentTableCellFloatEditor::GetValueForInput(::Value*& _output) const 43f5d564a1SRene Gollent { 44f5d564a1SRene Gollent BVariant variantValue; 45f5d564a1SRene Gollent if (!InitialValue()->ToVariant(variantValue)) 46f5d564a1SRene Gollent return B_NO_MEMORY; 47f5d564a1SRene Gollent 48f5d564a1SRene Gollent return GetValueFormatter()->GetValueFromFormattedInput(Text(), 49f5d564a1SRene Gollent variantValue.Type(), _output); 50f5d564a1SRene Gollent } 51f5d564a1SRene Gollent 52f5d564a1SRene Gollent 53