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

Go to the SVN repository for this file.

1 /* $Id: unpublishedref_panel.cpp 43202 2019-05-28 18:05:59Z 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: Andrea Asztalos
27 *
28 */
29 
30 #include <ncbi_pch.hpp>
33 
34 #include <wx/sizer.h>
35 #include <wx/textctrl.h>
36 #include <wx/stattext.h>
37 #include <wx/icon.h>
38 
40 
41 /*
42  * CUnpublishedRefPanel type definition
43  */
44 
45 IMPLEMENT_DYNAMIC_CLASS( CUnpublishedRefPanel, wxPanel )
46 
47 
48 /*
49  * CUnpublishedRefPanel event table definition
50  */
51 
52 BEGIN_EVENT_TABLE( CUnpublishedRefPanel, wxPanel )
53 
54 ////@begin CUnpublishedRefPanel event table entries
55 ////@end CUnpublishedRefPanel event table entries
56 
58 
59 
60 /*
61  * CUnpublishedRefPanel constructors
62  */
63 
65 {
66  Init();
67 }
68 
69 CUnpublishedRefPanel::CUnpublishedRefPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
70 {
71  Init();
72  Create(parent, id, pos, size, style);
73 }
74 
75 
76 /*
77  * CUnpublishedRefPanel creator
78  */
79 
80 bool CUnpublishedRefPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
81 {
82 ////@begin CUnpublishedRefPanel creation
83  SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
84  wxPanel::Create( parent, id, pos, size, style );
85 
87  if (GetSizer())
88  {
89  GetSizer()->SetSizeHints(this);
90  }
91  Centre();
92 ////@end CUnpublishedRefPanel creation
93  return true;
94 }
95 
96 
97 /*
98  * CUnpublishedRefPanel destructor
99  */
100 
102 {
103 ////@begin CUnpublishedRefPanel destruction
104 ////@end CUnpublishedRefPanel destruction
105 }
106 
107 
108 /*
109  * Member initialisation
110  */
111 
113 {
114 ////@begin CUnpublishedRefPanel member initialisation
116 ////@end CUnpublishedRefPanel member initialisation
117 }
118 
119 
120 /*
121  * Control creation for CUnpublishedRefPanel
122  */
123 
125 {
126 ////@begin CUnpublishedRefPanel content construction
127  CUnpublishedRefPanel* itemPanel1 = this;
128 
129  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
130  itemPanel1->SetSizer(itemBoxSizer2);
131 
132  wxStaticText* itemStaticText1 = new wxStaticText( itemPanel1, wxID_STATIC, _("Reference title*"), wxDefaultPosition, wxDefaultSize, 0 );
133  itemBoxSizer2->Add(itemStaticText1, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
134 
135  m_ReferenceTitle = new wxTextCtrl( itemPanel1, ID_REFTITLETXTCTRL, wxEmptyString, wxDefaultPosition, wxSize(200, -1), 0 );
136  itemBoxSizer2->Add(m_ReferenceTitle, 0, wxALIGN_LEFT|wxALL, 5);
137 
138 ////@end CUnpublishedRefPanel content construction
139 }
140 
141 
142 /*
143  * Should we show tooltips?
144  */
145 
147 {
148  return true;
149 }
150 
151 /*
152  * Get bitmap resources
153  */
154 
155 wxBitmap CUnpublishedRefPanel::GetBitmapResource( const wxString& name )
156 {
157  // Bitmap retrieval
158 ////@begin CUnpublishedRefPanel bitmap retrieval
159  wxUnusedVar(name);
160  return wxNullBitmap;
161 ////@end CUnpublishedRefPanel bitmap retrieval
162 }
163 
164 /*
165  * Get icon resources
166  */
167 
168 wxIcon CUnpublishedRefPanel::GetIconResource( const wxString& name )
169 {
170  // Icon retrieval
171 ////@begin CUnpublishedRefPanel icon retrieval
172  wxUnusedVar(name);
173  return wxNullIcon;
174 ////@end CUnpublishedRefPanel icon retrieval
175 }
176 
177 
178 void CUnpublishedRefPanel::SetCitGen(const objects::CCit_gen& gen)
179 {
180  if (gen.IsSetTitle()) {
181  m_ReferenceTitle->SetValue(ToWxString(gen.GetTitle()));
182  } else {
183  m_ReferenceTitle->SetValue(wxT(""));
184  }
185 }
186 
187 
188 void CUnpublishedRefPanel::UpdateCitGen(objects::CCit_gen& gen)
189 {
190  if (m_ReferenceTitle->IsEmpty()) {
191  gen.ResetTitle();
192  } else {
193  gen.SetTitle(ToStdString(m_ReferenceTitle->GetValue()));
194  }
195 }
196 
198 {
199  if (m_ReferenceTitle->GetValue().IsEmpty())
200  text += "Reference Title\n";
201 }
202 
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void CreateControls()
Creates the controls and sizers.
static bool ShowToolTips()
Should we show tooltips?
void UpdateCitGen(objects::CCit_gen &gen)
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void ReportMissingFields(string &text)
void SetCitGen(const objects::CCit_gen &gen)
void Init()
Initialises member variables.
bool Create(wxWindow *parent, wxWindowID id=ID_CUNPUBLISHEDREFPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
CUnpublishedRefPanel()
Constructors.
#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
END_EVENT_TABLE()
static void text(MDB_val *v)
Definition: mdb_dump.c:62
#define wxT(x)
Definition: muParser.cpp:41
const struct ncbi::grid::netcache::search::fields::SIZE size
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
string ToStdString(const wxString &s)
Definition: wx_utils.hpp:161
Modified on Thu Feb 29 12:17:19 2024 by modify_doxy.py rev. 669887