NCBI C++ ToolKit
authornames_panel.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef GUI_WIDGETS_EDIT___AUTHORNAMES_PANEL__HPP
2 #define GUI_WIDGETS_EDIT___AUTHORNAMES_PANEL__HPP
3 
4 /* $Id: authornames_panel.hpp 46622 2021-08-06 20:19:47Z asztalos $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Colleen Bollin
30  */
31 
32 #include <corelib/ncbistd.hpp>
34 #include <objmgr/scope.hpp>
40 
41 #include "wx/wxprec.h"
42 
43 #ifndef WX_PRECOMP
44 #include "wx/wx.h"
45 #endif
46 
48 #include <wx/panel.h>
49 #include <wx/hyperlink.h>
50 
51 /*!
52  * Includes
53  */
54 
55 ////@begin includes
56 #include "wx/hyperlink.h"
57 #include "wx/statline.h"
58 ////@end includes
59 
60 /*!
61  * Forward declarations
62  */
63 
64 ////@begin forward declarations
65 class wxBoxSizer;
66 ////@end forward declarations
67 
68 class wxScrolledWindow;
69 
71 
72 class CSerialObject;
73 
74 /*!
75  * Control identifiers
76  */
77 
78 
79 ////@begin control identifiers
80 #define ID_DELETELINK 7000
81 #define ID_REPLACE_ALL_AUTHORS 7001
82 #define ID_REPLACE_SAME_AUTHORS 7002
83 #define SYMBOL_CAUTHORNAMESPANEL_STYLE wxTAB_TRAVERSAL
84 #define SYMBOL_CAUTHORNAMESPANEL_TITLE _("Author Names Panel")
85 #define SYMBOL_CAUTHORNAMESPANEL_IDNAME ID_AUTHORNAMES
86 #define SYMBOL_CAUTHORNAMESPANEL_SIZE wxSize(400, 300)
87 #define SYMBOL_CAUTHORNAMESPANEL_POSITION wxDefaultPosition
88 ////@end control identifiers
89 
90 
91 /*!
92  * CAuthorNamesPanel class declaration
93  */
94 
96 {
97  DECLARE_DYNAMIC_CLASS( CAuthorNamesPanel )
98  DECLARE_EVENT_TABLE()
99 
100 public:
101  /// Constructors
103  CAuthorNamesPanel( wxWindow* parent, CSerialObject& object, bool show_replace_buttons,
104  wxWindowID id = SYMBOL_CAUTHORNAMESPANEL_IDNAME,
105  const wxPoint& pos = SYMBOL_CAUTHORNAMESPANEL_POSITION,
106  const wxSize& size = SYMBOL_CAUTHORNAMESPANEL_SIZE,
107  long style = SYMBOL_CAUTHORNAMESPANEL_STYLE );
108 
109  /// Creation
110  bool Create( wxWindow* parent,
111  wxWindowID id = SYMBOL_CAUTHORNAMESPANEL_IDNAME,
112  const wxPoint& pos = SYMBOL_CAUTHORNAMESPANEL_POSITION,
113  const wxSize& size = SYMBOL_CAUTHORNAMESPANEL_SIZE,
114  long style = SYMBOL_CAUTHORNAMESPANEL_STYLE );
115 
116  /// Destructor
118 
119  /// Initialises member variables
120  void Init();
121 
122  /// Creates the controls and sizers
123  void CreateControls();
124 
125  virtual bool TransferDataToWindow();
126  virtual bool TransferDataFromWindow();
127  bool x_GetAuthors(bool keep_blank = false);
128  void PopulateAuthors (objects::CAuth_list& auth_list);
129 
130  /// @name CAuthorNamesContainer implementation
131  /// @{
132  virtual void AddLastAuthor (wxWindow* link);
133  virtual void InsertAuthorBefore (wxWindow* link);
134  virtual void InsertAuthorAfter (wxWindow* link);
135  virtual void SetAuthors(const objects::CAuth_list& auth_list);
136  /// @}
137 
138 ////@begin CAuthorNamesPanel event handler declarations
139 
140  /// wxEVT_COMMAND_HYPERLINK event handler for ID_ADDAUTH
141  void OnAddauthHyperlinkClicked( wxHyperlinkEvent& event );
142 
143  /// wxEVT_COMMAND_HYPERLINK event handler for ID_ADDCONSORTIUM
144  void OnAddconsortiumHyperlinkClicked( wxHyperlinkEvent& event );
145 
146  /// wxEVT_COMMAND_HYPERLINK event handler for ID_IMPORT_AUTHORS
147  void OnImportAuthorsHyperlinkClicked( wxHyperlinkEvent& event );
148 
149  /// wxEVT_COMMAND_HYPERLINK event handler for ID_IMPORT_AUTHORS_AFFILIATION
150  void OnImportAuthorsAffiliationHyperlinkClicked( wxHyperlinkEvent& event );
151 
152  void OnDelete(wxHyperlinkEvent& event);
153 
154  void OnReplaceAllAuthors( wxCommandEvent& event );
155  void OnReplaceSameAuthors( wxCommandEvent& event );
156 
157 ////@end CAuthorNamesPanel event handler declarations
158 
159 ////@begin CAuthorNamesPanel member function declarations
160 
161  /// Retrieves bitmap resources
162  wxBitmap GetBitmapResource( const wxString& name );
163 
164  /// Retrieves icon resources
165  wxIcon GetIconResource( const wxString& name );
166 ////@end CAuthorNamesPanel member function declarations
167 
168  /// Should we show tooltips?
169  static bool ShowToolTips();
170 
171  virtual bool IsImportEnabled(void);
172  virtual bool IsExportEnabled(void);
173  virtual CRef<CSerialObject> OnExport(void);
174  virtual void OnImport( CNcbiIfstream &istr);
175 
176 ////@begin CAuthorNamesPanel member variables
177 
178  /// Control identifiers
179  enum {
180  ID_AUTHORNAMES = 10022,
181  ID_ADDAUTH = 10023,
182  ID_ADDCONSORTIUM = 10024,
183  ID_IMPORT_AUTHORS = 10025,
184  ID_IMPORT_AUTHORS_AFFILIATION = 10026,
185  ID_PANEL = 10027
186  };
187 ////@end CAuthorNamesPanel member variables
188 
189  static bool IsAuthorEmpty (const objects::CAuthor& auth);
190 
191  virtual void ApplySubmitBlock(objects::CSubmit_block& block);
192  virtual void ApplyCommand();
193  virtual wxString GetAnchor() {return _("reference-sequence-authors");}
194  virtual wxString GetName() const { return SYMBOL_CAUTHORNAMESPANEL_TITLE; }
195 private:
196  /// @name CAuthorNamesContainer implementation
197  /// @{
198  virtual wxSizerItem* x_FindSingleAuthor(wxWindow* wnd, wxSizerItemList& itemList);
199  virtual void x_AddRowToWindow(wxWindow* row);
200  virtual void x_InsertRowtoWindow(wxWindow* row, size_t index);
201  virtual void x_MoveRowUp(int row_num);
202  virtual int x_FindRow(wxWindow* wnd, wxSizerItemList& itemList);
203  /// @}
204 
205  void x_AddNewEmptyAuthor(void);
206  void x_SetAffiliation();
207  ICommandProccessor* GetUndoManager();
208  objects::CSeq_entry_Handle GetSeqEntryHandle();
209  void x_AdjustScroll(wxWindow* row, bool scroll_to_end = true);
210 
215 
216  wxWindow* m_Consortium;
218 };
219 
221 
222 #endif // GUI_WIDGETS_EDIT___AUTHORNAMES_PANEL__HPP
#define SYMBOL_CAUTHORNAMESPANEL_TITLE
#define SYMBOL_CAUTHORNAMESPANEL_SIZE
#define SYMBOL_CAUTHORNAMESPANEL_IDNAME
#define SYMBOL_CAUTHORNAMESPANEL_POSITION
#define SYMBOL_CAUTHORNAMESPANEL_STYLE
virtual void x_MoveRowUp(int row_num)=0
virtual int x_FindRow(wxWindow *wnd, wxSizerItemList &itemList)=0
virtual void AddLastAuthor(wxWindow *link)=0
virtual void x_InsertRowtoWindow(wxWindow *row, size_t index)=0
virtual void SetAuthors(const objects::CAuth_list &auth_list)=0
virtual void InsertAuthorBefore(wxWindow *link)=0
virtual void x_AddRowToWindow(wxWindow *row)=0
virtual void InsertAuthorAfter(wxWindow *link)=0
virtual wxSizerItem * x_FindSingleAuthor(wxWindow *wnd, wxSizerItemList &itemList)=0
virtual wxString GetName() const
CRef< CSerialObject > m_EditedAuthList
CSerialObject * m_Object
virtual wxString GetAnchor()
CRef< objects::CSubmit_block > m_SubmitBlock
virtual bool IsImportEnabled(void)
virtual CRef< CSerialObject > OnExport(void)
virtual bool IsExportEnabled(void)
virtual void OnImport(CNcbiIfstream &istr)
Base class for all serializable objects.
Definition: serialbase.hpp:150
Undo/Redo interface for editing operations.
virtual void ApplySubmitBlock(objects::CSubmit_block &block)
Include a standard set of the NCBI C++ Toolkit most basic headers.
#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
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
Definition: ncbistre.hpp:439
#define NCBI_GUIWIDGETS_EDIT_EXPORT
Definition: gui_export.h:526
const struct ncbi::grid::netcache::search::fields::SIZE size
#define row(bind, expected)
Definition: string_bind.c:73
static CSeq_entry_Handle GetSeqEntryHandle(CScope &scope, const CSerialObject &so)
Definition: text_panel.cpp:493
#define ID_PANEL
Modified on Wed Sep 04 15:01:11 2024 by modify_doxy.py rev. 669887