Code::Blocks
SVN r11506
sdk
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
18
#include "
genericmultilinenotesdlg.h
"
19
20
BEGIN_EVENT_TABLE(
GenericMultiLineNotesDlg
,
wxScrollingDialog
)
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
50
GenericMultiLineNotesDlg::~GenericMultiLineNotesDlg
()
51
{
52
//dtor
53
}
54
55
void
GenericMultiLineNotesDlg::EndModal
(
int
retCode)
56
{
57
if
(retCode ==
wxID_OK
&& !
m_ReadOnly
)
58
{
59
m_Notes
= XRCCTRL(*
this
,
"txtNotes"
,
wxTextCtrl
)->GetValue();
60
}
61
wxScrollingDialog::EndModal
(retCode);
62
}
button.h
GenericMultiLineNotesDlg::m_ReadOnly
bool m_ReadOnly
Definition:
genericmultilinenotesdlg.h:24
ScriptBindings::EndModal
void EndModal(int retCode)
Definition:
sc_dialog.cpp:112
GenericMultiLineNotesDlg::m_Notes
wxString m_Notes
Definition:
genericmultilinenotesdlg.h:23
wxID_CANCEL
_T
#define _T(string)
wxScrollingDialog
Definition:
scrollingdialog.h:163
GenericMultiLineNotesDlg
Definition:
genericmultilinenotesdlg.h:13
wxButton
wxTextCtrl
wxID_OK
textctrl.h
sdk_precomp.h
wxString
GenericMultiLineNotesDlg::~GenericMultiLineNotesDlg
~GenericMultiLineNotesDlg() override
Definition:
genericmultilinenotesdlg.cpp:50
genericmultilinenotesdlg.h
xmlres.h
wxXmlResource::Get
static wxXmlResource * Get()
wxWindow
wxXmlResource::LoadObject
wxObject * LoadObject(wxWindow *parent, const wxString &name, const wxString &classname)
GenericMultiLineNotesDlg::EndModal
void EndModal(int retCode) override
Definition:
genericmultilinenotesdlg.cpp:55
Generated by
1.8.13