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

Go to the SVN repository for this file.

1 /* $Id: test_dialog_view.cpp 30384 2014-05-08 19:29:29Z katargir $
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: Roman Katargin
27  */
28 
29 
30 #include <ncbi_pch.hpp>
31 
32 #include <gui/utils/view_event.hpp>
33 
37 
38 #include "test_dialog_view.hpp"
39 
40 #include <wx/sizer.h>
41 #include <wx/button.h>
42 
45 
46 /*!
47  * CTestDialogView type definition
48  */
49 
50 IMPLEMENT_DYNAMIC_CLASS( CTestDialogView, CGuiWidgetDlg )
51 
52 
53 /*!
54  * CTestDialogView event table definition
55  */
56 
57 BEGIN_EVENT_TABLE( CTestDialogView, CGuiWidgetDlg )
58 
59 ////@begin CTestDialogView event table entries
60 ////@end CTestDialogView event table entries
61 
63 
64 
65 wxWindow* CTestDialogView::CreateDialog(wxWindow* parent)
66 {
67  return new CTestDialogView(parent);
68 }
69 
70 /*!
71  * CTestDialogView constructors
72  */
73 
75 {
76  Init();
77 }
78 
79 CTestDialogView::CTestDialogView( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
80 {
81  Init();
82  Create(parent, id, caption, pos, size, style);
83 }
84 
85 
86 /*!
87  * CTestDialogView creator
88  */
89 
90 bool CTestDialogView::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
91 {
92 ////@begin CTestDialogView creation
93  SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
94  CGuiWidgetDlg::Create( parent, id, caption, pos, size, style );
95 
97  if (GetSizer())
98  {
99  GetSizer()->SetSizeHints(this);
100  }
101  Centre();
102 ////@end CTestDialogView creation
103  return true;
104 }
105 
106 
107 /*!
108  * CTestDialogView destructor
109  */
110 
112 {
113 ////@begin CTestDialogView destruction
114 ////@end CTestDialogView destruction
115 
116  if (m_TextPanel) {
117  m_TextPanel->SetHost(0);
119  }
120 }
121 
122 
123 /*!
124  * Member initialisation
125  */
126 
128 {
129 ////@begin CTestDialogView member initialisation
130  m_TextPanel = NULL;
131 ////@end CTestDialogView member initialisation
132 }
133 
134 
135 /*!
136  * Control creation for CTestDialogView
137  */
138 
140 {
141 ////@begin CTestDialogView content construction
142  CTestDialogView* itemCGuiWidgetDlg1 = this;
143 
144  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
145  itemCGuiWidgetDlg1->SetSizer(itemBoxSizer2);
146 
147  m_TextPanel = new CTextPanel( itemCGuiWidgetDlg1, ID_PANEL1, wxDefaultPosition, wxSize(350, 200), wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
148  itemBoxSizer2->Add(m_TextPanel, 1, wxGROW|wxALL, 5);
149 
150  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
151  itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_RIGHT|wxALL, 5);
152 
153  wxButton* itemButton5 = new wxButton( itemCGuiWidgetDlg1, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
154  itemBoxSizer4->Add(itemButton5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
155 
156 ////@end CTestDialogView content construction
157 
158  m_TextPanel->Show();
159 }
160 
161 /// ITextWidgetHost implementation
162 
164 {
166 }
167 
168 /// IGuiWidgetHost implementation
169 
171 {
173  if (m_TextPanel) m_TextPanel->SetHost(host);
174 }
175 
177 {
178  if (!m_TextPanel || !m_TextPanel->InitWidget(objects)) return false;
179  m_TextPanel->GetWidget()->SetHost(this);
180  return true;
181 }
182 
184 {
186 }
187 
189 {
191 }
192 
194 {
195  return m_TextPanel ? m_TextPanel->GetOrigObject() : 0;
196 }
197 
199 {
200  if (m_TextPanel) m_TextPanel->SetUndoManager(cmdProccessor);
201 }
202 
204 {
206 }
207 
209 {
211 }
212 
213 void CTestDialogView::GetActiveObjects(vector<TConstScopedObjects>& objects)
214 {
216 }
217 
218 /*!
219  * Should we show tooltips?
220  */
221 
223 {
224  return true;
225 }
226 
227 /*!
228  * Get bitmap resources
229  */
230 
231 wxBitmap CTestDialogView::GetBitmapResource( const wxString& name )
232 {
233  // Bitmap retrieval
234 ////@begin CTestDialogView bitmap retrieval
235  wxUnusedVar(name);
236  return wxNullBitmap;
237 ////@end CTestDialogView bitmap retrieval
238 }
239 
240 /*!
241  * Get icon resources
242  */
243 
244 wxIcon CTestDialogView::GetIconResource( const wxString& name )
245 {
246  // Icon retrieval
247 ////@begin CTestDialogView icon retrieval
248  wxUnusedVar(name);
249  return wxNullIcon;
250 ////@end CTestDialogView icon retrieval
251 }
252 
IGuiWidgetHost * m_WidgetHost
virtual void SetHost(IGuiWidgetHost *host)
CObject –.
Definition: ncbiobj.hpp:180
virtual void SetSelectedObjects(const TConstObjects &objects)
virtual void GetActiveObjects(vector< TConstScopedObjects > &objects)
void Init()
Initialises member variables.
bool Create(wxWindow *parent, wxWindowID id=10356, const wxString &caption=_("Test Dialog View"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
virtual const CObject * GetOrigObject() const
void CreateControls()
Creates the controls and sizers.
virtual void GetSelectedObjects(TConstObjects &objects) const
virtual void SetUndoManager(ICommandProccessor *cmdProccessor)
virtual void WidgetSelectionChanged()
ITextWidgetHost implementation.
virtual void DataChanged()
CTextPanel * m_TextPanel
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
virtual void DataChanging()
~CTestDialogView()
Destructor.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
virtual bool InitWidget(TConstScopedObjects &objects)
static bool ShowToolTips()
Should we show tooltips?
CTestDialogView()
Constructors.
virtual void SetHost(IGuiWidgetHost *host)
IGuiWidgetHost implementation.
void SetHost(ITextWidgetHost *host)
virtual void SetHost(IGuiWidgetHost *host)
IGuiWidgetHost implementation.
virtual void SetSelectedObjects(const TConstObjects &objects)
virtual void DataChanging()
virtual void GetSelectedObjects(TConstObjects &objects) const
CTextItemPanel * GetWidget() const
Definition: text_panel.hpp:229
virtual void GetActiveObjects(vector< TConstScopedObjects > &objects)
virtual void SetUndoManager(ICommandProccessor *cmdProccessor)
virtual bool InitWidget(TConstScopedObjects &objects)
virtual void DataChanged()
virtual const CObject * GetOrigObject() const
Undo/Redo interface for editing operations.
virtual void WidgetSelectionChanged()=0
#define _(proto)
Definition: ct_nlmzip_i.h:78
#define NULL
Definition: ncbistd.hpp:225
vector< CConstRef< CObject > > TConstObjects
Definition: objects.hpp:64
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
#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()
const struct ncbi::grid::netcache::search::fields::SIZE size
USING_SCOPE(objects)
#define ID_PANEL1
Modified on Thu Jun 13 17:31:41 2024 by modify_doxy.py rev. 669887