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

Go to the SVN repository for this file.

1 /* $Id: proceedingschapter_panel.cpp 47479 2023-05-02 13:24:02Z ucko $
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>
36 #include <objects/biblio/Title.hpp>
37 #include <objects/general/Date.hpp>
39 
42 
43 ////@begin includes
44 ////@end includes
45 ////@begin includes
46 ////@end includes
47 
49 
50 #include <wx/sizer.h>
51 #include <wx/bitmap.h>
52 #include <wx/icon.h>
53 #include <wx/stattext.h>
54 #include <wx/textctrl.h>
55 
58 
59 ////@begin XPM images
60 ////@end XPM images
61 
62 
63 /*
64  * CProceedingsChapterPanel type definition
65  */
66 
67 IMPLEMENT_DYNAMIC_CLASS( CProceedingsChapterPanel, wxPanel )
68 
69 
70 /*
71  * CProceedingsChapterPanel event table definition
72  */
73 
74 BEGIN_EVENT_TABLE( CProceedingsChapterPanel, wxPanel )
75 
76 ////@begin CProceedingsChapterPanel event table entries
77 ////@end CProceedingsChapterPanel event table entries
78 
80 
81 
82 /*
83  * CProceedingsChapterPanel constructors
84  */
85 
87 {
88  Init();
89 }
90 
92  wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) :
93  m_Object(0)
94 {
95  Init();
96  m_Object = dynamic_cast<CCit_art*>(&object);
97  const CCit_art& art = dynamic_cast<const CCit_art&>(*m_Object);
98  m_EditedArt.Reset((CSerialObject*)CCit_art::GetTypeInfo()->Create());
99  m_EditedArt->Assign(art);
100  Create(parent, id, pos, size, style);
101 }
102 
103 
104 /*
105  * CProceedingsChapterPanel creator
106  */
107 
108 bool CProceedingsChapterPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
109 {
110 ////@begin CProceedingsChapterPanel creation
111  SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
112  wxPanel::Create( parent, id, pos, size, style );
113 
114  CreateControls();
115  if (GetSizer())
116  {
117  GetSizer()->SetSizeHints(this);
118  }
119  Centre();
120 ////@end CProceedingsChapterPanel creation
121  return true;
122 }
123 
124 
125 /*
126  * CProceedingsChapterPanel destructor
127  */
128 
130 {
131 ////@begin CProceedingsChapterPanel destruction
132 ////@end CProceedingsChapterPanel destruction
133 }
134 
135 
136 /*
137  * Member initialisation
138  */
139 
141 {
142 ////@begin CProceedingsChapterPanel member initialisation
143 ////@end CProceedingsChapterPanel member initialisation
144 }
145 
146 
147 /*
148  * Control creation for CProceedingsChapterPanel
149  */
150 
152 {
153 ////@begin CProceedingsChapterPanel content construction
154  CProceedingsChapterPanel* itemPanel1 = this;
155 
156  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
157  itemPanel1->SetSizer(itemBoxSizer2);
158 
159  wxFlexGridSizer* itemFlexGridSizer3 = new wxFlexGridSizer(0, 2, 0, 0);
160  itemBoxSizer2->Add(itemFlexGridSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
161 
162  wxStaticText* itemStaticText4 = new wxStaticText( itemPanel1, wxID_STATIC, _("Abstract Title"), wxDefaultPosition, wxDefaultSize, 0 );
163  itemFlexGridSizer3->Add(itemStaticText4, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
164 
165  wxTextCtrl* itemTextCtrl5 = new wxTextCtrl( itemPanel1, ID_PROCEEDINGSCHAPTER_ABSTRACT_TITLE, wxEmptyString, wxDefaultPosition, wxSize(400, -1), wxTE_MULTILINE );
166  itemFlexGridSizer3->Add(itemTextCtrl5, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
167 
168  wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("Proceedings Title"), wxDefaultPosition, wxDefaultSize, 0 );
169  itemFlexGridSizer3->Add(itemStaticText6, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
170 
171  wxTextCtrl* itemTextCtrl7 = new wxTextCtrl( itemPanel1, ID_PROCEEDINGSCHAPTER_PROCEEDINGS_TITLE, wxEmptyString, wxDefaultPosition, wxSize(400, -1), wxTE_MULTILINE );
172  itemFlexGridSizer3->Add(itemTextCtrl7, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
173 
174  wxStaticText* itemStaticText8 = new wxStaticText( itemPanel1, wxID_STATIC, _("Pages"), wxDefaultPosition, wxDefaultSize, 0 );
175  itemFlexGridSizer3->Add(itemStaticText8, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
176 
177  wxTextCtrl* itemTextCtrl9 = new wxTextCtrl( itemPanel1, ID_PROCEEDINGSCHAPTER_PAGES, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
178  itemFlexGridSizer3->Add(itemTextCtrl9, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
179 
180  wxStaticText* itemStaticText10 = new wxStaticText( itemPanel1, wxID_STATIC, _("Publication Year"), wxDefaultPosition, wxDefaultSize, 0 );
181  itemFlexGridSizer3->Add(itemStaticText10, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
182 
183  wxTextCtrl* itemTextCtrl11 = new wxTextCtrl( itemPanel1, ID_PROCEEDINGSCHAPTER_PUB_YEAR, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
184  itemFlexGridSizer3->Add(itemTextCtrl11, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
185 
186  wxStaticText* itemStaticText12 = new wxStaticText( itemPanel1, wxID_STATIC, _("Copyright Year"), wxDefaultPosition, wxDefaultSize, 0 );
187  itemFlexGridSizer3->Add(itemStaticText12, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
188 
189  wxTextCtrl* itemTextCtrl13 = new wxTextCtrl( itemPanel1, ID_PROCEEDINGSCHAPTER_COPY_YEAR, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
190  itemFlexGridSizer3->Add(itemTextCtrl13, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
191 
192 ////@end CProceedingsChapterPanel content construction
193 
194  CCit_art& art = dynamic_cast<CCit_art&>(*m_EditedArt);
195  CCit_proc& proc = art.SetFrom().SetProc();
196  CCit_book& book = proc.SetBook();
197  CImprint& imprint = book.SetImp();
198  itemTextCtrl5->SetValidator( CSerialTitleValidator(art.SetTitle(), CTitle::C_E::e_Name, "Abstract Title") );
199  itemTextCtrl7->SetValidator( CSerialTitleValidator(book.SetTitle(), CTitle::C_E::e_Name, "Proceedings Title") );
200  itemTextCtrl9->SetValidator( CSerialTextValidator(imprint, "pages") );
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  itemTextCtrl11->SetValidator( CNumberOrBlankValidator(&m_PubYear));
212  itemTextCtrl13->SetValidator( CNumberOrBlankValidator(&m_CopyrightYear));
213 
214 }
215 
216 
218 {
219  if (!wxPanel::TransferDataToWindow())
220  return false;
221  CCit_art& art = dynamic_cast<CCit_art&>(*m_EditedArt);
222  CImprint& imprint = art.SetFrom().SetProc().SetBook().SetImp();
223  if (imprint.IsSetDate() && imprint.GetDate().IsStd() && imprint.GetDate().GetStd().IsSetYear()) {
224  m_PubYear = imprint.GetDate().GetStd().GetYear();
225  } else {
226  m_PubYear = 0;
227  }
228  if (imprint.IsSetCprt() && imprint.GetCprt().IsStd() && imprint.GetCprt().GetStd().IsSetYear()) {
229  m_CopyrightYear = imprint.GetCprt().GetStd().GetYear();
230  } else {
231  m_CopyrightYear = 0;
232  }
233  return true;
234 }
235 
236 
238 {
239  if (!wxPanel::TransferDataFromWindow())
240  return false;
241  CCit_art& art = dynamic_cast<CCit_art&>(*m_EditedArt);
242  CImprint& imprint = art.SetFrom().SetProc().SetBook().SetImp();
243  if (m_PubYear > 0) {
244  imprint.SetDate().SetStd().SetYear(static_cast<CDate_std::TYear>(m_PubYear));
245  } else {
246  imprint.ResetDate();
247  }
248  if (m_CopyrightYear > 0) {
249  imprint.SetCprt().SetStd().SetYear(static_cast<CDate_std::TYear>(m_CopyrightYear));
250  } else {
251  imprint.ResetCprt();
252  }
253  return true;
254 }
255 
256 
257 /*
258  * Should we show tooltips?
259  */
260 
262 {
263  return true;
264 }
265 
266 /*
267  * Get bitmap resources
268  */
269 
270 wxBitmap CProceedingsChapterPanel::GetBitmapResource( const wxString& name )
271 {
272  // Bitmap retrieval
273 ////@begin CProceedingsChapterPanel bitmap retrieval
274  wxUnusedVar(name);
275  return wxNullBitmap;
276 ////@end CProceedingsChapterPanel bitmap retrieval
277 }
278 
279 /*
280  * Get icon resources
281  */
282 
283 wxIcon CProceedingsChapterPanel::GetIconResource( const wxString& name )
284 {
285  // Icon retrieval
286 ////@begin CProceedingsChapterPanel icon retrieval
287  wxUnusedVar(name);
288  return wxNullIcon;
289 ////@end CProceedingsChapterPanel icon retrieval
290 }
User-defined methods of the data storage class.
CImprint –.
Definition: Imprint.hpp:66
void Init()
Initialises member variables.
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
bool Create(wxWindow *parent, wxWindowID id=10072, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void CreateControls()
Creates the controls and sizers.
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
static const char * proc
Definition: stats.c:21
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
const TCprt & GetCprt(void) const
Get the Cprt member data.
Definition: Imprint_.hpp:967
void SetTitle(TTitle &value)
Assign a value to Title data member.
Definition: Cit_art_.cpp:210
void SetCprt(TCprt &value)
Assign a value to Cprt data member.
Definition: Imprint_.cpp:124
void SetTitle(TTitle &value)
Assign a value to Title data member.
Definition: Cit_book_.cpp:62
void SetFrom(TFrom &value)
Assign a value to From data member.
Definition: Cit_art_.cpp:248
void ResetDate(void)
Reset Date data member.
Definition: Imprint_.cpp:64
void ResetCprt(void)
Reset Cprt data member.
Definition: Imprint_.cpp:119
void SetImp(TImp &value)
Assign a value to Imp data member.
Definition: Cit_book_.cpp:107
void SetDate(TDate &value)
Assign a value to Date data member.
Definition: Imprint_.cpp:73
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_PROCEEDINGSCHAPTER_COPY_YEAR
#define ID_PROCEEDINGSCHAPTER_ABSTRACT_TITLE
#define ID_PROCEEDINGSCHAPTER_PUB_YEAR
#define ID_PROCEEDINGSCHAPTER_PROCEEDINGS_TITLE
#define ID_PROCEEDINGSCHAPTER_PAGES
Modified on Sun Apr 14 05:28:04 2024 by modify_doxy.py rev. 669887