Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / utils / wxNamingViewer / wxAddNameServerDlg.cpp
blob6b58dff75203974837f4dc3d9e380eb7bc1d8beb
1 // @file wxAddNameServerDlg.cpp
2 //
3 // @author Charlie Frasch <cfrasch@atdesk.com>
4 #include "pch.h"
5 #include "wxAddNameServerDlg.h"
7 #include "wxNamingViewer.h"
9 #include "wx/sizer.h"
10 #include "wx/textctrl.h"
12 namespace // anonymous
14 void create_dialog_components( wxDialog* dialog)
16 wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL);
19 wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL);
20 sizer->Add(
21 new wxStaticText( dialog, -1, "Name:" ),
23 wxALL,
24 5);
25 wxTextCtrl* text = new wxTextCtrl(
26 dialog,
27 IDC_NAME
29 text->SetName( "nameText");
30 sizer->Add(
31 text,
33 wxALL,
34 5);
35 topsizer->Add(
36 sizer,
38 wxALIGN_LEFT | wxEXPAND);
42 wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL);
43 sizer->Add(
44 new wxStaticText( dialog, -1, "IOR:" ),
46 wxALL,
47 5);
48 wxTextCtrl* text = new wxTextCtrl(
49 dialog,
50 IDC_IOR
52 text->SetName( "iorText");
53 sizer->Add(
54 text,
56 wxALL,
57 5);
58 topsizer->Add(
59 sizer,
61 wxALIGN_LEFT | wxEXPAND);
64 wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL);
66 wxButton* okButton = new wxButton( dialog, wxID_OK, "OK" );
67 okButton->SetName( "okButton");
68 button_sizer->Add(
69 okButton,
71 wxALL,
72 5);
75 button_sizer->Add(
76 new wxButton( dialog, wxID_CANCEL, "Cancel" ),
78 wxALL,
79 5);
81 topsizer->Add(
82 button_sizer,
84 wxALIGN_CENTER);
86 dialog->SetSizer( topsizer);
87 topsizer->SetSizeHints( dialog);
89 }; // anonymous
91 WxAddNameServerDlg::WxAddNameServerDlg( wxWindow* parent)
92 #if defined(wxUSE_RESOURCES) && (wxUSE_RESOURCES == 1)
93 : wxDialog()
94 #else
95 : wxDialog(
96 parent,
97 IDD_ADD_NAME_SERVER,
98 "Add Name Server",
99 wxDefaultPosition,
100 wxSize(186,69),
101 wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU,
102 "addNameServer")
103 #endif // defined(wxUSE_RESOURCES) && (wxUSE_RESOURCES == 1)
104 , ior("")
105 , serverName("")
107 #if defined(wxUSE_RESOURCES) && (wxUSE_RESOURCES == 1)
108 LoadFromResource( parent, "addNameServer");
109 #else
110 create_dialog_components( this);
111 #endif // defined(wxUSE_RESOURCES) && (wxUSE_RESOURCES == 1)
112 wxButton* ctrl = static_cast<wxButton*>( wxFindWindowByName(
113 "okButton",
114 this));
116 assert( ctrl);
117 ctrl->SetDefault();
120 bool WxAddNameServerDlg::TransferDataFromWindow()
122 wxTextCtrl* ctrl = static_cast<wxTextCtrl*>( wxFindWindowByName(
123 "iorText",
124 this));
125 assert( ctrl);
126 ior = ctrl->GetValue();
128 ctrl = static_cast<wxTextCtrl*>( wxFindWindowByName(
129 "nameText",
130 this));
131 assert( ctrl);
132 serverName = ctrl->GetValue();
133 return true;