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

Go to the SVN repository for this file.

1 #ifndef GUI_FRAMEWORK___ITEM_SELECTION_PANEL__HPP
2 #define GUI_FRAMEWORK___ITEM_SELECTION_PANEL__HPP
3 
4 /* $Id: item_selection_panel.hpp 24477 2011-09-29 17:12:25Z katargir $
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: Andrey Yazhuk
30  *
31  * File Description:
32  *
33  */
34 
35 /** @addtogroup GUI_FRAMEWORK
36 *
37 * @{
38 */
39 
40 #include <corelib/ncbistd.hpp>
41 
42 #include <gui/gui_export.h>
43 
45 
46 #include <gui/utils/ui_object.hpp>
47 
48 #include <wx/textctrl.h>
49 #include <wx/stattext.h>
50 #include <wx/msgdlg.h>
51 
52 ////@begin includes
53 ////@end includes
54 
55 #include <wx/panel.h>
56 
57 ////@begin control identifiers
58 #define SYMBOL_CITEMSELECTIONPANEL_STYLE wxNO_BORDER|wxCLIP_CHILDREN|wxTAB_TRAVERSAL
59 #define SYMBOL_CITEMSELECTIONPANEL_TITLE _("ItemSelectionPanel")
60 #define SYMBOL_CITEMSELECTIONPANEL_IDNAME ID_CITEMSELECTIONPANEL
61 #define SYMBOL_CITEMSELECTIONPANEL_SIZE wxDefaultSize
62 #define SYMBOL_CITEMSELECTIONPANEL_POSITION wxDefaultPosition
63 ////@end control identifiers
64 
65 
66 class wxTextCtrl;
67 class wxStaticText;
68 class wxButton;
69 
71 
72 class CSplitter;
73 class CGroupMapWidget;
74 
75 
76 // an abstract item in CItemSelectionPanel
78 {
79 public:
80  virtual const IUIObject& GetDescriptor() const = 0;
81  virtual string GetCategory() = 0;
82  virtual bool ShowDefault() const = 0;
83 
84  virtual ~IItemWithDescription() {}
85 };
86 
87 ///////////////////////////////////////////////////////////////////////////////
88 /// CItemSelectionPanel
89 
90 class CItemSelectionPanel: public wxPanel
91 {
92  DECLARE_DYNAMIC_CLASS( CItemSelectionPanel )
93  DECLARE_EVENT_TABLE()
94 
95 public:
97  CItemSelectionPanel( wxWindow* parent,
98  wxWindowID id = SYMBOL_CITEMSELECTIONPANEL_IDNAME,
99  const wxPoint& pos = SYMBOL_CITEMSELECTIONPANEL_POSITION,
100  const wxSize& size = SYMBOL_CITEMSELECTIONPANEL_SIZE,
101  long style = SYMBOL_CITEMSELECTIONPANEL_STYLE );
102 
103  bool Create( wxWindow* parent,
104  wxWindowID id = SYMBOL_CITEMSELECTIONPANEL_IDNAME,
105  const wxPoint& pos = SYMBOL_CITEMSELECTIONPANEL_POSITION,
106  const wxSize& size = SYMBOL_CITEMSELECTIONPANEL_SIZE,
107  long style = SYMBOL_CITEMSELECTIONPANEL_STYLE );
108 
110 
111  void Init();
112 
113  void CreateControls();
114 
115 ////@begin CItemSelectionPanel event handler declarations
116 
117  void OnKeyDown( wxKeyEvent& event );
118 
119  void OnSearchUpdated( wxCommandEvent& event );
120 
121  void OnResetClick( wxCommandEvent& event );
122 
123 ////@end CItemSelectionPanel event handler declarations
124 
125 ////@begin CItemSelectionPanel member function declarations
126 
127  wxBitmap GetBitmapResource( const wxString& name );
128 
129  wxIcon GetIconResource( const wxString& name );
130 ////@end CItemSelectionPanel member function declarations
131 
132  static bool ShowToolTips();
133 
134 ////@begin CItemSelectionPanel member variables
135  wxTextCtrl* m_SearchCtrl;
136  wxButton* m_ResetBtn;
137  wxStaticText* m_StatusText;
139  enum {
141  ID_SEARCH = 10028,
142  ID_RESET = 10029,
143  ID_STATUS = 10032,
144  ID_SPLITTER = 10027
145  };
146 ////@end CItemSelectionPanel member variables
147  enum {
148  ID_MAP_WIDGET = 10030,
149  IDDESCR = 10031
150  };
151 
152  wxTextCtrl* m_DescrCtrl;
154 
155 public:
157 
158  void SetItemTypeLabel(const string& label);
159  void SetItems(vector<TItemRef>& items);
160 
161  void OnItemSelected(wxCommandEvent& event);
162 
164 
165  /// @name IRegSettings interface
166  /// @{
167  virtual void SetRegistryPath(const string& path);
168  virtual void LoadSettings();
169  virtual void SaveSettings() const;
170  /// @}
171 
172 protected:
173  void x_UpdateMapWidget();
174  void x_FilterItems(const string& query);
175 
176  size_t x_FindItemByLabel(const string& label);
178  IItemWithDescription& manager);
179 
180 protected:
181  vector<TItemRef> m_AllItems;
182  vector<TItemRef> m_Items;
183 
184  vector<string> m_CollapsedGroups;
185 
187  string m_RegPath;
188 };
189 
191 
192 /* @} */
193 
194 #endif // GUI_FRAMEWORK___ITEM_SELECTION_PANEL__HPP
CGroupMapWidget.
vector< SGroupDescr > TGroupDescrVector
CItemSelectionPanel.
CSplitter - container with resizable separators.
Definition: splitter.hpp:54
IUIObject - object that provides basic properties often required in a UI object.
Definition: ui_object.hpp:63
Include a standard set of the NCBI C++ Toolkit most basic headers.
void x_AddItem(CGroupMapWidget::TGroupDescrVector &descrs, IItemWithDescription &manager)
void OnKeyDown(wxKeyEvent &event)
wxIcon GetIconResource(const wxString &name)
vector< TItemRef > m_Items
CIRef< IItemWithDescription > TItemRef
void SetItemTypeLabel(const string &label)
#define SYMBOL_CITEMSELECTIONPANEL_POSITION
wxBitmap GetBitmapResource(const wxString &name)
virtual void SetRegistryPath(const string &path)
void OnResetClick(wxCommandEvent &event)
virtual string GetCategory()=0
virtual void SaveSettings() const
#define SYMBOL_CITEMSELECTIONPANEL_IDNAME
void SetItems(vector< TItemRef > &items)
void x_FilterItems(const string &query)
void OnItemSelected(wxCommandEvent &event)
virtual bool ShowDefault() const =0
vector< TItemRef > m_AllItems
vector< string > m_CollapsedGroups
#define SYMBOL_CITEMSELECTIONPANEL_SIZE
CGroupMapWidget * m_MapWidget
bool Create(wxWindow *parent, wxWindowID id=ID_CITEMSELECTIONPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxNO_BORDER|wxCLIP_CHILDREN|wxTAB_TRAVERSAL)
void OnSearchUpdated(wxCommandEvent &event)
virtual const IUIObject & GetDescriptor() const =0
size_t x_FindItemByLabel(const string &label)
#define SYMBOL_CITEMSELECTIONPANEL_STYLE
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static const char label[]
Defines to provide correct exporting from DLLs in Windows.
const struct ncbi::grid::netcache::search::fields::SIZE size
static string query
Modified on Wed May 15 15:03:32 2024 by modify_doxy.py rev. 669887