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

Go to the SVN repository for this file.

1 #ifndef GUI_WIDGETS_EDIT___STRING_LIST_CTRL__HPP
2 #define GUI_WIDGETS_EDIT___STRING_LIST_CTRL__HPP
3 
4 /* $Id: string_list_ctrl.hpp 31203 2014-09-11 12:31:21Z bollin $
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: Roman Katargin
30  */
31 
32 #include <corelib/ncbiobj.hpp>
33 
34 /*!
35  * Includes
36  */
37 
38 ////@begin includes
39 ////@end includes
40 
41 #include <wx/scrolwin.h>
42 #include <wx/textctrl.h>
43 #include <wx/hyperlink.h>
44 
45 /*!
46  * Forward declarations
47  */
48 
49 ////@begin forward declarations
50 class wxFlexGridSizer;
51 ////@end forward declarations
52 
54 
55 /*!
56  * Control identifiers
57  */
58 
59 ////@begin control identifiers
60 #define SYMBOL_CSTRINGLISTCTRL_STYLE wxTAB_TRAVERSAL
61 #define SYMBOL_CSTRINGLISTCTRL_TITLE _("String List Control")
62 #define SYMBOL_CSTRINGLISTCTRL_IDNAME ID_CSTRINGSPANEL
63 #define SYMBOL_CSTRINGLISTCTRL_SIZE wxSize(400, 300)
64 #define SYMBOL_CSTRINGLISTCTRL_POSITION wxDefaultPosition
65 ////@end control identifiers
66 
67 
68 /*!
69  * CStringListCtrl class declaration
70  */
71 
72 class CStringListCtrl: public wxScrolledWindow
73 {
74  DECLARE_DYNAMIC_CLASS( CStringListCtrl )
75  DECLARE_EVENT_TABLE()
76 
77 public:
78  /// Constructors
80  CStringListCtrl( wxWindow* parent, wxWindowID id = SYMBOL_CSTRINGLISTCTRL_IDNAME, const wxPoint& pos = SYMBOL_CSTRINGLISTCTRL_POSITION, const wxSize& size = SYMBOL_CSTRINGLISTCTRL_SIZE, long style = SYMBOL_CSTRINGLISTCTRL_STYLE );
81 
82  enum {
83  kStringIdBase = 10100,
84  kMaxStringsCount = 100
85  };
86 
88  {
89  public:
91  operator bool(void) const { return (m_TextCtrl != 0); }
93  string GetValue();
94 
95  private:
97  int m_Id;
98  wxTextCtrl* m_TextCtrl;
99  };
100 
101  /// Creation
102  bool Create( wxWindow* parent, wxWindowID id = SYMBOL_CSTRINGLISTCTRL_IDNAME, const wxPoint& pos = SYMBOL_CSTRINGLISTCTRL_POSITION, const wxSize& size = SYMBOL_CSTRINGLISTCTRL_SIZE, long style = SYMBOL_CSTRINGLISTCTRL_STYLE );
103 
104  size_t GetMaxStringsCount() const { return kMaxStringsCount; }
105  bool AddString(const string& value);
106  void Clear();
107 
108  /// Destructor
110 
111  /// Initialises member variables
112  void Init();
113 
114  /// Creates the controls and sizers
115  void CreateControls();
116 
117 ////@begin CStringListCtrl event handler declarations
118 
119 ////@end CStringListCtrl event handler declarations
120 
121 ////@begin CStringListCtrl member function declarations
122 
123  int GetCurrentStringId() const { return m_CurrentStringId ; }
125 
126  /// Retrieves bitmap resources
127  wxBitmap GetBitmapResource( const wxString& name );
128 
129  /// Retrieves icon resources
130  wxIcon GetIconResource( const wxString& name );
131 ////@end CStringListCtrl member function declarations
132 
133  /// Should we show tooltips?
134  static bool ShowToolTips();
135 
136 ////@begin CStringListCtrl member variables
137  wxFlexGridSizer* m_GridSizer;
138 private:
140  /// Control identifiers
141  enum {
142  ID_CSTRINGSPANEL = 10016
143  };
144 ////@end CStringListCtrl member variables
145 
146 protected:
147  void OnTextCtrlUpdated (wxCommandEvent& event);
148  void OnDelete (wxHyperlinkEvent& event);
149  int FindSlot();
150 };
151 
153 
154 #endif // GUI_WIDGETS_EDIT___STRING_LIST_CTRL__HPP
CConstIterator(CStringListCtrl &control)
bool AddString(const string &value)
void SetCurrentStringId(int value)
void Init()
Initialises member variables.
static bool ShowToolTips()
Should we show tooltips?
void OnDelete(wxHyperlinkEvent &event)
void OnTextCtrlUpdated(wxCommandEvent &event)
bool Create(wxWindow *parent, wxWindowID id=ID_CSTRINGSPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
void CreateControls()
Creates the controls and sizers.
wxFlexGridSizer * m_GridSizer
int GetCurrentStringId() const
~CStringListCtrl()
Destructor.
CStringListCtrl()
Constructors.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
size_t GetMaxStringsCount() const
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
#define bool
Definition: bool.h:34
#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 struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
#define SYMBOL_CSTRINGLISTCTRL_SIZE
#define SYMBOL_CSTRINGLISTCTRL_IDNAME
#define SYMBOL_CSTRINGLISTCTRL_STYLE
#define SYMBOL_CSTRINGLISTCTRL_POSITION
Modified on Sat Apr 13 11:49:27 2024 by modify_doxy.py rev. 669887