Code::Blocks  SVN r11506
editwatchdlg.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3  * http://www.gnu.org/licenses/gpl-3.0.html
4  *
5  * $Revision: 10912 $
6  * $Id: editwatchdlg.cpp 10912 2016-09-25 16:10:13Z fuscated $
7  * $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/plugins/debuggergdb/editwatchdlg.cpp $
8  */
9 
10 #include <sdk.h>
11 #include "editwatchdlg.h"
12 
13 #ifndef CB_PRECOMP
14  #include <wx/button.h>
15  #include <wx/checkbox.h>
16  #include <wx/defs.h>
17  #include <wx/intl.h>
18  #include <wx/radiobox.h>
19  #include <wx/sizer.h>
20  #include <wx/spinctrl.h>
21  #include <wx/textctrl.h>
22  #include <wx/xrc/xmlres.h>
23 #endif // CB_PRECOMP
24 
25 #include "debugger_defs.h"
26 
27 EditWatchDlg::EditWatchDlg(cb::shared_ptr<GDBWatch> w, wxWindow* parent)
28  : m_watch(w)
29 {
30  //ctor
31  wxXmlResource::Get()->LoadObject(this, parent, _T("dlgEditWatch"),_T("wxScrollingDialog"));
32 
33  if (m_watch)
34  {
35  wxString symbol;
36  m_watch->GetSymbol(symbol);
37 
38  XRCCTRL(*this, "txtKeyword", wxTextCtrl)->SetValue(symbol);
39  XRCCTRL(*this, "rbFormat", wxRadioBox)->SetSelection((int)m_watch->GetFormat());
40  XRCCTRL(*this, "chkArray", wxCheckBox)->SetValue(m_watch->IsArray());
41  XRCCTRL(*this, "spnArrStart", wxSpinCtrl)->SetValue(m_watch->GetArrayStart());
42  XRCCTRL(*this, "spnArrCount", wxSpinCtrl)->SetValue(m_watch->GetArrayCount());
43  }
44  XRCCTRL(*this, "txtKeyword", wxTextCtrl)->SetFocus();
45  XRCCTRL(*this, "wxID_OK", wxButton)->SetDefault();
46 }
47 
49 {
50  //dtor
51 }
52 
53 void EditWatchDlg::EndModal(int retCode)
54 {
55  if (retCode == wxID_OK && m_watch)
56  {
57  m_watch->SetSymbol(CleanStringValue(XRCCTRL(*this, "txtKeyword", wxTextCtrl)->GetValue()));
58  m_watch->SetFormat((WatchFormat)XRCCTRL(*this, "rbFormat", wxRadioBox)->GetSelection());
59  m_watch->SetArray(XRCCTRL(*this, "chkArray", wxCheckBox)->GetValue());
60  m_watch->SetArrayParams(XRCCTRL(*this, "spnArrStart", wxSpinCtrl)->GetValue(),
61  XRCCTRL(*this, "spnArrCount", wxSpinCtrl)->GetValue());
62  }
64 }
void EndModal(int retCode)
Definition: sc_dialog.cpp:112
WatchFormat
Watch variable format.
#define _T(string)
cb::shared_ptr< GDBWatch > m_watch
Definition: editwatchdlg.h:22
EditWatchDlg(cb::shared_ptr< GDBWatch > w, wxWindow *parent)
void EndModal(int retCode)
wxString CleanStringValue(wxString value)
virtual ~EditWatchDlg()
static wxXmlResource * Get()
wxObject * LoadObject(wxWindow *parent, const wxString &name, const wxString &classname)