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

Go to the SVN repository for this file.

1 /* $Id: properties_panel_dlg.cpp 37492 2017-01-13 21:51:26Z shkeda $
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: Andrey Yazhuk
27  *
28  * File Description:
29  */
30 
31 #include <ncbi_pch.hpp>
32 
35 
36 #include <wx/sizer.h>
37 #include <wx/statline.h>
38 #include <wx/button.h>
39 
41 
42 BEGIN_EVENT_TABLE( CPropertiesPanelDlg, wxDialog )
43  EVT_BUTTON( wxID_OK, CPropertiesPanelDlg::OnOkClick)
45 
47  : m_PropPanel()
48 {
49  Create(parent, wxID_ANY, _("Coloring Method Properties"),
50  wxDefaultPosition, wxDefaultSize,
51  wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX);
52 
53  SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY|GetExtraStyle());
54 
55  CreateControls(metod);
56  if (GetSizer())
57  {
58  GetSizer()->SetSizeHints(this);
59  }
60  Centre();
61 }
62 
64 {
65  wxBoxSizer* itemBoxSizer1 = new wxBoxSizer(wxVERTICAL);
66  this->SetSizer(itemBoxSizer1);
67 
68  m_PropPanel = metod->CreatePropertiesPanel(this);
69  itemBoxSizer1->Add(m_PropPanel, 1, wxGROW|wxALL, 5);
70  itemBoxSizer1->Add(new wxStaticLine(this), 0, wxGROW|wxALL, 5);
71 
72  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
73  itemBoxSizer1->Add(itemBoxSizer2, 0, wxALIGN_RIGHT|wxALL, 0);
74 
75  itemBoxSizer2->Add(new wxButton(this, wxID_OK, _("&OK")), 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
76  itemBoxSizer2->Add(new wxButton(this, wxID_CANCEL, _("&Cancel")), 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
77 }
78 
79 void CPropertiesPanelDlg::OnOkClick ( wxCommandEvent& WXUNUSED(event) )
80 {
81  if (Validate() && TransferDataFromWindow()) {
82  wxCommandEvent cmdApply(wxEVT_COMMAND_BUTTON_CLICKED, wxID_APPLY);
83  m_PropPanel->GetEventHandler()->ProcessEvent(cmdApply);
84  EndModal(wxID_OK);
85  }
86 }
87 
void OnOkClick(wxCommandEvent &event)
void CreateControls(IUIToolWithGUI *metod)
Creates the controls and sizers.
IUIToolWithGUI - represents a method that can be integrated in GUI.
Definition: ui_tool.hpp:102
virtual wxWindow * CreatePropertiesPanel(wxWindow *parent)=0
This a factory method that shall produce a CPropertiesPanel representing properties of the method; th...
#define _(proto)
Definition: ct_nlmzip_i.h:78
#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 wxCLOSE_BOX
Definition: gui.hpp:50
END_EVENT_TABLE()
static static static wxID_ANY
Modified on Mon Jun 17 05:10:26 2024 by modify_doxy.py rev. 669887