From 3a1bf865b6c1b6b7c096eaf6dab91a465319488a Mon Sep 17 00:00:00 2001 From: Ian C Date: Mon, 4 Apr 2005 00:52:23 +0000 Subject: Added DataX --- src/combobox.cpp | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'src/combobox.cpp') diff --git a/src/combobox.cpp b/src/combobox.cpp index f16b619..fbf2a6c 100644 --- a/src/combobox.cpp +++ b/src/combobox.cpp @@ -20,14 +20,15 @@ // #include "w32dlib/window.h" #include "w32dlib/combobox.h" +#include "w32dlib/datax.h" namespace W32DLib { // ------------------------------------------------------------ // -ComboBox::ComboBox(Dialog *parent, int resource_id) : - Control(parent,resource_id) +ComboBox::ComboBox(Dialog *parent, int resource_id, DataX *datax) : + Control(parent,resource_id,datax) { } @@ -181,6 +182,34 @@ void ComboBox::SelectedIndex(int index) } +// ------------------------------------------------------------ +// +void ComboBox::DoDataExchange(bool set) +{ + if (m_data) + { + switch(m_data->Type()) + { + case DataX::eString: + case DataX::eBool: + Control::DoDataExchange(set); + break; + + case DataX::eInt: + if (set) + { + SelectedIndex(m_data->Int()); + } + else + { + m_data->Set(SelectedIndex()); + } + break; + } + } +} + + }; // namespace W32DLib // END OF FILE -- cgit v1.2.3