Code::Blocks  SVN r11506
genericmultilinenotesdlg.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3  * http://www.gnu.org/licenses/lgpl-3.0.html
4  *
5  * $Revision: 10912 $
6  * $Id: genericmultilinenotesdlg.cpp 10912 2016-09-25 16:10:13Z fuscated $
7  * $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/sdk/genericmultilinenotesdlg.cpp $
8  */
9 
10 #include "sdk_precomp.h"
11 
12 #ifndef CB_PRECOMP
13  #include <wx/button.h>
14  #include <wx/textctrl.h>
15  #include <wx/xrc/xmlres.h>
16 #endif
17 
19 
21  //
22 END_EVENT_TABLE()
23 
24 GenericMultiLineNotesDlg::GenericMultiLineNotesDlg(wxWindow* parent, const wxString& caption, const wxString& notes, bool readOnly)
25  : m_Notes(notes),
26  m_ReadOnly(readOnly)
27 {
28  //ctor
29  wxXmlResource::Get()->LoadObject(this, parent, _T("dlgGenericMultiLineNotes"),_T("wxScrollingDialog"));
30  SetTitle(caption);
31 
32  wxTextCtrl *notesCtrl = XRCCTRL(*this, "txtNotes", wxTextCtrl);
33 
34  notesCtrl->SetValue(m_Notes);
35  if (m_ReadOnly)
36  {
37  notesCtrl->SetEditable(false);
38  if (wxWindow* win = FindWindowById(wxID_CANCEL, this))
39  {
40  win->Enable(false);
41  }
42  // If the control is editable the user cannot activate the default button with
43  // the enter key, so we set the default button only for read only notes.
44  XRCCTRL(*this, "wxID_OK", wxButton)->SetDefault();
45  }
46  else
47  notesCtrl->SetFocus();
48 }
49 
51 {
52  //dtor
53 }
54 
56 {
57  if (retCode == wxID_OK && !m_ReadOnly)
58  {
59  m_Notes = XRCCTRL(*this, "txtNotes", wxTextCtrl)->GetValue();
60  }
62 }
void EndModal(int retCode)
Definition: sc_dialog.cpp:112
#define _T(string)
static wxXmlResource * Get()
wxObject * LoadObject(wxWindow *parent, const wxString &name, const wxString &classname)
void EndModal(int retCode) override