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

Go to the SVN repository for this file.

1 /* $Id: singleassemblyprogrampanel.cpp 26367 2012-09-05 12:56:41Z 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>
32 ////@begin includes
33 ////@end includes
34 
35 #include <wx/stattext.h>
37 
38 ////@begin XPM images
39 ////@end XPM images
40 
43 
44 /*!
45  * CSingleAssemblyProgramPanel type definition
46  */
47 
48 IMPLEMENT_DYNAMIC_CLASS( CSingleAssemblyProgramPanel, CAssemblyProgramPanel )
49 
50 
51 /*!
52  * CSingleAssemblyProgramPanel event table definition
53  */
54 
56 
57 ////@begin CSingleAssemblyProgramPanel event table entries
58 ////@end CSingleAssemblyProgramPanel event table entries
59 
61 
62 
63 /*!
64  * CSingleAssemblyProgramPanel constructors
65  */
66 
68 {
69  Init();
70 }
71 
72 CSingleAssemblyProgramPanel::CSingleAssemblyProgramPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
73 {
74  Init();
75  Create(parent, id, pos, size, style);
76 }
77 
78 
79 /*!
80  * CSingleAssemblyProgramPanel creator
81  */
82 
83 bool CSingleAssemblyProgramPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
84 {
85 ////@begin CSingleAssemblyProgramPanel creation
86  CAssemblyProgramPanel::Create( parent, id, pos, size, style );
87 
89  if (GetSizer())
90  {
91  GetSizer()->SetSizeHints(this);
92  }
93  Centre();
94 ////@end CSingleAssemblyProgramPanel creation
95  return true;
96 }
97 
98 
99 /*!
100  * CSingleAssemblyProgramPanel destructor
101  */
102 
104 {
105 ////@begin CSingleAssemblyProgramPanel destruction
106 ////@end CSingleAssemblyProgramPanel destruction
107 }
108 
109 
110 /*!
111  * Member initialisation
112  */
113 
115 {
116 ////@begin CSingleAssemblyProgramPanel member initialisation
117  m_Program = NULL;
118  m_Version = NULL;
119 ////@end CSingleAssemblyProgramPanel member initialisation
120 }
121 
122 
123 /*!
124  * Control creation for CSingleAssemblyProgramPanel
125  */
126 
128 {
129 ////@begin CSingleAssemblyProgramPanel content construction
130  CSingleAssemblyProgramPanel* itemCAssemblyProgramPanel1 = this;
131 
132  wxFlexGridSizer* itemFlexGridSizer2 = new wxFlexGridSizer(2, 2, 0, 0);
133  itemCAssemblyProgramPanel1->SetSizer(itemFlexGridSizer2);
134 
135  wxStaticText* itemStaticText3 = new wxStaticText( itemCAssemblyProgramPanel1, wxID_STATIC, _("Assembly program (required):"), wxDefaultPosition, wxDefaultSize, 0 );
136  itemFlexGridSizer2->Add(itemStaticText3, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
137 
138  m_Program = new wxTextCtrl( itemCAssemblyProgramPanel1, ID_TEXTCTRL17, wxEmptyString, wxDefaultPosition, wxSize(150, -1), 0 );
139  itemFlexGridSizer2->Add(m_Program, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
140 
141  wxStaticText* itemStaticText5 = new wxStaticText( itemCAssemblyProgramPanel1, wxID_STATIC, _("Version or date (required):"), wxDefaultPosition, wxDefaultSize, 0 );
142  itemFlexGridSizer2->Add(itemStaticText5, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
143 
144  m_Version = new wxTextCtrl( itemCAssemblyProgramPanel1, ID_TEXTCTRL18, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
145  itemFlexGridSizer2->Add(m_Version, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
146 
147 ////@end CSingleAssemblyProgramPanel content construction
148 }
149 
150 
152 {
153  size_t pos = NStr::Find (val, " v.");
154 
155  if (pos == string::npos) {
156  m_Program->SetValue (ToWxString (val));
157  m_Version->SetValue (wxEmptyString);
158  } else {
159  string program = val.substr (0, pos);
160  string version = val.substr (pos + 3);
161  NStr::TruncateSpacesInPlace (program);
163  m_Program->SetValue (program);
164  m_Version->SetValue (version);
165  }
166 }
167 
168 
170 {
171  string program = ToStdString (m_Program->GetValue());
172  string version = ToStdString (m_Version->GetValue());
173  NStr::TruncateSpacesInPlace (program);
175 
176  if (!NStr::IsBlank (version)) {
177  program += " v. ";
178  program += version;
179  }
180 
181  return program;
182 }
183 
184 
185 /*!
186  * Should we show tooltips?
187  */
188 
190 {
191  return true;
192 }
193 
194 /*!
195  * Get bitmap resources
196  */
197 
198 wxBitmap CSingleAssemblyProgramPanel::GetBitmapResource( const wxString& name )
199 {
200  // Bitmap retrieval
201 ////@begin CSingleAssemblyProgramPanel bitmap retrieval
202  wxUnusedVar(name);
203  return wxNullBitmap;
204 ////@end CSingleAssemblyProgramPanel bitmap retrieval
205 }
206 
207 /*!
208  * Get icon resources
209  */
210 
211 wxIcon CSingleAssemblyProgramPanel::GetIconResource( const wxString& name )
212 {
213  // Icon retrieval
214 ////@begin CSingleAssemblyProgramPanel icon retrieval
215  wxUnusedVar(name);
216  return wxNullIcon;
217 ////@end CSingleAssemblyProgramPanel icon retrieval
218 }
219 
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void Init()
Initialises member variables.
static bool ShowToolTips()
Should we show tooltips?
virtual void SetValue(const string &val)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void CreateControls()
Creates the controls and sizers.
bool Create(wxWindow *parent, wxWindowID id=ID_CSINGLEASSEMBLYPROGRAMPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
#define _(proto)
Definition: ct_nlmzip_i.h:78
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 void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
Definition: ncbistr.cpp:3197
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
Definition: ncbistr.cpp:2887
END_EVENT_TABLE()
static int version
Definition: mdb_load.c:29
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 Sat Dec 02 09:21:10 2023 by modify_doxy.py rev. 669887