00001 #ifndef INFO_EDIT_IMPLEMENTATION_FILE
00002 #define INFO_EDIT_IMPLEMENTATION_FILE
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "info_edit.h"
00019
00020 #include <textual/string_convert.h>
00021
00022 BEGIN_MESSAGE_MAP(info_edit, CNSFlexDialog)
00023 END_MESSAGE_MAP()
00024
00025 info_edit::info_edit(CWnd *parent, const char *initial_edit, int max_length,
00026 const char *description, const char *title, bool onnatop)
00027 : CNSFlexDialog(info_edit::IDD, parent),
00028 _title(new istring(title)),
00029 _max_length(max_length),
00030 _on_top(onnatop)
00031 {
00032
00033 AddFlexConstraint(IDC_INFO_EDIT_DESC, NSFlexExpandRight, NSFlexExpandDown);
00034 AddFlexConstraint(IDC_INFO_EDITBOX, NSFlexExpandRight, NSFlexShiftDown);
00035
00036 AddFlexConstraint(IDOK, NSFlexShiftRight, NSFlexShiftDown);
00037 AddFlexConstraint(IDCANCEL, NSFlexShiftRight, NSFlexShiftDown);
00038
00039 istring temp_edit = initial_edit;
00040 if (temp_edit.length() > max_length)
00041 temp_edit.zap(max_length - 1, temp_edit.end());
00042 _text_field = string_convert::to_CString(temp_edit);
00043 _description_field = description;
00044 }
00045
00046 istring info_edit::text() const
00047 { return string_convert::to_istring(_text_field); }
00048
00049 void info_edit::DoDataExchange(CDataExchange* pDX)
00050 {
00051 CNSFlexDialog::DoDataExchange(pDX);
00052 DDX_Text(pDX, IDC_INFO_EDITBOX, _text_field);
00053 DDV_MaxChars(pDX, _text_field, _max_length);
00054 DDX_Text(pDX, IDC_INFO_EDIT_DESC, _description_field);
00055 }
00056
00057 BOOL info_edit::OnInitDialog()
00058 {
00059 CNSFlexDialog::OnInitDialog();
00060 SetWindowText(string_convert::to_CString(*_title));
00061
00062 if (_on_top) {
00063
00064 SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
00065 }
00066 return TRUE;
00067 }
00068
00069 void info_edit::OnOK()
00070 {
00071 UpdateData(TRUE);
00072 CNSFlexDialog::OnOK();
00073 }
00074
00075
00076 #endif //INFO_EDIT_IMPLEMENTATION_FILE
00077