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

Go to the SVN repository for this file.

1 /*
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: Vasuki Gobu
27  */
28 
29 
30 
31 #include <ncbi_pch.hpp>
35 
36 ////@begin includes
37 ////@end includes
38 
39 #include "src_other_pnl.hpp"
40 
41 
42 ////@begin XPM images
43 ////@end XPM images
44 
47 
48 /*
49  * CSourceOtherPanel type definition
50  */
51 
52 IMPLEMENT_DYNAMIC_CLASS( CSourceOtherPanel, wxPanel )
53 
54 
55 /*
56  * CSourceOtherPanel event table definition
57  */
58 
59 BEGIN_EVENT_TABLE( CSourceOtherPanel, wxPanel )
60 
61 ////@begin CSourceOtherPanel event table entries
62 ////@end CSourceOtherPanel event table entries
63 
65 
66 
67 /*
68  * CSourceOtherPanel constructors
69  */
70 
72 {
73  Init();
74 }
75 
76 CSourceOtherPanel::CSourceOtherPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
77 {
78  Init();
79  Create(parent, id, pos, size, style);
80 }
81 
82 
83 /*
84  * CSourceOtherPanel creator
85  */
86 
87 bool CSourceOtherPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
88 {
89 ////@begin CSourceOtherPanel creation
90  wxPanel::Create( parent, id, pos, size, style );
91 
93  if (GetSizer())
94  {
95  GetSizer()->SetSizeHints(this);
96  }
97  Centre();
98 ////@end CSourceOtherPanel creation
99  return true;
100 }
101 
102 
103 /*
104  * CSourceOtherPanel destructor
105  */
106 
108 {
109 ////@begin CSourceOtherPanel destruction
110 ////@end CSourceOtherPanel destruction
111 }
112 
113 
114 /*
115  * Member initialisation
116  */
117 
119 {
120 ////@begin CSourceOtherPanel member initialisation
124 ////@end CSourceOtherPanel member initialisation
125  m_OrgRef.Reset(new COrg_ref());
126 }
127 
128 
129 /*
130  * Control creation for CSourceOtherPanel
131  */
132 
134 {
135 ////@begin CSourceOtherPanel content construction
136  CSourceOtherPanel* itemPanel1 = this;
137 
138  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
139  itemPanel1->SetSizer(itemBoxSizer2);
140 
141  wxFlexGridSizer* itemFlexGridSizer3 = new wxFlexGridSizer(0, 2, 0, 0);
142  itemBoxSizer2->Add(itemFlexGridSizer3, 0, wxALIGN_LEFT|wxALL, 5);
143 
144  wxStaticText* itemStaticText4 = new wxStaticText( itemPanel1, wxID_STATIC, _("Common Name"), wxDefaultPosition, wxDefaultSize, 0 );
145  itemFlexGridSizer3->Add(itemStaticText4, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
146 
147  m_CommonNameCtrl = new wxTextCtrl( itemPanel1, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
148  itemFlexGridSizer3->Add(m_CommonNameCtrl, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
149 
150  wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("Taxonomic Lineage"), wxDefaultPosition, wxDefaultSize, 0 );
151  itemFlexGridSizer3->Add(itemStaticText6, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
152 
153  m_LineageCtrl = new wxTextCtrl( itemPanel1, ID_TEXTCTRL2, wxEmptyString, wxDefaultPosition, wxSize(200, -1), wxTE_MULTILINE );
154  itemFlexGridSizer3->Add(m_LineageCtrl, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
155 
156  wxStaticText* itemStaticText8 = new wxStaticText( itemPanel1, wxID_STATIC, _("Division"), wxDefaultPosition, wxDefaultSize, 0 );
157  itemFlexGridSizer3->Add(itemStaticText8, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
158 
159  m_DivisionCtrl = new wxTextCtrl( itemPanel1, ID_TEXTCTRL3, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
160  itemFlexGridSizer3->Add(m_DivisionCtrl, 0, wxALIGN_LEFT|wxGROW|wxALL, 5);
161 
162 ////@end CSourceOtherPanel content construction
163 
164  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
165  itemBoxSizer2->Add(itemBoxSizer4, 1, wxALIGN_LEFT|wxALL, 0);
166 
167  m_Dbxrefs = new CDbxrefPanel(this, *m_OrgRef);
168  itemBoxSizer4->Add(m_Dbxrefs, 0, wxEXPAND|wxALL, 5);
169 }
170 
171 
172 /*
173  * Should we show tooltips?
174  */
175 
177 {
178  return true;
179 }
180 
181 /*
182  * Get bitmap resources
183  */
184 
185 wxBitmap CSourceOtherPanel::GetBitmapResource( const wxString& name )
186 {
187  // Bitmap retrieval
188 ////@begin CSourceOtherPanel bitmap retrieval
189  wxUnusedVar(name);
190  return wxNullBitmap;
191 ////@end CSourceOtherPanel bitmap retrieval
192 }
193 
194 /*
195  * Get icon resources
196  */
197 
198 wxIcon CSourceOtherPanel::GetIconResource( const wxString& name )
199 {
200  // Icon retrieval
201 ////@begin CSourceOtherPanel icon retrieval
202  wxUnusedVar(name);
203  return wxNullIcon;
204 ////@end CSourceOtherPanel icon retrieval
205 }
206 
207 
209 {
210  if (org.IsSetCommon()) {
211  m_CommonNameCtrl->SetValue(ToWxString(org.GetCommon()));
212  } else {
213  m_CommonNameCtrl->SetValue(wxEmptyString);
214  }
215  if (org.IsSetLineage()) {
216  m_LineageCtrl->SetValue(ToWxString(org.GetLineage()));
217  } else {
218  m_LineageCtrl->SetValue(wxEmptyString);
219  }
220  if (org.IsSetDivision()) {
221  m_DivisionCtrl->SetValue(ToWxString(org.GetDivision()));
222  } else {
223  m_DivisionCtrl->SetValue(wxEmptyString);
224  }
225 
226  m_OrgRef->ResetDb();
227  if (org.IsSetDb()) {
228  ITERATE(COrg_ref::TDb, it, org.GetDb()) {
229  CRef<CDbtag> db(new CDbtag());
230  db->Assign(**it);
231  m_OrgRef->SetDb().push_back(db);
232  }
233  }
235 }
236 
237 
239 {
240  TransferDataFromWindow();
241  string common = ToStdString(m_CommonNameCtrl->GetValue());
242  if (NStr::IsBlank(common)) {
243  org.ResetCommon();
244  } else {
245  org.SetCommon(common);
246  }
247 
248  string lineage = ToStdString(m_LineageCtrl->GetValue());
249  if (NStr::IsBlank(lineage)) {
250  org.SetOrgname().ResetLineage();
251  } else {
252  org.SetOrgname().SetLineage(lineage);
253  }
254 
255  string div = ToStdString(m_DivisionCtrl->GetValue());
256  if (NStr::IsBlank(div)) {
257  org.SetOrgname().ResetDiv();
258  } else {
259  org.SetOrgname().SetDiv(div);
260  }
261 
263 }
264 
266 {
267  m_CommonNameCtrl->Clear();
268  m_LineageCtrl->Clear();
270  m_DivisionCtrl->Clear();
271 }
272 
Definition: Dbtag.hpp:53
void DeleteTaxonRef()
virtual bool TransferDataToWindow()
void PopulateDbxrefs(objects::CSeq_feat &seq_feat)
const string & GetLineage(void) const
Definition: Org_ref.cpp:124
const string & GetDivision(void) const
Definition: Org_ref.cpp:164
bool IsSetDivision(void) const
Definition: Org_ref.cpp:159
bool IsSetLineage(void) const
Definition: Org_ref.cpp:119
void CreateControls()
Creates the controls and sizers.
CRef< objects::COrg_ref > m_OrgRef
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
~CSourceOtherPanel()
Destructor.
bool Create(wxWindow *parent, wxWindowID id=ID_CSOURCEOTHERPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
static bool ShowToolTips()
Should we show tooltips?
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
CDbxrefPanel * m_Dbxrefs
void OnChangedTaxname(void)
void TransferToOrgRef(objects::COrg_ref &org)
wxTextCtrl * m_LineageCtrl
wxTextCtrl * m_DivisionCtrl
void Init()
Initialises member variables.
CSourceOtherPanel()
Constructors.
void TransferFromOrgRef(const objects::COrg_ref &org)
wxTextCtrl * m_CommonNameCtrl
#define _(proto)
Definition: ct_nlmzip_i.h:78
static void Init(void)
Definition: cursor6.c:76
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define NULL
Definition: ncbistd.hpp:225
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
#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
bool IsSetDb(void) const
ids in taxonomic or culture dbases Check if a value has been assigned to Db data member.
Definition: Org_ref_.hpp:479
void SetCommon(const TCommon &value)
Assign a value to Common data member.
Definition: Org_ref_.hpp:428
bool IsSetCommon(void) const
common name Check if a value has been assigned to Common data member.
Definition: Org_ref_.hpp:407
vector< CRef< CDbtag > > TDb
Definition: Org_ref_.hpp:101
const TCommon & GetCommon(void) const
Get the Common member data.
Definition: Org_ref_.hpp:419
const TDb & GetDb(void) const
Get the Db member data.
Definition: Org_ref_.hpp:491
void ResetCommon(void)
Reset Common data member.
Definition: Org_ref_.cpp:58
void SetOrgname(TOrgname &value)
Assign a value to Orgname data member.
Definition: Org_ref_.cpp:87
END_EVENT_TABLE()
const struct ncbi::grid::netcache::search::fields::SIZE size
USING_SCOPE(objects)
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
string ToStdString(const wxString &s)
Definition: wx_utils.hpp:161
Modified on Thu Mar 28 17:07:16 2024 by modify_doxy.py rev. 669887