NCBI C++ ToolKit
srcmod_checkbox_panel.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: srcmod_checkbox_panel.cpp 29794 2014-02-12 20:13:29Z bollin $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Colleen Bollin
27  */
28 
29 
30 
31 #include <ncbi_pch.hpp>
32 
33 
34 
35 ////@begin includes
36 ////@end includes
37 
39 #include <wx/sizer.h>
40 #include <wx/icon.h>
41 
42 ////@begin XPM images
43 ////@end XPM images
44 
46 
47 /*
48  * CSrcModCheckboxPanel type definition
49  */
50 
51 IMPLEMENT_DYNAMIC_CLASS( CSrcModCheckboxPanel, CSrcModEditPanel )
52 
53 
54 /*
55  * CSrcModCheckboxPanel event table definition
56  */
57 
58 BEGIN_EVENT_TABLE( CSrcModCheckboxPanel, CSrcModEditPanel )
59 
60 ////@begin CSrcModCheckboxPanel event table entries
62 
63 ////@end CSrcModCheckboxPanel event table entries
64 
66 
67 
68 /*
69  * CSrcModCheckboxPanel constructors
70  */
71 
73 {
74  Init();
75 }
76 
77 CSrcModCheckboxPanel::CSrcModCheckboxPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
79 {
80  Init();
81  Create(parent, id, pos, size, style);
82 }
83 
84 
85 /*
86  * CSrcModCheckboxPanel creator
87  */
88 
89 bool CSrcModCheckboxPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
90 {
91 ////@begin CSrcModCheckboxPanel creation
92  CSrcModEditPanel::Create( parent, id, pos, size, style );
93 
95  if (GetSizer())
96  {
97  GetSizer()->SetSizeHints(this);
98  }
99  Centre();
100 ////@end CSrcModCheckboxPanel creation
101  return true;
102 }
103 
104 
105 /*
106  * CSrcModCheckboxPanel destructor
107  */
108 
110 {
111 ////@begin CSrcModCheckboxPanel destruction
112 ////@end CSrcModCheckboxPanel destruction
113 }
114 
115 
116 /*
117  * Member initialisation
118  */
119 
121 {
122 ////@begin CSrcModCheckboxPanel member initialisation
123  m_Checkbox = NULL;
124 ////@end CSrcModCheckboxPanel member initialisation
125 }
126 
127 
128 /*
129  * Control creation for CSrcModCheckboxPanel
130  */
131 
133 {
134 ////@begin CSrcModCheckboxPanel content construction
135  CSrcModCheckboxPanel* itemCSrcModEditPanel1 = this;
136 
137  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
138  itemCSrcModEditPanel1->SetSizer(itemBoxSizer2);
139 
140  m_Checkbox = new wxCheckBox( itemCSrcModEditPanel1, ID_CHECKBOX, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
141  m_Checkbox->SetValue(true);
142  itemBoxSizer2->Add(m_Checkbox, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
143 
144 ////@end CSrcModCheckboxPanel content construction
145 }
146 
147 
148 /*
149  * Should we show tooltips?
150  */
151 
153 {
154  return true;
155 }
156 
157 /*
158  * Get bitmap resources
159  */
160 
161 wxBitmap CSrcModCheckboxPanel::GetBitmapResource( const wxString& name )
162 {
163  // Bitmap retrieval
164 ////@begin CSrcModCheckboxPanel bitmap retrieval
165  wxUnusedVar(name);
166  return wxNullBitmap;
167 ////@end CSrcModCheckboxPanel bitmap retrieval
168 }
169 
170 /*
171  * Get icon resources
172  */
173 
174 wxIcon CSrcModCheckboxPanel::GetIconResource( const wxString& name )
175 {
176  // Icon retrieval
177 ////@begin CSrcModCheckboxPanel icon retrieval
178  wxUnusedVar(name);
179  return wxNullIcon;
180 ////@end CSrcModCheckboxPanel icon retrieval
181 }
182 
183 
185 {
186  if (m_Checkbox->GetValue()) {
187  return "TRUE";
188  } else {
189  return "";
190  }
191 }
192 
193 
194 void CSrcModCheckboxPanel::SetValue(const string& val)
195 {
196  if (NStr::EqualNocase(val, "TRUE")) {
197  m_Checkbox->SetValue(true);
198  } else {
199  m_Checkbox->SetValue(false);
200  }
201 }
202 
203 
205 {
206  if (NStr::IsBlank(val) || NStr::EqualNocase(val, "TRUE") || NStr::EqualNocase(val, "FALSE")) {
207  return true;
208  } else {
209  return false;
210  }
211  return true;
212 }
213 
214 
215 /*
216  * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX
217  */
218 
219 void CSrcModCheckboxPanel::OnCheckboxClick( wxCommandEvent& event )
220 {
221  x_NotifyParent();
222 }
223 
224 
226 
EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX, CAdjustFeaturesForGaps::OnKnownUnknownSelected) EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX1
virtual bool IsWellFormatted(const string &val)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void OnCheckboxClick(wxCommandEvent &event)
wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX
void Init()
Initialises member variables.
virtual void SetValue(const string &val)
static bool ShowToolTips()
Should we show tooltips?
void CreateControls()
Creates the controls and sizers.
CSrcModCheckboxPanel()
Constructors.
bool Create(wxWindow *parent, wxWindowID id=10020, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Creation.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
static void Init(void)
Definition: cursor6.c:76
#define NULL
Definition: ncbistd.hpp:225
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
Definition: ncbistr.cpp:106
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Definition: ncbistr.hpp:5353
END_EVENT_TABLE()
const struct ncbi::grid::netcache::search::fields::SIZE size
#define ID_CHECKBOX
Modified on Mon Feb 26 04:03:47 2024 by modify_doxy.py rev. 669887