Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / utils / wxNamingViewer / wxBindNewContext.cpp
blob3bbe855380e416c73f6f55267d53dd5e804413d3
1 // @file wxBindNewContext.cpp
2 //
3 // @author Charlie Frasch <cfrasch@atdesk.com>
4 #include "pch.h"
5 #include "wxBindNewContext.h"
7 #include "wxNamingViewer.h"
9 namespace // anonymous
11 void create_dialog_components( wxDialog* dialog)
13 wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL);
16 wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL);
17 sizer->Add(
18 new wxStaticText( dialog, -1, "ID:" ),
20 wxALL,
21 5);
22 wxTextCtrl* text = new wxTextCtrl(
23 dialog,
24 IDC_ID
26 text->SetName( "idText");
27 sizer->Add(
28 text,
30 wxALL,
31 5);
32 topsizer->Add(
33 sizer,
35 wxALIGN_LEFT | wxEXPAND);
39 wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL);
40 sizer->Add(
41 new wxStaticText( dialog, -1, "Kind:" ),
43 wxALL,
44 5);
45 wxTextCtrl* text = new wxTextCtrl(
46 dialog,
47 IDC_KIND
49 text->SetName( "kindText");
50 sizer->Add(
51 text,
53 wxALL,
54 5);
55 topsizer->Add(
56 sizer,
58 wxALIGN_LEFT | wxEXPAND);
61 wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL);
63 wxButton* okButton = new wxButton( dialog, wxID_OK, "OK" );
64 okButton->SetName( "okButton");
65 button_sizer->Add(
66 okButton,
68 wxALL,
69 5);
72 button_sizer->Add(
73 new wxButton( dialog, wxID_CANCEL, "Cancel" ),
75 wxALL,
76 5);
78 topsizer->Add(
79 button_sizer,
81 wxALIGN_CENTER);
83 dialog->SetSizer( topsizer);
84 topsizer->SetSizeHints( dialog);
86 }; // anonymous
88 WxBindNewContext::WxBindNewContext( wxWindow* parent)
89 #if defined(wxUSE_RESOURCES) && (wxUSE_RESOURCES == 1)
90 : wxDialog()
91 #else
92 : wxDialog(
93 parent,
94 IDD_BIND_NEW_CONTEXT,
95 "Bind New Context",
96 wxDefaultPosition,
97 wxSize( 300, 75),
98 wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU,
99 "bindNewContext")
100 #endif // defined(wxUSE_RESOURCES) && (wxUSE_RESOURCES == 1)
102 #if defined(wxUSE_RESOURCES) && (wxUSE_RESOURCES == 1)
103 LoadFromResource( parent, "bindNewContext");
104 #else
105 create_dialog_components( this);
106 #endif // defined(wxUSE_RESOURCES) && (wxUSE_RESOURCES == 1)
109 bool WxBindNewContext::TransferDataFromWindow()
111 name.length(1);
112 wxTextCtrl* ctrl = static_cast<wxTextCtrl*>( wxFindWindowByName(
113 "idText",
114 this));
115 assert( ctrl);
116 name[0].id = CORBA::string_dup( ctrl->GetValue());
118 ctrl = static_cast<wxTextCtrl*>( wxFindWindowByName(
119 "kindText",
120 this));
121 assert( ctrl);
122 name[0].kind = CORBA::string_dup( ctrl->GetValue());
124 return true;