~mapopa/flamerobin/master

« back to all changes in this revision

Viewing changes to src/FieldPropertiesFrame.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
  Contributor(s): Nando Dessena
 
22
*/
 
23
 
 
24
// For compilers that support precompilation, includes "wx/wx.h".
 
25
#include "wx/wxprec.h"
 
26
 
 
27
#ifdef __BORLANDC__
 
28
    #pragma hdrstop
 
29
#endif
 
30
 
 
31
// for all others, include the necessary headers (this file is usually all you
 
32
// need because it includes almost all "standard" wxWindows headers
 
33
#ifndef WX_PRECOMP
 
34
    #include "wx/wx.h"
 
35
#endif
 
36
//-----------------------------------------------------------------------------
 
37
// -*- C++ -*- generated by wxGlade 0.2.2 on Tue Aug 31 13:11:27 2004
 
38
 
 
39
#include "images.h"
 
40
#include "FieldPropertiesFrame.h"
 
41
 
 
42
 
 
43
FieldPropertiesFrame::FieldPropertiesFrame(wxWindow* parent, int id, wxString title, YTable *table, const wxPoint& pos, const wxSize& size, long style):
 
44
    BaseFrame(parent, id, title, pos, size, style)
 
45
{
 
46
        tableM = table;
 
47
        if (table)
 
48
                table->attach(this);
 
49
        fieldM = 0;
 
50
 
 
51
    // begin wxGlade: FieldPropertiesFrame::FieldPropertiesFrame
 
52
    panel_1 = new wxPanel(this, -1);
 
53
    label_8 = new wxStaticText(panel_1, -1, _("Field"));
 
54
    textctrl_fieldname = new wxTextCtrl(panel_1, ID_textctrl_fieldname, wxT(""));
 
55
    label_1 = new wxStaticText(panel_1, -1, _("Domain"));
 
56
    const wxString cb_domains_choices[] = {
 
57
        wxT(""),        // ugly hack. The control doesn't want to show big list for selection if initial list is short
 
58
        wxT(""),        //            so it looks really ugly on the screen
 
59
        wxT(""),
 
60
        wxT(""),
 
61
        wxT(""),
 
62
        wxT(""),
 
63
        wxT(""),
 
64
        wxT(""),
 
65
        wxT(""),
 
66
        wxT("")
 
67
    };
 
68
    cb_domains = new wxComboBox(panel_1, ID_cb_domains, wxT(""), wxDefaultPosition, wxDefaultSize, 10, cb_domains_choices, wxCB_DROPDOWN | wxCB_READONLY );
 
69
    button_edit_domain = new wxButton(panel_1, ID_button_edit_domain, _("Edit domain"));
 
70
    label_2 = new wxStaticText(panel_1, -1, _("Datatype"));
 
71
    const wxString cb_datatypes_choices[] = {
 
72
        wxT("Char"),
 
73
        wxT("Varchar"),
 
74
        wxT("Integer"),
 
75
        wxT("Smallint"),
 
76
        wxT("Numeric"),
 
77
        wxT("Decimal"),
 
78
        wxT("Float"),
 
79
        wxT("Double precision"),
 
80
        wxT("Date"),
 
81
        wxT("Time"),
 
82
        wxT("Timestamp"),
 
83
        wxT("Array"),
 
84
        wxT("Blob")
 
85
    };
 
86
 
 
87
    cb_datatypes = new wxComboBox(panel_1, -1, wxT(""), wxDefaultPosition, wxDefaultSize, 13, cb_datatypes_choices, wxCB_DROPDOWN|wxCB_READONLY );
 
88
    label_3 = new wxStaticText(panel_1, -1, _("Size"));
 
89
    textctrl_size = new wxTextCtrl(panel_1, -1, wxT(""));
 
90
    label_4 = new wxStaticText(panel_1, -1, _("Scale"));
 
91
    textctrl_scale = new wxTextCtrl(panel_1, -1, wxT(""));
 
92
    cb_notnull = new wxCheckBox(panel_1, -1, _("Not null"));
 
93
    label_5 = new wxStaticText(panel_1, -1, _("Charset"));
 
94
    const wxString cb_charset_choices[] = {
 
95
                wxT("NONE"),
 
96
                wxT("ASCII"),
 
97
                wxT("BIG_5"),
 
98
                wxT("CYRL"),
 
99
                wxT("DOS437"),
 
100
                wxT("DOS850"),
 
101
                wxT("DOS852"),
 
102
                wxT("DOS857"),
 
103
                wxT("DOS860"),
 
104
                wxT("DOS861"),
 
105
                wxT("DOS863"),
 
106
                wxT("DOS865"),
 
107
                wxT("EUCJ_0208"),
 
108
                wxT("GB_2312"),
 
109
                wxT("ISO8859_1"),
 
110
                wxT("ISO8859_2"),
 
111
                wxT("KSC_5601"),
 
112
                wxT("NEXT"),
 
113
                wxT("OCTETS"),
 
114
                wxT("SJIS_0208"),
 
115
                wxT("UNICODE_FSS"),
 
116
                wxT("WIN1250"),
 
117
                wxT("WIN1251"),
 
118
                wxT("WIN1252"),
 
119
                wxT("WIN1253"),
 
120
                wxT("WIN1254")
 
121
    };
 
122
    cb_charset = new wxComboBox(panel_1, ID_cb_charset, wxT(""), wxDefaultPosition, wxDefaultSize, 26, cb_charset_choices, wxCB_DROPDOWN | wxCB_READONLY);
 
123
    label_6 = new wxStaticText(panel_1, -1, _("Collate"));
 
124
    const wxString cb_collate_choices[] = {
 
125
        wxT(""),        // ugly hack. The control doesn't want to show big list for selection if initial list is short
 
126
        wxT(""),        //            so it looks really ugly on the screen
 
127
        wxT(""),
 
128
        wxT(""),
 
129
        wxT(""),
 
130
        wxT(""),
 
131
        wxT(""),
 
132
        wxT(""),
 
133
        wxT(""),
 
134
        wxT("")
 
135
    };
 
136
    cb_collate = new wxComboBox(panel_1, -1, wxT(""), wxDefaultPosition, wxDefaultSize, 10, cb_collate_choices, wxCB_DROPDOWN|wxCB_READONLY );
 
137
    static_line_1 = new wxStaticLine(panel_1, -1);
 
138
    label_7 = new wxStaticText(panel_1, -1, _("Autoincrement"));
 
139
    radio_new = new wxRadioButton(panel_1, ID_radio_new, _("Create new generator, named: "));
 
140
    textctrl_generatorname = new wxTextCtrl(panel_1, ID_textctrl_generatorname, wxT(""));
 
141
    radio_existing = new wxRadioButton(panel_1, ID_radio_existing, _("Use existing generator"));
 
142
    const wxString cb_generators_choices[] = {
 
143
        wxT(""),        // ugly hack. The control doesn't want to show big list for selection if initial list is short
 
144
        wxT(""),        //            so it looks really ugly on the screen
 
145
        wxT(""),
 
146
        wxT(""),
 
147
        wxT(""),
 
148
        wxT(""),
 
149
        wxT(""),
 
150
        wxT(""),
 
151
        wxT(""),
 
152
        wxT("")
 
153
    };
 
154
    cb_generators = new wxComboBox(panel_1, ID_cb_generators, wxT(""), wxDefaultPosition, wxDefaultSize, 10, cb_generators_choices, wxCB_DROPDOWN|wxCB_READONLY );
 
155
    cb_trigger = new wxCheckBox(panel_1, ID_cb_trigger, _("Create trigger"));
 
156
    textctrl_sql = new wxTextCtrl(panel_1, -1, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY);
 
157
    button_ok = new wxButton(panel_1, ID_button_ok, _("OK"));
 
158
    button_cancel = new wxButton(panel_1, ID_button_cancel, _("Cancel"));
 
159
 
 
160
    set_properties();
 
161
    do_layout();
 
162
    // end wxGlade
 
163
 
 
164
    wxBitmap bmp = getImage32(ntColumn);
 
165
    wxIcon icon;
 
166
    icon.CopyFromBitmap(bmp);
 
167
    SetIcon(icon);
 
168
 
 
169
        button_cancel->SetFocus();
 
170
}
 
171
//-----------------------------------------------------------------------------
 
172
void FieldPropertiesFrame::set_properties()
 
173
{
 
174
    // begin wxGlade: FieldPropertiesFrame::set_properties
 
175
    SetSize(wxSize(397, 386));
 
176
    cb_domains->SetSelection(0);
 
177
    cb_datatypes->SetSelection(0);
 
178
    cb_charset->SetSelection(0);
 
179
    label_7->SetFont(wxFont(9, wxDEFAULT, wxNORMAL, wxBOLD, 0, wxT("")));
 
180
    radio_existing->SetValue(1);
 
181
    cb_generators->SetSelection(0);
 
182
    textctrl_sql->SetSize(wxSize(383, 150));
 
183
    // end wxGlade
 
184
}
 
185
//-----------------------------------------------------------------------------
 
186
void FieldPropertiesFrame::do_layout()
 
187
{
 
188
    // begin wxGlade: FieldPropertiesFrame::do_layout
 
189
    wxBoxSizer* sizer_1 = new wxBoxSizer(wxVERTICAL);
 
190
    wxBoxSizer* sizer_2 = new wxBoxSizer(wxVERTICAL);
 
191
    wxBoxSizer* sizer_3 = new wxBoxSizer(wxHORIZONTAL);
 
192
    wxBoxSizer* sizer_8 = new wxBoxSizer(wxHORIZONTAL);
 
193
    wxBoxSizer* sizer_9 = new wxBoxSizer(wxHORIZONTAL);
 
194
    wxBoxSizer* sizer_10 = new wxBoxSizer(wxHORIZONTAL);
 
195
    wxBoxSizer* sizer_7 = new wxBoxSizer(wxHORIZONTAL);
 
196
    wxBoxSizer* sizer_6 = new wxBoxSizer(wxHORIZONTAL);
 
197
    wxBoxSizer* sizer_5 = new wxBoxSizer(wxHORIZONTAL);
 
198
    wxBoxSizer* sizer_4 = new wxBoxSizer(wxHORIZONTAL);
 
199
    sizer_4->Add(label_8, 0, wxALL|wxALIGN_CENTER_VERTICAL, 4);
 
200
    sizer_4->Add(textctrl_fieldname, 1, wxALL, 3);
 
201
    sizer_2->Add(sizer_4, 0, wxALL|wxEXPAND, 2);
 
202
    sizer_5->Add(label_1, 0, wxALL, 4);
 
203
    sizer_5->Add(cb_domains, 0, wxALL, 1);
 
204
    sizer_5->Add(button_edit_domain, 0, wxLEFT, 2);
 
205
    sizer_2->Add(sizer_5, 0, wxALL, 2);
 
206
    sizer_6->Add(label_2, 0, wxALL, 4);
 
207
    sizer_6->Add(cb_datatypes, 0, 0, 0);
 
208
    sizer_6->Add(label_3, 0, wxALL, 4);
 
209
    sizer_6->Add(textctrl_size, 0, 0, 0);
 
210
    sizer_6->Add(label_4, 0, wxALL, 4);
 
211
    sizer_6->Add(textctrl_scale, 0, 0, 0);
 
212
    sizer_2->Add(sizer_6, 0, wxALL, 2);
 
213
    sizer_7->Add(cb_notnull, 0, wxALL, 4);
 
214
    sizer_7->Add(35, 10, 0, 0, 0);
 
215
    sizer_7->Add(label_5, 0, wxALL, 4);
 
216
    sizer_7->Add(cb_charset, 0, wxRIGHT, 10);
 
217
    sizer_7->Add(label_6, 0, wxALL, 4);
 
218
    sizer_7->Add(cb_collate, 0, 0, 0);
 
219
    sizer_2->Add(sizer_7, 0, wxALL, 2);
 
220
    sizer_2->Add(static_line_1, 0, wxALL|wxEXPAND, 5);
 
221
    sizer_2->Add(label_7, 0, wxALL, 4);
 
222
    sizer_10->Add(radio_new, 0, wxALL, 3);
 
223
    sizer_10->Add(textctrl_generatorname, 1, 0, 0);
 
224
    sizer_2->Add(sizer_10, 0, wxALL|wxEXPAND, 2);
 
225
    sizer_9->Add(radio_existing, 0, wxALL, 3);
 
226
    sizer_9->Add(cb_generators, 1, 0, 0);
 
227
    sizer_2->Add(sizer_9, 0, wxALL|wxEXPAND, 2);
 
228
    sizer_8->Add(cb_trigger, 0, wxLEFT, 3);
 
229
    sizer_2->Add(sizer_8, 0, wxALL, 2);
 
230
    sizer_2->Add(textctrl_sql, 1, wxALL|wxEXPAND, 3);
 
231
    sizer_3->Add(button_ok, 0, wxALL, 3);
 
232
    sizer_3->Add(button_cancel, 0, wxALL, 3);
 
233
    sizer_2->Add(sizer_3, 0, wxALIGN_CENTER_HORIZONTAL, 0);
 
234
    panel_1->SetAutoLayout(true);
 
235
    panel_1->SetSizer(sizer_2);
 
236
    sizer_2->Fit(panel_1);
 
237
    sizer_2->SetSizeHints(panel_1);
 
238
    sizer_1->Add(panel_1, 1, wxEXPAND, 0);
 
239
    SetAutoLayout(true);
 
240
    SetSizer(sizer_1);
 
241
    sizer_1->Fit(this);
 
242
    sizer_1->SetSizeHints(this);
 
243
    Layout();
 
244
    // end wxGlade
 
245
}
 
246
//-----------------------------------------------------------------------------