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

Go to the SVN repository for this file.

1 /* $Id: set_class_panel.cpp 31595 2014-10-27 14:51:04Z 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 #include <ncbi_pch.hpp>
31 ////@begin includes
32 ////@end includes
33 
36 
37 #include <wx/sizer.h>
38 
39 ////@begin XPM images
40 ////@end XPM images
41 
44 
45 /*!
46  * CSetClassPanel type definition
47  */
48 
49 IMPLEMENT_DYNAMIC_CLASS( CSetClassPanel, wxPanel )
50 
51 
52 /*!
53  * CSetClassPanel event table definition
54  */
55 
56 BEGIN_EVENT_TABLE( CSetClassPanel, wxPanel )
57 
58 ////@begin CSetClassPanel event table entries
59  EVT_CHOICE( ID_CHOICE19, CSetClassPanel::OnChoice19Selected )
60 
61 ////@end CSetClassPanel event table entries
62 
64 
65 
66 /*!
67  * CSetClassPanel constructors
68  */
69 
71 {
72  Init();
73 }
74 
75 CSetClassPanel::CSetClassPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
76 {
77  Init();
78  Create(parent, id, pos, size, style);
79 }
80 
81 
82 /*!
83  * CSetClassPanel creator
84  */
85 
86 bool CSetClassPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
87 {
88 ////@begin CSetClassPanel creation
89  wxPanel::Create( parent, id, pos, size, style );
90 
92  if (GetSizer())
93  {
94  GetSizer()->SetSizeHints(this);
95  }
96  Centre();
97 ////@end CSetClassPanel creation
98  return true;
99 }
100 
101 
102 /*!
103  * CSetClassPanel destructor
104  */
105 
107 {
108 ////@begin CSetClassPanel destruction
109 ////@end CSetClassPanel destruction
110 }
111 
112 
113 /*!
114  * Member initialisation
115  */
116 
118 {
119 ////@begin CSetClassPanel member initialisation
120  m_SetClass = NULL;
121 ////@end CSetClassPanel member initialisation
122 }
123 
124 
125 /*!
126  * Control creation for CSetClassPanel
127  */
128 
130 {
131 ////@begin CSetClassPanel content construction
132  CSetClassPanel* itemPanel1 = this;
133 
134  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
135  itemPanel1->SetSizer(itemBoxSizer2);
136 
137  wxArrayString m_SetClassStrings;
138  m_SetClass = new wxChoice( itemPanel1, ID_CHOICE19, wxDefaultPosition, wxDefaultSize, m_SetClassStrings, 0 );
139  itemBoxSizer2->Add(m_SetClass, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
140 
141 ////@end CSetClassPanel content construction
142 
144 }
145 
146 
147 /*!
148  * Should we show tooltips?
149  */
150 
152 {
153  return true;
154 }
155 
156 /*!
157  * Get bitmap resources
158  */
159 
160 wxBitmap CSetClassPanel::GetBitmapResource( const wxString& name )
161 {
162  // Bitmap retrieval
163 ////@begin CSetClassPanel bitmap retrieval
164  wxUnusedVar(name);
165  return wxNullBitmap;
166 ////@end CSetClassPanel bitmap retrieval
167 }
168 
169 /*!
170  * Get icon resources
171  */
172 
173 wxIcon CSetClassPanel::GetIconResource( const wxString& name )
174 {
175  // Icon retrieval
176 ////@begin CSetClassPanel icon retrieval
177  wxUnusedVar(name);
178  return wxNullIcon;
179 ////@end CSetClassPanel icon retrieval
180 }
181 
182 
184 {
185  string rval = "";
186 
187  switch (class_type) {
189  rval = "Conset";
190  break;
192  rval = "Eco-set";
193  break;
195  rval = "Equiv";
196  break;
198  rval = "Genbank";
199  break;
201  rval = "Gen-prod-set";
202  break;
204  rval = "Gi-set";
205  break;
207  rval = "Gibb-set";
208  break;
210  rval = "Mut-set";
211  break;
213  rval = "Named-annot";
214  break;
216  rval = "Named-annot-prod";
217  break;
219  rval = "";
220  break;
222  rval = "Nuc-prot";
223  break;
225  rval = "Other";
226  break;
228  rval = "Paired-end-reads";
229  break;
231  rval = "Parts";
232  break;
234  rval = "Pdb-entry";
235  break;
237  rval = "Phy-set";
238  break;
240  rval = "Pir";
241  break;
243  rval = "Pop-set";
244  break;
246  rval = "Pub-set";
247  break;
249  rval = "Read-set";
250  break;
252  rval = "Segset";
253  break;
255  rval = "Small-genome-set";
256  break;
258  rval = "Swissprot";
259  break;
261  rval = "WGS-set";
262  break;
263  }
264  return rval;
265 }
266 
267 
268 CBioseq_set::TClass GetClassType(const string& class_name)
269 {
270  if (NStr::EqualNocase(class_name, "other")) {
272  }
273  for (unsigned int class_type = CBioseq_set::eClass_not_set;
274  class_type <= CBioseq_set::eClass_small_genome_set; class_type++) {
276  return (CBioseq_set::TClass)class_type;
277  }
278  }
280 }
281 
282 
284 {
286 
287  string class_name = GetClassName(class_type);
288  if (!m_SetClass->SetStringSelection(ToWxString(class_name))) {
289  m_SetClass->AppendString(ToWxString(class_name));
290  m_SetClass->SetStringSelection(ToWxString(class_name));
291  }
292 }
293 
294 
295 objects::CBioseq_set::EClass CSetClassPanel::GetClass()
296 {
297  string val = ToStdString(m_SetClass->GetStringSelection());
298 
299  return GetClassType(val);
300 }
301 
302 
304 {
305  m_SetClass->Clear();
313 }
314 
315 
316 /*!
317  * wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHOICE19
318  */
319 
320 void CSetClassPanel::OnChoice19Selected( wxCommandEvent& event )
321 {
322  wxWindow* parent = this->GetParent();
323  ISetClassNotify* listener = dynamic_cast<ISetClassNotify*>(parent);
324  while (parent && !listener)
325  {
326  parent = parent->GetParent();
327  listener = dynamic_cast<ISetClassNotify*>(parent);
328  }
329 
330  if (listener) {
331  listener->ChangeNotify();
332  }
333 }
334 
335 
void Init()
Initialises member variables.
bool Create(wxWindow *parent, wxWindowID id=ID_CSETCLASSPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
void OnChoice19Selected(wxCommandEvent &event)
wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHOICE19
static bool ShowToolTips()
Should we show tooltips?
objects::CBioseq_set::EClass GetClass()
void CreateControls()
Creates the controls and sizers.
~CSetClassPanel()
Destructor.
static string GetClassName(objects::CBioseq_set::TClass class_type)
CSetClassPanel()
Constructors.
wxChoice * m_SetClass
void SetClass(objects::CBioseq_set::EClass class_type)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
virtual void ChangeNotify(void)=0
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 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
@ eClass_named_annot_prod
with instantiated mRNA+protein
@ eClass_equiv
a set of equivalent maps or seqs
@ eClass_parts
parts for 2 or 3
@ eClass_named_annot
named annotation set
@ eClass_pop_set
population study
@ eClass_phy_set
phylogenetic study
@ eClass_conset
constructed sequence + parts
@ eClass_wgs_set
whole genome shotgun project
@ eClass_mut_set
set of mutations
@ eClass_pir
converted pir
@ eClass_paired_end_reads
paired sequences within a read-set
@ eClass_eco_set
ecological sample study
@ eClass_nuc_prot
nuc acid and coded proteins
Definition: Bioseq_set_.hpp:99
@ eClass_gibb
geninfo backbone
@ eClass_gen_prod_set
genomic products, chrom+mRNA+protein
@ eClass_pdb_entry
a complete PDB entry
@ eClass_genbank
converted genbank
@ eClass_read_set
set from a single read
@ eClass_swissprot
converted SWISSPROT
@ eClass_segset
segmented sequence + parts
@ eClass_small_genome_set
viral segments or mitochondrial minicircles
@ eClass_pub_set
all the seqs from a single publication
END_EVENT_TABLE()
const struct ncbi::grid::netcache::search::fields::SIZE size
USING_SCOPE(objects)
CBioseq_set::TClass GetClassType(const string &class_name)
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
string ToStdString(const wxString &s)
Definition: wx_utils.hpp:161
Modified on Fri May 03 15:52:53 2024 by modify_doxy.py rev. 669887