2
* This file is part of wxSmith plugin for Code::Blocks Studio
3
* Copyright (C) 2006-2007 Bartlomiej Swiecki
5
* wxSmith is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 3 of the License, or
8
* (at your option) any later version.
10
* wxSmith is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with wxSmith. If not, see <http://www.gnu.org/licenses/>.
19
* $Id: wxssizerparentqp.cpp 4850 2008-01-29 21:45:49Z byo $
20
* $HeadURL: svn://svn.berlios.de/codeblocks/tags/8.02/src/plugins/contrib/wxSmith/wxwidgets/wxssizerparentqp.cpp $
23
#include "wxssizerparentqp.h"
25
//(*InternalHeaders(wxsSizerParentQP)
27
#include <wx/string.h>
30
//(*IdInit(wxsSizerParentQP)
31
const long wxsSizerParentQP::ID_CHECKBOX1 = wxNewId();
32
const long wxsSizerParentQP::ID_CHECKBOX2 = wxNewId();
33
const long wxsSizerParentQP::ID_CHECKBOX3 = wxNewId();
34
const long wxsSizerParentQP::ID_CHECKBOX4 = wxNewId();
35
const long wxsSizerParentQP::ID_SPINCTRL1 = wxNewId();
36
const long wxsSizerParentQP::ID_CHECKBOX7 = wxNewId();
37
const long wxsSizerParentQP::ID_RADIOBUTTON4 = wxNewId();
38
const long wxsSizerParentQP::ID_RADIOBUTTON5 = wxNewId();
39
const long wxsSizerParentQP::ID_RADIOBUTTON6 = wxNewId();
40
const long wxsSizerParentQP::ID_RADIOBUTTON7 = wxNewId();
41
const long wxsSizerParentQP::ID_RADIOBUTTON8 = wxNewId();
42
const long wxsSizerParentQP::ID_RADIOBUTTON9 = wxNewId();
43
const long wxsSizerParentQP::ID_RADIOBUTTON10 = wxNewId();
44
const long wxsSizerParentQP::ID_RADIOBUTTON11 = wxNewId();
45
const long wxsSizerParentQP::ID_RADIOBUTTON12 = wxNewId();
46
const long wxsSizerParentQP::ID_CHECKBOX6 = wxNewId();
47
const long wxsSizerParentQP::ID_CHECKBOX5 = wxNewId();
48
const long wxsSizerParentQP::ID_SPINCTRL2 = wxNewId();
51
BEGIN_EVENT_TABLE(wxsSizerParentQP,wxPanel)
52
//(*EventTable(wxsSizerParentQP)
56
wxsSizerParentQP::wxsSizerParentQP(wxsAdvQPP* parent,wxsSizerExtra* Extra,wxWindowID id):
57
wxsAdvQPPChild(parent,_("Sizer")),
60
//(*Initialize(wxsSizerParentQP)
61
wxStaticBoxSizer* StaticBoxSizer2;
62
wxFlexGridSizer* FlexGridSizer2;
63
wxGridSizer* GridSizer1;
64
wxStaticBoxSizer* StaticBoxSizer1;
66
Create(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("id"));
67
FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0);
68
FlexGridSizer1->AddGrowableCol(1);
69
StaticBoxSizer1 = new wxStaticBoxSizer(wxVERTICAL, this, _("Border"));
70
FlexGridSizer2 = new wxFlexGridSizer(0, 2, 0, 0);
71
FlexGridSizer2->AddGrowableCol(1);
72
GridSizer1 = new wxGridSizer(0, 3, 0, 0);
73
GridSizer1->Add(0,0,1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
74
BrdTop = new wxCheckBox(this, ID_CHECKBOX1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1"));
75
BrdTop->SetValue(false);
76
GridSizer1->Add(BrdTop, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
77
GridSizer1->Add(0,0,1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
78
BrdLeft = new wxCheckBox(this, ID_CHECKBOX2, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX2"));
79
BrdLeft->SetValue(false);
80
GridSizer1->Add(BrdLeft, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
81
GridSizer1->Add(0,0,1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
82
BrdRight = new wxCheckBox(this, ID_CHECKBOX3, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX3"));
83
BrdRight->SetValue(false);
84
GridSizer1->Add(BrdRight, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
85
GridSizer1->Add(0,0,1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
86
BrdBottom = new wxCheckBox(this, ID_CHECKBOX4, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX4"));
87
BrdBottom->SetValue(false);
88
GridSizer1->Add(BrdBottom, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
89
FlexGridSizer2->Add(GridSizer1, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
90
BrdSize = new wxSpinCtrl(this, ID_SPINCTRL1, _T("0"), wxDefaultPosition, wxSize(51,-1), 0, 0, 100, 0, _T("ID_SPINCTRL1"));
91
BrdSize->SetValue(_T("0"));
92
FlexGridSizer2->Add(BrdSize, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
93
StaticBoxSizer1->Add(FlexGridSizer2, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
94
BrdDlg = new wxCheckBox(this, ID_CHECKBOX7, _("Dialog Units"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX7"));
95
BrdDlg->SetValue(false);
96
StaticBoxSizer1->Add(BrdDlg, 0, wxTOP|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
97
FlexGridSizer1->Add(StaticBoxSizer1, 1, wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
98
StaticBoxSizer2 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Placement"));
99
FlexGridSizer3 = new wxFlexGridSizer(0, 0, 0, 0);
100
GridSizer2 = new wxGridSizer(3, 3, 0, 0);
101
PlaceLT = new wxRadioButton(this, ID_RADIOBUTTON4, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_RADIOBUTTON4"));
102
GridSizer2->Add(PlaceLT, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
103
PlaceCT = new wxRadioButton(this, ID_RADIOBUTTON5, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_RADIOBUTTON5"));
104
GridSizer2->Add(PlaceCT, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
105
PlaceRT = new wxRadioButton(this, ID_RADIOBUTTON6, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_RADIOBUTTON6"));
106
GridSizer2->Add(PlaceRT, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
107
PlaceLC = new wxRadioButton(this, ID_RADIOBUTTON7, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_RADIOBUTTON7"));
108
GridSizer2->Add(PlaceLC, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
109
PlaceCC = new wxRadioButton(this, ID_RADIOBUTTON8, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_RADIOBUTTON8"));
110
GridSizer2->Add(PlaceCC, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
111
PlaceRC = new wxRadioButton(this, ID_RADIOBUTTON9, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_RADIOBUTTON9"));
112
GridSizer2->Add(PlaceRC, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
113
PlaceLB = new wxRadioButton(this, ID_RADIOBUTTON10, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_RADIOBUTTON10"));
114
GridSizer2->Add(PlaceLB, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
115
PlaceCB = new wxRadioButton(this, ID_RADIOBUTTON11, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_RADIOBUTTON11"));
116
GridSizer2->Add(PlaceCB, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
117
PlaceRB = new wxRadioButton(this, ID_RADIOBUTTON12, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_RADIOBUTTON12"));
118
GridSizer2->Add(PlaceRB, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
119
FlexGridSizer3->Add(GridSizer2, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
120
BoxSizer1 = new wxBoxSizer(wxVERTICAL);
121
PlaceShp = new wxCheckBox(this, ID_CHECKBOX6, _("Shaped"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX6"));
122
PlaceShp->SetValue(false);
123
BoxSizer1->Add(PlaceShp, 1, wxTOP|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2);
124
PlaceExp = new wxCheckBox(this, ID_CHECKBOX5, _("Expand"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX5"));
125
PlaceExp->SetValue(false);
126
BoxSizer1->Add(PlaceExp, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
127
FlexGridSizer3->Add(BoxSizer1, 1, wxLEFT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10);
128
StaticBoxSizer2->Add(FlexGridSizer3, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
129
FlexGridSizer1->Add(StaticBoxSizer2, 1, wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
130
StaticBoxSizer3 = new wxStaticBoxSizer(wxVERTICAL, this, _("Proportion"));
131
Proportion = new wxSpinCtrl(this, ID_SPINCTRL2, _T("0"), wxDefaultPosition, wxSize(65,21), 0, 0, 100, 0, _T("ID_SPINCTRL2"));
132
Proportion->SetValue(_T("0"));
133
StaticBoxSizer3->Add(Proportion, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
134
FlexGridSizer1->Add(StaticBoxSizer3, 1, wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
135
SetSizer(FlexGridSizer1);
136
FlexGridSizer1->Fit(this);
137
FlexGridSizer1->SetSizeHints(this);
139
Connect(ID_CHECKBOX1,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&wxsSizerParentQP::OnBrdChange);
140
Connect(ID_CHECKBOX2,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&wxsSizerParentQP::OnBrdChange);
141
Connect(ID_CHECKBOX3,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&wxsSizerParentQP::OnBrdChange);
142
Connect(ID_CHECKBOX4,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&wxsSizerParentQP::OnBrdChange);
143
Connect(ID_SPINCTRL1,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)&wxsSizerParentQP::OnBrdSizeChange);
144
Connect(ID_CHECKBOX7,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&wxsSizerParentQP::OnBrdDlgChange);
145
Connect(ID_RADIOBUTTON4,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&wxsSizerParentQP::OnPlaceChange);
146
Connect(ID_RADIOBUTTON5,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&wxsSizerParentQP::OnPlaceChange);
147
Connect(ID_RADIOBUTTON6,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&wxsSizerParentQP::OnPlaceChange);
148
Connect(ID_RADIOBUTTON7,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&wxsSizerParentQP::OnPlaceChange);
149
Connect(ID_RADIOBUTTON8,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&wxsSizerParentQP::OnPlaceChange);
150
Connect(ID_RADIOBUTTON9,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&wxsSizerParentQP::OnPlaceChange);
151
Connect(ID_RADIOBUTTON10,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&wxsSizerParentQP::OnPlaceChange);
152
Connect(ID_RADIOBUTTON11,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&wxsSizerParentQP::OnPlaceChange);
153
Connect(ID_RADIOBUTTON12,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&wxsSizerParentQP::OnPlaceChange);
154
Connect(ID_CHECKBOX6,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&wxsSizerParentQP::OnPlaceChange);
155
Connect(ID_CHECKBOX5,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&wxsSizerParentQP::OnPlaceChange);
156
Connect(ID_SPINCTRL2,wxEVT_COMMAND_SPINCTRL_UPDATED,(wxObjectEventFunction)&wxsSizerParentQP::OnProportionChange);
162
void wxsSizerParentQP::OnBrdChange(wxCommandEvent& event)
167
void wxsSizerParentQP::OnBrdSizeChange(wxSpinEvent& event)
172
void wxsSizerParentQP::OnPlaceChange(wxCommandEvent& event)
177
void wxsSizerParentQP::OnProportionChange(wxSpinEvent& event)
182
void wxsSizerParentQP::ReadData()
184
if ( !GetPropertyContainer() || !m_Extra ) return;
186
BrdLeft ->SetValue((m_Extra->Flags & wxsSizerFlagsProperty::BorderLeft) != 0 );
187
BrdRight ->SetValue((m_Extra->Flags & wxsSizerFlagsProperty::BorderRight) != 0 );
188
BrdTop ->SetValue((m_Extra->Flags & wxsSizerFlagsProperty::BorderTop) != 0 );
189
BrdBottom ->SetValue((m_Extra->Flags & wxsSizerFlagsProperty::BorderBottom) != 0 );
190
PlaceExp ->SetValue((m_Extra->Flags & wxsSizerFlagsProperty::Expand) != 0);
191
PlaceShp ->SetValue((m_Extra->Flags & wxsSizerFlagsProperty::Shaped) != 0);
192
BrdSize ->SetValue(m_Extra->Border.Value);
193
BrdDlg ->SetValue(m_Extra->Border.DialogUnits);
194
Proportion->SetValue(m_Extra->Proportion);
196
if ( m_Extra->Flags & wxsSizerFlagsProperty::AlignBottom )
198
if ( m_Extra->Flags & wxsSizerFlagsProperty::AlignRight ) PlaceRB->SetValue(true); else
199
if ( m_Extra->Flags & wxsSizerFlagsProperty::AlignCenterHorizontal ) PlaceCB->SetValue(true); else
200
PlaceLB->SetValue(true);
202
else if ( m_Extra->Flags & wxsSizerFlagsProperty::AlignCenterVertical )
204
if ( m_Extra->Flags & wxsSizerFlagsProperty::AlignRight ) PlaceRC->SetValue(true); else
205
if ( m_Extra->Flags & wxsSizerFlagsProperty::AlignCenterHorizontal ) PlaceCC->SetValue(true); else
206
PlaceLC->SetValue(true);
210
if ( m_Extra->Flags & wxsSizerFlagsProperty::AlignRight ) PlaceRT->SetValue(true); else
211
if ( m_Extra->Flags & wxsSizerFlagsProperty::AlignCenterHorizontal ) PlaceCT->SetValue(true); else
212
PlaceLT->SetValue(true);
216
void wxsSizerParentQP::SaveData()
218
if ( !GetPropertyContainer() || !m_Extra ) return;
221
if ( BrdLeft ->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::BorderLeft;
222
if ( BrdRight ->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::BorderRight;
223
if ( BrdTop ->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::BorderTop;
224
if ( BrdBottom->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::BorderBottom;
225
if ( PlaceExp ->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::Expand;
226
if ( PlaceShp ->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::Shaped;
227
m_Extra->Border.Value = BrdSize->GetValue();
228
m_Extra->Border.DialogUnits = BrdDlg->GetValue();
229
m_Extra->Proportion = Proportion->GetValue();
230
if ( PlaceLT->GetValue() || PlaceCT->GetValue() || PlaceRT->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::AlignTop;
231
if ( PlaceLC->GetValue() || PlaceCC->GetValue() || PlaceRC->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::AlignCenterVertical;
232
if ( PlaceLB->GetValue() || PlaceCB->GetValue() || PlaceRB->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::AlignBottom;
233
if ( PlaceLT->GetValue() || PlaceLC->GetValue() || PlaceLB->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::AlignLeft;
234
if ( PlaceCT->GetValue() || PlaceCC->GetValue() || PlaceCB->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::AlignCenterHorizontal;
235
if ( PlaceRT->GetValue() || PlaceRC->GetValue() || PlaceRB->GetValue() ) m_Extra->Flags |= wxsSizerFlagsProperty::AlignRight;
240
wxsSizerParentQP::~wxsSizerParentQP()
242
//(*Destroy(wxsSizerParentQP)
246
void wxsSizerParentQP::OnBrdDlgChange(wxCommandEvent& event)
251
void wxsSizerParentQP::Update()