~mapopa/flamerobin/master

« back to all changes in this revision

Viewing changes to src/ServerRegistrationInfoFrame.cpp

  • Committer: Michael Hieke
  • Date: 2004-11-22 11:34:42 UTC
  • Revision ID: git-v1:8153b493d66ee7aae55e7b34e0d7bddacf4999ef
Initial revision

svn path=/trunk/flamerobin/; revision=13

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  The contents of this file are subject to the Initial Developer's Public
 
3
  License Version 1.0 (the "License"); you may not use this file except in
 
4
  compliance with the License. You may obtain a copy of the License here:
 
5
  http://www.flamerobin.org/license.html.
 
6
 
 
7
  Software distributed under the License is distributed on an "AS IS"
 
8
  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 
9
  License for the specific language governing rights and limitations under
 
10
  the License.
 
11
 
 
12
  The Original Code is FlameRobin (TM).
 
13
 
 
14
  The Initial Developer of the Original Code is Milan Babuskov.
 
15
 
 
16
  Portions created by the original developer
 
17
  are Copyright (C) 2004 Milan Babuskov.
 
18
 
 
19
  All Rights Reserved.
 
20
 
 
21
  $Id$
 
22
 
 
23
  Contributor(s): Michael Hieke
 
24
*/
 
25
 
 
26
// For compilers that support precompilation, includes "wx/wx.h".
 
27
#include "wx/wxprec.h"
 
28
 
 
29
#ifdef __BORLANDC__
 
30
    #pragma hdrstop
 
31
#endif
 
32
 
 
33
// for all others, include the necessary headers (this file is usually all you
 
34
// need because it includes almost all "standard" wxWindows headers
 
35
#ifndef WX_PRECOMP
 
36
    #include "wx/wx.h"
 
37
#endif
 
38
//-----------------------------------------------------------------------------
 
39
// -*- C++ -*- generated by wxGlade 0.2.2 on Fri Jul 02 11:09:50 2004
 
40
 
 
41
#include "ServerRegistrationInfoFrame.h"
 
42
#include "frutils.h"
 
43
#include "styleguide.h"
 
44
 
 
45
ServerRegistrationInfoFrame::ServerRegistrationInfoFrame(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style):
 
46
    BaseDialog(parent, id, title, pos, size, style)
 
47
{
 
48
    // begin wxGlade: ServerRegistrationInfoFrame::ServerRegistrationInfoFrame
 
49
    label_1 = new wxStaticText(this, -1, _("Hostname:"));
 
50
    text_ctrl_1 = new wxTextCtrl(this, ID_textctrl_server, wxT("localhost"));
 
51
    label_2 = new wxStaticText(this, -1, _("Port number:"));
 
52
    text_ctrl_2 = new wxTextCtrl(this, -1, wxT("3050"));
 
53
    button_ok = new wxButton(this, ID_button_ok, _("OK"));
 
54
    button_cancel = new wxButton(this, ID_button_cancel, _("Cancel"));
 
55
 
 
56
    set_properties();
 
57
    do_layout();
 
58
        updateButtons();
 
59
}
 
60
 
 
61
 
 
62
void ServerRegistrationInfoFrame::set_properties()
 
63
{
 
64
        button_ok->SetDefault();
 
65
}
 
66
 
 
67
 
 
68
void ServerRegistrationInfoFrame::do_layout()
 
69
{
 
70
#if wxCHECK_VERSION(2, 5, 3)
 
71
        // create sizer for controls
 
72
        wxFlexGridSizer* sizerControls = new wxFlexGridSizer(2, 2, 
 
73
                styleguide().getRelatedControlMargin(wxVERTICAL),
 
74
                styleguide().getControlLabelMargin());
 
75
        sizerControls->AddGrowableCol(1);
 
76
 
 
77
        sizerControls->Add(label_1, 0, wxALIGN_CENTER_VERTICAL);
 
78
        sizerControls->Add(text_ctrl_1, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL);
 
79
        sizerControls->Add(label_2, 0, wxALIGN_CENTER_VERTICAL);
 
80
        sizerControls->Add(text_ctrl_2, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL);
 
81
#else
 
82
        // make all labels have the same width to simulate a grid of controls
 
83
        std::list<wxWindow*> controls;
 
84
        controls.push_back(label_1);
 
85
        controls.push_back(label_2);
 
86
        adjustControlsMinWidth(controls);
 
87
        controls.clear();
 
88
 
 
89
        // create sizers hierarchy for controls
 
90
        wxBoxSizer* sizerRow1 = new wxBoxSizer(wxHORIZONTAL);
 
91
        sizerRow1->Add(label_1, 0, wxALIGN_CENTER_VERTICAL);
 
92
        sizerRow1->Add(styleguide().getControlLabelMargin(), 0);
 
93
        sizerRow1->Add(text_ctrl_1, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL);
 
94
 
 
95
        wxBoxSizer* sizerRow2 = new wxBoxSizer(wxHORIZONTAL);
 
96
        sizerRow2->Add(label_2, 0, wxALIGN_CENTER_VERTICAL);
 
97
        sizerRow2->Add(styleguide().getControlLabelMargin(), 0);
 
98
        sizerRow2->Add(text_ctrl_2, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL);
 
99
 
 
100
        wxBoxSizer* sizerControls = new wxBoxSizer(wxVERTICAL);
 
101
        sizerControls->Add(sizerRow1, 0, wxEXPAND);
 
102
        sizerControls->Add(0, styleguide().getRelatedControlMargin(wxVERTICAL));
 
103
        sizerControls->Add(sizerRow2, 0, wxEXPAND);
 
104
#endif
 
105
 
 
106
        // create sizer for buttons -> styleguide class will align it correctly
 
107
        wxSizer* sizerButtons = styleguide().createButtonSizer(button_ok, button_cancel);
 
108
 
 
109
        // use method in base class to set everything up
 
110
        layoutSizers(sizerControls, sizerButtons);
 
111
}