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

Go to the SVN repository for this file.

1 /* $Id: gene_panel.cpp 34438 2016-01-06 20:25:14Z filippov $
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: Roman Katargin
27  */
28 
29 
30 #include <ncbi_pch.hpp>
31 
32 ////@begin includes
33 ////@end includes
34 
35 #include "gene_panel.hpp"
38 #include <serial/serialbase.hpp>
39 #include <serial/typeinfo.hpp>
40 
41 #include <wx/sizer.h>
42 #include <wx/stattext.h>
43 #include <wx/textctrl.h>
44 #include <wx/bitmap.h>
45 #include <wx/icon.h>
46 
48 
49 
50 ////@begin XPM images
51 ////@end XPM images
52 
53 
54 /*!
55  * CGenePanel type definition
56  */
57 
58 IMPLEMENT_DYNAMIC_CLASS( CGenePanel, wxPanel )
59 
60 
61 /*!
62  * CGenePanel event table definition
63  */
64 
65 BEGIN_EVENT_TABLE( CGenePanel, wxPanel )
66 
67 ////@begin CGenePanel event table entries
68 ////@end CGenePanel event table entries
69 
71 
72 /*!
73  * CGenePanel constructors
74  */
75 
76  CGenePanel::CGenePanel() : m_Object(0)
77 {
78  Init();
79 }
80 
81 CGenePanel::CGenePanel( wxWindow* parent, CSerialObject& object, objects::CScope&,
82  wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
83  : m_Object(0)
84 {
85  m_Object = &object;
86  _ASSERT(m_Object->GetThisTypeInfo()->GetName() == "Gene-ref");
87  Init();
88  Create(parent, id, pos, size, style);
89 }
90 
91 
92 /*!
93  * CGenePanel creator
94  */
95 
96 bool CGenePanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
97 {
98 ////@begin CGenePanel creation
99  wxPanel::Create( parent, id, pos, size, style );
100 
101  CreateControls();
102  if (GetSizer())
103  {
104  GetSizer()->SetSizeHints(this);
105  }
106  Centre();
107 ////@end CGenePanel creation
108  return true;
109 }
110 
111 
112 /*!
113  * CGenePanel destructor
114  */
115 
117 {
118 ////@begin CGenePanel destruction
119 ////@end CGenePanel destruction
120 }
121 
122 
123 /*!
124  * Member initialisation
125  */
126 
128 {
129 ////@begin CGenePanel member initialisation
130 ////@end CGenePanel member initialisation
131 }
132 
133 
134 /*!
135  * Control creation for CGenePanel
136  */
137 
139 {
140 ////@begin CGenePanel content construction
141  CGenePanel* itemPanel1 = this;
142 
143  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
144  itemPanel1->SetSizer(itemBoxSizer2);
145 
146  wxFlexGridSizer* itemFlexGridSizer3 = new wxFlexGridSizer(0, 2, 0, 0);
147  itemBoxSizer2->Add(itemFlexGridSizer3, 0, wxALIGN_LEFT|wxALL, 5);
148 
149  wxStaticText* itemStaticText4 = new wxStaticText( itemPanel1, wxID_STATIC, _("Locus"), wxDefaultPosition, wxDefaultSize, 0 );
150  itemFlexGridSizer3->Add(itemStaticText4, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 1);
151 
152  wxTextCtrl* itemTextCtrl5 = new wxTextCtrl( itemPanel1, ID_TEXT1_GENEPNL, wxEmptyString, wxDefaultPosition, wxSize(itemPanel1->ConvertDialogToPixels(wxSize(150, -1)).x, -1), 0 );
153  itemFlexGridSizer3->Add(itemTextCtrl5, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
154 
155  wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("Allele"), wxDefaultPosition, wxDefaultSize, 0 );
156  itemFlexGridSizer3->Add(itemStaticText6, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 1);
157 
158  wxTextCtrl* itemTextCtrl7 = new wxTextCtrl( itemPanel1, ID_TEXT2_GENEPNL, wxEmptyString, wxDefaultPosition, wxSize(itemPanel1->ConvertDialogToPixels(wxSize(150, -1)).x, -1), 0 );
159  itemFlexGridSizer3->Add(itemTextCtrl7, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
160 
161  wxStaticText* itemStaticText8 = new wxStaticText( itemPanel1, wxID_STATIC, _("Description"), wxDefaultPosition, wxDefaultSize, 0 );
162  itemFlexGridSizer3->Add(itemStaticText8, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 1);
163 
164  wxTextCtrl* itemTextCtrl9 = new wxTextCtrl( itemPanel1, ID_TEXT3_GENEPNL, wxEmptyString, wxDefaultPosition, wxSize(itemPanel1->ConvertDialogToPixels(wxSize(150, -1)).x, -1), 0 );
165  itemFlexGridSizer3->Add(itemTextCtrl9, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
166 
167  wxStaticText* itemStaticText10 = new wxStaticText( itemPanel1, wxID_STATIC, _("Map Location"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
168  itemFlexGridSizer3->Add(itemStaticText10, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 1);
169 
170  wxTextCtrl* itemTextCtrl11 = new wxTextCtrl( itemPanel1, ID_TEXT4_GENEPNL, wxEmptyString, wxDefaultPosition, wxSize(itemPanel1->ConvertDialogToPixels(wxSize(150, -1)).x, -1), 0 );
171  itemFlexGridSizer3->Add(itemTextCtrl11, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
172 
173  wxStaticText* itemStaticText12 = new wxStaticText( itemPanel1, wxID_STATIC, _("Locus Tag"), wxDefaultPosition, wxDefaultSize, 0 );
174  itemFlexGridSizer3->Add(itemStaticText12, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 1);
175 
176  wxTextCtrl* itemTextCtrl13 = new wxTextCtrl( itemPanel1, ID_TEXT5_GENEPNL, wxEmptyString, wxDefaultPosition, wxSize(itemPanel1->ConvertDialogToPixels(wxSize(150, -1)).x, -1), 0 );
177  itemFlexGridSizer3->Add(itemTextCtrl13, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 1);
178 
179  objects::CGene_ref *gene = dynamic_cast<objects::CGene_ref*>(m_Object);
180  if (gene->IsSetLocus())
181  itemTextCtrl5->SetValue(gene->GetLocus());
182  if (gene->IsSetAllele())
183  itemTextCtrl7->SetValue(gene->GetAllele());
184  if (gene->IsSetDesc())
185  itemTextCtrl9->SetValue(gene->GetDesc());
186  if (gene->IsSetMaploc())
187  itemTextCtrl11->SetValue(gene->GetMaploc());
188  if (gene->IsSetLocus_tag())
189  itemTextCtrl13->SetValue(gene->GetLocus_tag());
190 
191  // Set validators
192  itemTextCtrl5->SetValidator( CSerialTextValidator(*m_Object, "locus") );
193  itemTextCtrl7->SetValidator( CSerialTextValidator(*m_Object, "allele") );
194  itemTextCtrl9->SetValidator( CSerialTextValidator(*m_Object, "desc") );
195  itemTextCtrl11->SetValidator( CSerialTextValidator(*m_Object, "maploc"));
196  itemTextCtrl13->SetValidator( CSerialTextValidator(*m_Object, "locus-tag") );
197 ////@end CGenePanel content construction
198 
199 }
200 
201 /*!
202  * Should we show tooltips?
203  */
204 
206 {
207  return true;
208 }
209 
210 /*!
211  * Get bitmap resources
212  */
213 
214 wxBitmap CGenePanel::GetBitmapResource( const wxString& name )
215 {
216  // Bitmap retrieval
217 ////@begin CGenePanel bitmap retrieval
218  wxUnusedVar(name);
219  return wxNullBitmap;
220 ////@end CGenePanel bitmap retrieval
221 }
222 
223 /*!
224  * Get icon resources
225  */
226 
227 wxIcon CGenePanel::GetIconResource( const wxString& name )
228 {
229  // Icon retrieval
230 ////@begin CGenePanel icon retrieval
231  wxUnusedVar(name);
232  return wxNullIcon;
233 ////@end CGenePanel icon retrieval
234 }
235 
CGenePanel()
Constructors.
Definition: gene_panel.cpp:76
END_EVENT_TABLE()
bool Create(wxWindow *parent, wxWindowID id=ID_CGENEPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
Definition: gene_panel.cpp:96
~CGenePanel()
Destructor.
Definition: gene_panel.cpp:116
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:101
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
Definition: gene_panel.cpp:227
CSerialObject * m_Object
Definition: gene_panel.hpp:127
void Init()
Initialises member variables.
Definition: gene_panel.cpp:127
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
Definition: gene_panel.cpp:214
int size
static bool ShowToolTips()
Should we show tooltips?
Definition: gene_panel.cpp:205
static void Init(void)
Definition: cursor6.c:79
Base class for all serializable objects.
Definition: serialbase.hpp:148
#define _ASSERT
virtual const CTypeInfo * GetThisTypeInfo(void) const =0
void CreateControls()
Creates the controls and sizers.
Definition: gene_panel.cpp:138
const string & GetName(void) const
Get name of this type.
Definition: typeinfo.cpp:223
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:98
Modified on Sun Aug 28 17:56:52 2016 by modify_doxy.py rev. 506947