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

Go to the SVN repository for this file.

1 
2 #ifndef GUI_WIDGETS_SEQ___SEQUENCE_GOTO_DLG__HPP
3 #define GUI_WIDGETS_SEQ___SEQUENCE_GOTO_DLG__HPP
4 
5 /* $Id: sequence_goto_dlg.hpp 30858 2014-07-31 14:05:43Z ucko $
6  * ===========================================================================
7  *
8  * PUBLIC DOMAIN NOTICE
9  * National Center for Biotechnology Information
10  *
11  * This software/database is a "United States Government Work" under the
12  * terms of the United States Copyright Act. It was written as part of
13  * the author's official duties as a United States Government employee and
14  * thus cannot be copyrighted. This software/database is freely available
15  * to the public for use. The National Library of Medicine and the U.S.
16  * Government have not placed any restriction on its use or reproduction.
17  *
18  * Although all reasonable efforts have been taken to ensure the accuracy
19  * and reliability of the software and data, the NLM and the U.S.
20  * Government do not and cannot warrant the performance or results that
21  * may be obtained by using this software or data. The NLM and the U.S.
22  * Government disclaim all warranties, express or implied, including
23  * warranties of performance, merchantability or fitness for any particular
24  * purpose.
25  *
26  * Please cite the author in any work or product based on this material.
27  *
28  * ===========================================================================
29  *
30  * Authors: Roman Katargin
31  *
32  * File Description:
33  *
34  */
35 
36 #include <corelib/ncbistd.hpp>
37 #include <gui/gui_export.h>
38 
39 /*!
40  * Includes
41  */
42 
43 
44 // This header must (at least indirectly) precede any wxWidgets headers.
46 
47 #include <wx/dialog.h>
48 
49 ////@begin includes
50 ////@end includes
51 
52 /*!
53  * Forward declarations
54  */
55 
56 class wxTextCtrl;
57 
58 ////@begin forward declarations
59 ////@end forward declarations
60 
62 
63 /*!
64  * Control identifiers
65  */
66 
67 ////@begin control identifiers
68 #define SYMBOL_CSEQUENCEGOTODLG_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL
69 #define SYMBOL_CSEQUENCEGOTODLG_TITLE _("Go to sequence")
70 #define SYMBOL_CSEQUENCEGOTODLG_IDNAME ID_CSEQUENCEGOTODLG
71 #define SYMBOL_CSEQUENCEGOTODLG_SIZE wxSize(400, 300)
72 #define SYMBOL_CSEQUENCEGOTODLG_POSITION wxDefaultPosition
73 ////@end control identifiers
74 
75 class CSequenceGotoData;
76 class CSequenceGotoEvent;
77 
78 /*!
79  * CSequenceGotoDlg class declaration
80  */
81 
83 {
84  DECLARE_DYNAMIC_CLASS( CSequenceGotoDlg )
85  DECLARE_EVENT_TABLE()
86 
87 public:
88  /// Constructors
90  CSequenceGotoDlg( wxWindow* parent,
92  wxEvtHandler* eventHandler = 0,
93  wxWindowID id = SYMBOL_CSEQUENCEGOTODLG_IDNAME,
94  const wxString& caption = SYMBOL_CSEQUENCEGOTODLG_TITLE,
95  const wxPoint& pos = SYMBOL_CSEQUENCEGOTODLG_POSITION,
96  const wxSize& size = SYMBOL_CSEQUENCEGOTODLG_SIZE,
97  long style = SYMBOL_CSEQUENCEGOTODLG_STYLE );
98 
99  /// Creation
100  bool Create( wxWindow* parent, wxWindowID id = SYMBOL_CSEQUENCEGOTODLG_IDNAME, const wxString& caption = SYMBOL_CSEQUENCEGOTODLG_TITLE, const wxPoint& pos = SYMBOL_CSEQUENCEGOTODLG_POSITION, const wxSize& size = SYMBOL_CSEQUENCEGOTODLG_SIZE, long style = SYMBOL_CSEQUENCEGOTODLG_STYLE );
101 
102  // implementation only, don't use
103  void Send(CSequenceGotoEvent& event);
104 
105  /// Destructor
106  ~CSequenceGotoDlg();
107 
108  /// Initialises member variables
109  void Init();
110 
111  /// Creates the controls and sizers
112  void CreateControls();
113 
114 ////@begin CSequenceGotoDlg event handler declarations
115 
116  /// wxEVT_CLOSE_WINDOW event handler for ID_CSEQUENCEGOTODLG
117  void OnCloseWindow( wxCloseEvent& event );
118 
119  /// wxEVT_COMMAND_TEXT_ENTER event handler for ID_TEXTCTRL1
120  void OnTextctrl1Enter( wxCommandEvent& event );
121 
122  /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
123  void OnOkClick( wxCommandEvent& event );
124 
125  /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
126  void OnCancelClick( wxCommandEvent& event );
127 
128 ////@end CSequenceGotoDlg event handler declarations
129 
130 ////@begin CSequenceGotoDlg member function declarations
131 
132  wxString GetSeqPos() const { return m_SeqPos ; }
133  void SetSeqPos(wxString value) { m_SeqPos = value ; }
134 
135  /// Retrieves bitmap resources
136  wxBitmap GetBitmapResource( const wxString& name );
137 
138  /// Retrieves icon resources
139  wxIcon GetIconResource( const wxString& name );
140 ////@end CSequenceGotoDlg member function declarations
141 
142  /// Should we show tooltips?
143  static bool ShowToolTips();
144 
145  void SetFocusToInputBox();
146  virtual bool Show(bool show = true);
147 
148 ////@begin CSequenceGotoDlg member variables
149  wxTextCtrl* m_InputBox;
150 private:
151  wxString m_SeqPos;
152  /// Control identifiers
153  enum {
154  ID_CSEQUENCEGOTODLG = 10002,
155  ID_TEXTCTRL1 = 10003
156  };
157 ////@end CSequenceGotoDlg member variables
159  wxEvtHandler* m_EventHandler;
160 };
161 
162 
164 {
165 public:
166  const wxString& GetPositionString() { return m_PositionStr; }
167  bool GetRange(long& from, long& to) const;
168 
169 private:
170  friend class CSequenceGotoDlg;
171 
172  void SetPositionString(const wxString& str) { m_PositionStr = str; }
173  wxString m_PositionStr;
174 };
175 
176 
177 
178 class CSequenceGotoEvent : public wxCommandEvent
179 {
180 public:
181  CSequenceGotoEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
182  : wxCommandEvent(commandType, id) { }
183 
184  wxString GetPositionString() const { return m_PositionStr; }
185 
187  { return wxStaticCast(GetEventObject(), CSequenceGotoDlg); }
188 
189 private:
190  wxString m_PositionStr;
191 
192  DECLARE_DYNAMIC_CLASS_NO_COPY(CSequenceGotoEvent)
193 
194  // implementation only
195  void SetPositionString(const wxString& str) { m_PositionStr = str; }
196 
197  friend class CSequenceGotoDlg;
198 };
199 
200 
201 BEGIN_DECLARE_EVENT_TYPES()
202  DECLARE_EXPORTED_EVENT_TYPE(NCBI_GUIWIDGETS_SEQ_EXPORT, wxEVT_COMMAND_SEQ_GOTO, 510)
203  DECLARE_EXPORTED_EVENT_TYPE(NCBI_GUIWIDGETS_SEQ_EXPORT, wxEVT_COMMAND_SEQ_GOTO_CLOSE, 511)
204 END_DECLARE_EVENT_TYPES()
205 
206 typedef void (wxEvtHandler::*CSequenceGotoEventFunction)(CSequenceGotoEvent&);
207 
208 #define CSequenceGotoEventHandler(func) \
209  (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(CSequenceGotoEventFunction, &func)
210 
211 #define EVT_SEQ_GOTO(id, fn) \
212  wx__DECLARE_EVT1(wxEVT_COMMAND_SEQ_GOTO, id, CSequenceGotoEventHandler(fn))
213 
214 #define EVT_SEQ_GOTO_CLOSE(id, fn) \
215  wx__DECLARE_EVT1(wxEVT_COMMAND_SEQ_GOTO_CLOSE, id, CSequenceGotoEventHandler(fn))
216 
217 
219 
220 #endif // GUI_WIDGETS_SEQ___SEQUENCE_GOTO_DLG__HPP
void SetPositionString(const wxString &str)
const wxString & GetPositionString()
void SetSeqPos(wxString value)
wxString GetSeqPos() const
wxEvtHandler * m_EventHandler
CSequenceGotoData * m_Data
wxString GetPositionString() const
CSequenceGotoEvent(wxEventType commandType=wxEVT_NULL, int id=0)
CSequenceGotoDlg * GetDialog() const
void SetPositionString(const wxString &str)
Include a standard set of the NCBI C++ Toolkit most basic headers.
DECLARE_EXPORTED_EVENT_TYPE(, wxEVT_COMMAND_UPDATE_FEATLIST, wxCommandEvent)
Workaround for wxWidgets header errors in certain configurations; MUST be included (at least indirect...
static void Init(void)
Definition: cursor6.c:76
static const char * str(char *buf, int n)
Definition: stats.c:84
char data[12]
Definition: iconv.c:80
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_GUIWIDGETS_SEQ_EXPORT
Definition: gui_export.h:539
Defines to provide correct exporting from DLLs in Windows.
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
void(wxEvtHandler::* CSequenceGotoEventFunction)(CSequenceGotoEvent &)
#define SYMBOL_CSEQUENCEGOTODLG_IDNAME
#define SYMBOL_CSEQUENCEGOTODLG_SIZE
#define SYMBOL_CSEQUENCEGOTODLG_POSITION
#define SYMBOL_CSEQUENCEGOTODLG_TITLE
#define SYMBOL_CSEQUENCEGOTODLG_STYLE
#define ID_TEXTCTRL1
#define const
Definition: zconf.h:232
Modified on Tue Apr 23 07:36:49 2024 by modify_doxy.py rev. 669887