summaryrefslogtreecommitdiff
path: root/TAO/utils/wxNamingViewer/wxBindNewContext.cpp
blob: 3bbe855380e416c73f6f55267d53dd5e804413d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// @file wxBindNewContext.cpp
//
// @author Charlie Frasch  <cfrasch@atdesk.com>
#include "pch.h"
#include "wxBindNewContext.h"

#include "wxNamingViewer.h"

namespace  // anonymous
{
  void create_dialog_components( wxDialog* dialog)
  {
    wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL);

    {
      wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL);
      sizer->Add(
                 new wxStaticText( dialog, -1, "ID:" ),
                 0,
                 wxALL,
                 5);
      wxTextCtrl* text = new wxTextCtrl(
                                        dialog,
                                        IDC_ID
                                        );
      text->SetName( "idText");
      sizer->Add(
                 text,
                 1,
                 wxALL,
                 5);
      topsizer->Add(
                    sizer,
                    0,
                    wxALIGN_LEFT | wxEXPAND);
    }

    {
      wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL);
      sizer->Add(
                 new wxStaticText( dialog, -1, "Kind:" ),
                 0,
                 wxALL,
                 5);
      wxTextCtrl* text = new wxTextCtrl(
                                        dialog,
                                        IDC_KIND
                                        );
      text->SetName( "kindText");
      sizer->Add(
                 text,
                 1,
                 wxALL,
                 5);
      topsizer->Add(
                    sizer,
                    0,
                    wxALIGN_LEFT | wxEXPAND);
    }

    wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL);
    {
      wxButton* okButton = new wxButton( dialog, wxID_OK, "OK" );
      okButton->SetName( "okButton");
      button_sizer->Add(
                        okButton,
                        0,
                        wxALL,
                        5);
    }
    {
      button_sizer->Add(
                        new wxButton( dialog, wxID_CANCEL, "Cancel" ),
                        0,
                        wxALL,
                        5);
    }
    topsizer->Add(
                  button_sizer,
                  0,
                  wxALIGN_CENTER);

    dialog->SetSizer( topsizer);
    topsizer->SetSizeHints( dialog);
  }
}; // anonymous

WxBindNewContext::WxBindNewContext( wxWindow* parent)
#if defined(wxUSE_RESOURCES) && (wxUSE_RESOURCES == 1)
  : wxDialog()
#else
   : wxDialog(
       parent,
       IDD_BIND_NEW_CONTEXT,
       "Bind New Context",
       wxDefaultPosition,
       wxSize( 300, 75),
       wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU,
       "bindNewContext")
#endif  // defined(wxUSE_RESOURCES) && (wxUSE_RESOURCES == 1)
 {
#if defined(wxUSE_RESOURCES) && (wxUSE_RESOURCES == 1)
    LoadFromResource( parent, "bindNewContext");
#else
   create_dialog_components( this);
#endif  // defined(wxUSE_RESOURCES) && (wxUSE_RESOURCES == 1)
 }

bool WxBindNewContext::TransferDataFromWindow()
{
  name.length(1);
  wxTextCtrl* ctrl = static_cast<wxTextCtrl*>( wxFindWindowByName(
      "idText",
      this));
  assert( ctrl);
  name[0].id = CORBA::string_dup( ctrl->GetValue());

  ctrl = static_cast<wxTextCtrl*>( wxFindWindowByName(
      "kindText",
      this));
  assert( ctrl);
  name[0].kind = CORBA::string_dup( ctrl->GetValue());

  return true;
}