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

Go to the SVN repository for this file.

1 /* $Id: patent_panel.cpp 35726 2016-06-15 18:09:45Z asztalos $
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>
33 
35 #include <objects/general/Date.hpp>
36 
38 
39 ////@begin includes
40 ////@end includes
41 
42 #include "patent_panel.hpp"
44 
45 #include <wx/sizer.h>
46 #include <wx/bitmap.h>
47 #include <wx/icon.h>
48 #include <wx/stattext.h>
49 #include <wx/textctrl.h>
50 
53 
54 ////@begin XPM images
55 ////@end XPM images
56 
57 
58 /*
59  * CPatentPanel type definition
60  */
61 
62 IMPLEMENT_DYNAMIC_CLASS( CPatentPanel, wxPanel )
63 
64 
65 /*
66  * CPatentPanel event table definition
67  */
68 
69 BEGIN_EVENT_TABLE( CPatentPanel, wxPanel )
70 
71 ////@begin CPatentPanel event table entries
72 ////@end CPatentPanel event table entries
73 
75 
76 
77 /*
78  * CPatentPanel constructors
79  */
80 
82 {
83  Init();
84 }
85 
86 CPatentPanel::CPatentPanel( wxWindow* parent, CSerialObject& object,
87  wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) :
88  m_Object(0)
89 {
90  Init();
91  m_Object = dynamic_cast<CCit_pat*>(&object);
92  const CCit_pat& patent = dynamic_cast<const CCit_pat&>(*m_Object);
93  m_EditedPatent.Reset((CSerialObject*)CCit_pat::GetTypeInfo()->Create());
94  m_EditedPatent->Assign(patent);
95  Create(parent, id, pos, size, style);
96 }
97 
98 
99 /*
100  * CPatentPanel creator
101  */
102 
103 bool CPatentPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
104 {
105 ////@begin CPatentPanel creation
106  SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
107  wxPanel::Create( parent, id, pos, size, style );
108 
109  CreateControls();
110  if (GetSizer())
111  {
112  GetSizer()->SetSizeHints(this);
113  }
114  Centre();
115 ////@end CPatentPanel creation
116  return true;
117 }
118 
119 
120 /*
121  * CPatentPanel destructor
122  */
123 
125 {
126 ////@begin CPatentPanel destruction
127 ////@end CPatentPanel destruction
128 }
129 
130 
131 /*
132  * Member initialisation
133  */
134 
136 {
137 ////@begin CPatentPanel member initialisation
138 ////@end CPatentPanel member initialisation
139 }
140 
141 
142 /*
143  * Control creation for CPatentPanel
144  */
145 
147 {
148 ////@begin CPatentPanel content construction
149  CPatentPanel* itemPanel1 = this;
150 
151  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
152  itemPanel1->SetSizer(itemBoxSizer2);
153 
154  wxFlexGridSizer* itemFlexGridSizer3 = new wxFlexGridSizer(0, 2, 0, 0);
155  itemBoxSizer2->Add(itemFlexGridSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
156 
157  wxStaticText* itemStaticText4 = new wxStaticText( itemPanel1, wxID_STATIC, _("Patent Title"), wxDefaultPosition, wxDefaultSize, 0 );
158  itemFlexGridSizer3->Add(itemStaticText4, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
159 
160  wxTextCtrl* itemTextCtrl5 = new wxTextCtrl( itemPanel1, ID_PATENT_TITLE, wxEmptyString, wxDefaultPosition, wxSize(400, 85), wxTE_MULTILINE );
161  itemFlexGridSizer3->Add(itemTextCtrl5, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
162 
163  wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("Abstract"), wxDefaultPosition, wxDefaultSize, 0 );
164  itemFlexGridSizer3->Add(itemStaticText6, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
165 
166  wxTextCtrl* itemTextCtrl7 = new wxTextCtrl( itemPanel1, ID_PATENT_ABSTRACT, wxEmptyString, wxDefaultPosition, wxSize(400, 100), wxTE_MULTILINE );
167  itemFlexGridSizer3->Add(itemTextCtrl7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
168 
169  wxStaticText* itemStaticText8 = new wxStaticText( itemPanel1, wxID_STATIC, _("Country"), wxDefaultPosition, wxDefaultSize, 0 );
170  itemFlexGridSizer3->Add(itemStaticText8, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
171 
172  wxTextCtrl* itemTextCtrl9 = new wxTextCtrl( itemPanel1, ID_PATENT_COUNTRY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
173  itemFlexGridSizer3->Add(itemTextCtrl9, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
174 
175  wxStaticText* itemStaticText10 = new wxStaticText( itemPanel1, wxID_STATIC, _("Document Type"), wxDefaultPosition, wxDefaultSize, 0 );
176  itemFlexGridSizer3->Add(itemStaticText10, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
177 
178  wxTextCtrl* itemTextCtrl11 = new wxTextCtrl( itemPanel1, ID_PATENT_DOCTYPE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
179  itemFlexGridSizer3->Add(itemTextCtrl11, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
180 
181  wxStaticText* itemStaticText12 = new wxStaticText( itemPanel1, wxID_STATIC, _("Patent Number"), wxDefaultPosition, wxDefaultSize, 0 );
182  itemFlexGridSizer3->Add(itemStaticText12, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
183 
184  wxTextCtrl* itemTextCtrl13 = new wxTextCtrl( itemPanel1, ID_PATENT_DOCNUM, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
185  itemFlexGridSizer3->Add(itemTextCtrl13, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
186 
187  wxStaticText* itemStaticText14 = new wxStaticText( itemPanel1, wxID_STATIC, _("Issue Date"), wxDefaultPosition, wxDefaultSize, 0 );
188  itemFlexGridSizer3->Add(itemStaticText14, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
189 
190  wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxHORIZONTAL);
191  itemFlexGridSizer3->Add(itemBoxSizer15, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
192 
193  wxStaticText* itemStaticText16 = new wxStaticText( itemPanel1, wxID_STATIC, _("Application Number"), wxDefaultPosition, wxDefaultSize, 0 );
194  itemFlexGridSizer3->Add(itemStaticText16, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
195 
196  wxTextCtrl* itemTextCtrl17 = new wxTextCtrl( itemPanel1, ID_PATENT_APPNUM, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
197  itemFlexGridSizer3->Add(itemTextCtrl17, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
198 
199  wxStaticText* itemStaticText18 = new wxStaticText( itemPanel1, wxID_STATIC, _("Application Date"), wxDefaultPosition, wxDefaultSize, 0 );
200  itemFlexGridSizer3->Add(itemStaticText18, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
201 
202  wxBoxSizer* itemBoxSizer19 = new wxBoxSizer(wxHORIZONTAL);
203  itemFlexGridSizer3->Add(itemBoxSizer19, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
204 
205 ////@end CPatentPanel content construction
206  CCit_pat& patent = dynamic_cast<CCit_pat&>(*m_EditedPatent);
207  CRef<objects::CDate> issuedate(&(patent.SetDate_issue()));
208  m_issuedate_ctrl = new CFlexibleDatePanel(itemPanel1, issuedate);
209  itemBoxSizer15->Add(m_issuedate_ctrl);
210  CRef<objects::CDate> appdate(&(patent.SetApp_date()));
211  m_appdate_ctrl = new CFlexibleDatePanel(itemPanel1, appdate);
212  itemBoxSizer19->Add(m_appdate_ctrl);
213 
214 
215  itemTextCtrl5->SetValidator( CSerialTextValidator(patent, "title") );
216  itemTextCtrl7->SetValidator( CSerialTextValidator(patent, "abstract") );
217  itemTextCtrl9->SetValidator( CSerialTextValidator(patent, "country") );
218  itemTextCtrl11->SetValidator( CSerialTextValidator(patent, "doc-type") );
219  itemTextCtrl13->SetValidator( CSerialTextValidator(patent, "number") );
220  itemTextCtrl17->SetValidator( CSerialTextValidator(patent, "app-number") );
221 }
222 
224 {
225  if (!wxPanel::TransferDataFromWindow()) {
226  return false;
227  }
228  m_issuedate_ctrl->TransferDataFromWindow();
229  m_appdate_ctrl->TransferDataFromWindow();
230  return true;
231 }
232 
234 {
235  if (!wxPanel::TransferDataToWindow()) {
236  return false;
237  }
238  m_issuedate_ctrl->TransferDataToWindow();
239  m_appdate_ctrl->TransferDataToWindow();
240  return true;
241 }
242 
244 {
245  const CCit_pat& pat = dynamic_cast<const CCit_pat&>(*m_EditedPatent);
246 
247  CRef<CCit_pat> ret(new CCit_pat());
248  ret->Assign(pat);
249  return ret;
250 }
251 
252 
253 /*
254  * Should we show tooltips?
255  */
256 
258 {
259  return true;
260 }
261 
262 /*
263  * Get bitmap resources
264  */
265 
266 wxBitmap CPatentPanel::GetBitmapResource( const wxString& name )
267 {
268  // Bitmap retrieval
269 ////@begin CPatentPanel bitmap retrieval
270  wxUnusedVar(name);
271  return wxNullBitmap;
272 ////@end CPatentPanel bitmap retrieval
273 }
274 
275 /*
276  * Get icon resources
277  */
278 
279 wxIcon CPatentPanel::GetIconResource( const wxString& name )
280 {
281  // Icon retrieval
282 ////@begin CPatentPanel icon retrieval
283  wxUnusedVar(name);
284  return wxNullIcon;
285 ////@end CPatentPanel icon retrieval
286 }
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
CSerialObject * m_Object
void CreateControls()
Creates the controls and sizers.
virtual bool TransferDataFromWindow()
~CPatentPanel()
Destructor.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
static bool ShowToolTips()
Should we show tooltips?
bool Create(wxWindow *parent, wxWindowID id=10000, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
wxWindow * m_issuedate_ctrl
virtual bool TransferDataToWindow()
CRef< objects::CCit_pat > GetCit_pat(void) const
wxWindow * m_appdate_ctrl
CPatentPanel()
Constructors.
void Init()
Initialises member variables.
CRef< CSerialObject > m_EditedPatent
Base class for all serializable objects.
Definition: serialbase.hpp:150
#define _(proto)
Definition: ct_nlmzip_i.h:78
static void Init(void)
Definition: cursor6.c:76
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
void SetApp_date(TApp_date &value)
Assign a value to App_date data member.
Definition: Cit_pat_.cpp:125
void SetDate_issue(TDate_issue &value)
Assign a value to Date_issue data member.
Definition: Cit_pat_.cpp:96
END_EVENT_TABLE()
const struct ncbi::grid::netcache::search::fields::SIZE size
USING_SCOPE(objects)
#define ID_PATENT_DOCNUM
#define ID_PATENT_TITLE
#define ID_PATENT_APPNUM
#define ID_PATENT_DOCTYPE
#define ID_PATENT_COUNTRY
#define ID_PATENT_ABSTRACT
Modified on Fri Sep 20 14:58:23 2024 by modify_doxy.py rev. 669887