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

Go to the SVN repository for this file.

1 /* $Id: proceedings_panel.cpp 47464 2023-04-20 00:19:10Z evgeniev $
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>
35 #include <objects/biblio/Title.hpp>
36 #include <objects/general/Date.hpp>
38 
41 
42 ////@begin includes
43 ////@end includes
44 ////@begin includes
45 ////@end includes
46 
47 #include "proceedings_panel.hpp"
48 
49 #include <wx/sizer.h>
50 #include <wx/bitmap.h>
51 #include <wx/icon.h>
52 #include <wx/stattext.h>
53 #include <wx/textctrl.h>
54 
57 
58 ////@begin XPM images
59 ////@end XPM images
60 
61 
62 /*
63  * CProceedingsPanel type definition
64  */
65 
66 IMPLEMENT_DYNAMIC_CLASS( CProceedingsPanel, wxPanel )
67 
68 
69 /*
70  * CProceedingsPanel event table definition
71  */
72 
73 BEGIN_EVENT_TABLE( CProceedingsPanel, wxPanel )
74 
75 ////@begin CProceedingsPanel event table entries
76 ////@end CProceedingsPanel event table entries
77 
79 
80 
81 /*
82  * CProceedingsPanel constructors
83  */
84 
86 {
87  Init();
88 }
89 
91  wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) :
92  m_Book(book)
93 {
94  Init();
95  Create(parent, id, pos, size, style);
96 }
97 
98 
99 /*
100  * CProceedingsPanel creator
101  */
102 
103 bool CProceedingsPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
104 {
105 ////@begin CProceedingsPanel 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 CProceedingsPanel creation
116  return true;
117 }
118 
119 
120 /*
121  * CProceedingsPanel destructor
122  */
123 
125 {
126 ////@begin CProceedingsPanel destruction
127 ////@end CProceedingsPanel destruction
128 }
129 
130 
131 /*
132  * Member initialisation
133  */
134 
136 {
137 ////@begin CProceedingsPanel member initialisation
138 ////@end CProceedingsPanel member initialisation
139 }
140 
141 
142 /*
143  * Control creation for CProceedingsPanel
144  */
145 
147 {
148 ////@begin CProceedingsPanel content construction
149  CProceedingsPanel* 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, _("Proceedings Title"), wxDefaultPosition, wxDefaultSize, 0 );
158  itemFlexGridSizer3->Add(itemStaticText4, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
159 
160  wxTextCtrl* itemTextCtrl5 = new wxTextCtrl( itemPanel1, ID_PROCEEDINGS_TITLE, wxEmptyString, wxDefaultPosition, wxSize(400, -1), wxTE_MULTILINE );
161  itemFlexGridSizer3->Add(itemTextCtrl5, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
162 
163  wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("Publication Year"), wxDefaultPosition, wxDefaultSize, 0 );
164  itemFlexGridSizer3->Add(itemStaticText6, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
165 
166  wxTextCtrl* itemTextCtrl7 = new wxTextCtrl( itemPanel1, ID_PROCEEDINGS_PUB_YEAR, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
167  itemFlexGridSizer3->Add(itemTextCtrl7, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
168 
169  wxStaticText* itemStaticText8 = new wxStaticText( itemPanel1, wxID_STATIC, _("Copyright Year"), wxDefaultPosition, wxDefaultSize, 0 );
170  itemFlexGridSizer3->Add(itemStaticText8, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
171 
172  wxTextCtrl* itemTextCtrl9 = new wxTextCtrl( itemPanel1, ID_PROCEEDINGS_COPY_YEAR, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
173  itemFlexGridSizer3->Add(itemTextCtrl9, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
174 
175 ////@end CProceedingsPanel content construction
176 
177  CImprint& imprint = m_Book->SetImp();
178  if (imprint.IsSetDate() && imprint.GetDate().IsStd() && imprint.GetDate().GetStd().IsSetYear()) {
179  m_PubYear = imprint.GetDate().GetStd().GetYear();
180  } else {
181  m_PubYear = 0;
182  }
183  if (imprint.IsSetCprt() && imprint.GetCprt().IsStd() && imprint.GetCprt().GetStd().IsSetYear()) {
184  m_CopyrightYear = imprint.GetCprt().GetStd().GetYear();
185  } else {
186  m_CopyrightYear = 0;
187  }
188  CSerialObject& title_object = m_Book->SetTitle();
189  itemTextCtrl5->SetValidator( CSerialTitleValidator(title_object, CTitle::C_E::e_Name, "Proceedings Title") );
190  itemTextCtrl7->SetValidator( CNumberOrBlankValidator(&m_PubYear));
191  itemTextCtrl9->SetValidator( CNumberOrBlankValidator(&m_CopyrightYear));
192 
193 }
194 
195 
197 {
198  if (!wxPanel::TransferDataToWindow())
199  return false;
200  CImprint& imprint = m_Book->SetImp();
201  if (imprint.IsSetDate() && imprint.GetDate().IsStd() && imprint.GetDate().GetStd().IsSetYear()) {
202  m_PubYear = imprint.GetDate().GetStd().GetYear();
203  } else {
204  m_PubYear = 0;
205  }
206  if (imprint.IsSetCprt() && imprint.GetCprt().IsStd() && imprint.GetCprt().GetStd().IsSetYear()) {
207  m_CopyrightYear = imprint.GetCprt().GetStd().GetYear();
208  } else {
209  m_CopyrightYear = 0;
210  }
211  return true;
212 }
213 
214 
216 {
217  if (!wxPanel::TransferDataFromWindow())
218  return false;
219  if (m_PubYear > 0) {
220  m_Book->SetImp().SetDate().SetStd().SetYear(static_cast<CDate_std::TYear>(m_PubYear));
221  } else {
222  m_Book->SetImp().ResetDate();
223  }
224  if (m_CopyrightYear > 0) {
225  m_Book->SetImp().SetCprt().SetStd().SetYear(static_cast<CDate_std::TYear>(m_CopyrightYear));
226  } else {
227  m_Book->SetImp().ResetCprt();
228  }
229  return true;
230 }
231 
232 
233 /*
234  * Should we show tooltips?
235  */
236 
238 {
239  return true;
240 }
241 
242 /*
243  * Get bitmap resources
244  */
245 
246 wxBitmap CProceedingsPanel::GetBitmapResource( const wxString& name )
247 {
248  // Bitmap retrieval
249 ////@begin CProceedingsPanel bitmap retrieval
250  wxUnusedVar(name);
251  return wxNullBitmap;
252 ////@end CProceedingsPanel bitmap retrieval
253 }
254 
255 /*
256  * Get icon resources
257  */
258 
259 wxIcon CProceedingsPanel::GetIconResource( const wxString& name )
260 {
261  // Icon retrieval
262 ////@begin CProceedingsPanel icon retrieval
263  wxUnusedVar(name);
264  return wxNullIcon;
265 ////@end CProceedingsPanel icon retrieval
266 }
User-defined methods of the data storage class.
CImprint –.
Definition: Imprint.hpp:66
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void CreateControls()
Creates the controls and sizers.
CProceedingsPanel()
Constructors.
bool Create(wxWindow *parent, wxWindowID id=10072, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
CRef< objects::CCit_book > m_Book
virtual bool TransferDataToWindow()
~CProceedingsPanel()
Destructor.
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void Init()
Initialises member variables.
virtual bool TransferDataFromWindow()
static bool ShowToolTips()
Should we show tooltips?
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
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
const TCprt & GetCprt(void) const
Get the Cprt member data.
Definition: Imprint_.hpp:967
bool IsSetDate(void) const
date of publication Check if a value has been assigned to Date data member.
Definition: Imprint_.hpp:716
const TDate & GetDate(void) const
Get the Date member data.
Definition: Imprint_.hpp:728
bool IsSetCprt(void) const
copyright date, " " " Check if a value has been assigned to Cprt data member.
Definition: Imprint_.hpp:955
@ e_Name
Title, Anal,Coll,Mono AJB.
Definition: Title_.hpp:111
bool IsSetYear(void) const
full year (including 1900) Check if a value has been assigned to Year data member.
Definition: Date_std_.hpp:407
bool IsStd(void) const
Check if variant Std is selected.
Definition: Date_.hpp:320
TYear GetYear(void) const
Get the Year member data.
Definition: Date_std_.hpp:426
const TStd & GetStd(void) const
Get the variant data.
Definition: Date_.cpp:109
END_EVENT_TABLE()
const struct ncbi::grid::netcache::search::fields::SIZE size
USING_SCOPE(objects)
#define ID_PROCEEDINGS_COPY_YEAR
#define ID_PROCEEDINGS_PUB_YEAR
#define ID_PROCEEDINGS_TITLE
Modified on Fri Sep 20 14:57:29 2024 by modify_doxy.py rev. 669887