1 /////////////////////////////////////////////////////////////////////////////
2 // Name: propeditor.cpp
3 // Purpose: wxWidgets Configuration Tool property editor
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx/wx.h".
13 #include "wx/wxprec.h"
22 #include "wx/filedlg.h"
26 #include "wx/html/htmlwin.h"
27 #include "wx/tokenzr.h"
28 #include "wx/valgen.h"
29 #include "propeditor.h"
32 #include "configtooldoc.h"
33 #include "configitemselector.h"
35 #include "bitmaps/ellipsis.xpm"
39 * A container window for the property editor.
40 * and attribute editor.
43 IMPLEMENT_CLASS(ctPropertyEditor
, wxPanel
)
45 BEGIN_EVENT_TABLE(ctPropertyEditor
, wxPanel
)
46 EVT_BUTTON(ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS
, ctPropertyEditor::OnEditDetails
)
47 EVT_GRID_SELECT_CELL(ctPropertyEditor::OnSelectCell
)
48 EVT_GRID_CELL_CHANGE(ctPropertyEditor::OnChangeCell
)
49 EVT_GRID_CELL_LEFT_DCLICK(ctPropertyEditor::OnDClickCell
)
50 EVT_UPDATE_UI(ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS
, ctPropertyEditor::OnUpdateEditDetails
)
53 ctPropertyEditor::ctPropertyEditor(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
):
54 wxPanel(parent
, id
, pos
, size
, style
)
56 m_splitterWindow
= NULL
;
57 m_attributeEditorGrid
= NULL
;
58 m_propertyDescriptionWindow
= NULL
;
59 m_elementTitleTextCtrl
= NULL
;
64 void ctPropertyEditor::CreateControls(wxWindow
* parent
)
66 m_elementTitleTextCtrl
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
, wxDefaultPosition
, wxDefaultSize
, wxTE_READONLY
);
67 wxBitmap
detailsIcon(ellipsis_xpm
);
69 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
71 wxBoxSizer
*item1
= new wxBoxSizer( wxHORIZONTAL
);
73 wxTextCtrl
*item2
= m_elementTitleTextCtrl
;
74 item1
->Add( item2
, 1, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5 );
76 m_attributeEditorEditDetails
= new wxButton( parent
, ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS
, wxT("Edit..."));
77 item1
->Add( m_attributeEditorEditDetails
, 0, wxALIGN_CENTRE
|wxRIGHT
|wxTOP
|wxBOTTOM
, 5 );
79 item0
->Add( item1
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
, 5 );
81 // TODO: find sash pos from last time
84 m_splitterWindow
= new wxSplitterWindow(parent
, ctID_PROPERTY_EDITOR_SPLITTER
, wxDefaultPosition
, wxSize(500, 400), wxSP_3DSASH
|wxSP_FULLSASH
/*|wxCLIP_CHILDREN*/ |wxBORDER_NONE
|wxNO_FULL_REPAINT_ON_RESIZE
);
85 m_splitterWindow
->SetMinimumPaneSize(10);
87 m_propertyDescriptionWindow
= new wxHtmlWindow(m_splitterWindow
, ctID_ATTRIBUTE_EDITOR_DESCRIPTION
, wxDefaultPosition
, wxSize(200, 60), wxSUNKEN_BORDER
);
88 m_propertyDescriptionWindow
->SetBackgroundColour(ctDESCRIPTION_BACKGROUND_COLOUR
);
89 m_propertyDescriptionWindow
->SetBorders(4);
90 m_attributeEditorGrid
= new ctPropertyEditorGrid(m_splitterWindow
, ctID_ATTRIBUTE_EDITOR_GRID
, wxPoint(0, 0), wxSize(200, 100), wxBORDER_SUNKEN
| wxWANTS_CHARS
);
92 m_splitterWindow
->SplitHorizontally(m_propertyDescriptionWindow
, m_attributeEditorGrid
, sashPos
);
94 // TODO: show or hide description window
96 // ShowDescriptionWindow(false);
98 item0
->Add( m_splitterWindow
, 1, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxRIGHT
|wxBOTTOM
, 5 );
100 this->SetSizer( item0
);
103 m_elementTitleTextCtrl
->SetHelpText(_("The title of the property being edited."));
104 m_attributeEditorEditDetails
->SetHelpText(_("Click to use an appropriate editor for the selected property (if any)."));
105 m_attributeEditorGrid
->SetHelpText(_("Shows the properties of the selected item."));
106 m_propertyDescriptionWindow
->SetHelpText(_("Shows a description of the selected property, or a summary of the whole item."));
108 /// Set up the grid to display properties
109 m_attributeEditorGrid
->RegisterDataType(ctGRID_VALUE_STRING
,
110 new wxGridCellStringRenderer
,
111 new ctGridCellTextEditor
);
113 m_attributeEditorGrid
->CreateGrid( 0, 2, wxGrid::wxGridSelectRows
);
114 m_attributeEditorGrid
->SetRowLabelSize(0);
115 m_attributeEditorGrid
->SetColLabelSize(0 /* 18 */);
117 wxArrayString columns
;
118 columns
.Add(_T("Name"));
119 columns
.Add(_T("Value"));
121 m_attributeEditorGrid
->SetColSize(0, 140);
122 m_attributeEditorGrid
->SetColSize(1, 80);
124 m_attributeEditorGrid
->SetColumnsToDisplay(columns
);
125 m_attributeEditorGrid
->DisplayLabels();
127 m_attributeEditorGrid
->SetStretchableColumn(1);
129 m_attributeEditorGrid
->SetDefaultCellBackgroundColour(ctCELL_BACKGROUND_COLOUR
);
134 /// Show/hide the description control
135 void ctPropertyEditor::ShowDescriptionWindow(bool show
)
139 if (m_splitterWindow
->IsSplit())
140 m_splitterWindow
->Unsplit(m_propertyDescriptionWindow
);
146 m_propertyDescriptionWindow
->Show(true);
147 if (!m_splitterWindow
->IsSplit())
149 m_splitterWindow
->SplitHorizontally(m_propertyDescriptionWindow
, m_attributeEditorGrid
, pos
);
154 /// Clear grid editor
155 void ctPropertyEditor::ClearEditor()
157 m_attributeEditorGrid
->ClearAttributes();
158 m_propertyDescriptionWindow
->SetPage(WrapDescription(wxEmptyString
));
159 m_elementTitleTextCtrl
->SetValue(wxEmptyString
);
162 /// Handles detailed editing event.
163 void ctPropertyEditor::OnEditDetails(wxCommandEvent
& WXUNUSED(event
))
165 wxWindow
* parentFrame
= this;
166 while (parentFrame
&& !parentFrame
->IsKindOf(CLASSINFO(wxFrame
)))
167 parentFrame
= parentFrame
->GetParent();
169 EditDetails(parentFrame
);
172 /// Handles detailed editing update event.
173 void ctPropertyEditor::OnUpdateEditDetails(wxUpdateUIEvent
& event
)
175 event
.Enable(CanEditDetails());
178 /// Can we edit the details of the selected property?
179 bool ctPropertyEditor::CanEditDetails()
185 ctProperty
* prop
= FindSelectedProperty(row
);
186 if (!prop
|| prop
->GetEditorType().empty())
192 void ctPropertyEditor::ShowItem(ctConfigItem
* item
)
194 if (m_attributeEditorGrid
->IsCellEditControlEnabled())
195 m_attributeEditorGrid
->SaveEditControlValue();
204 m_attributeEditorGrid
->AppendRows(m_item
->GetProperties().GetCount());
206 wxObjectList::compatibility_iterator node
= m_item
->GetProperties().GetList().GetFirst();
210 ctProperty
* prop
= (ctProperty
*) node
->GetData();
211 DisplayProperty(i
, prop
);
214 node
= node
->GetNext();
216 // Make sure scrollbars are up-to-date, etc.
217 wxSizeEvent
event(m_attributeEditorGrid
->GetSize(), m_attributeEditorGrid
->GetId());
218 m_attributeEditorGrid
->GetEventHandler()->ProcessEvent(event
);
220 DisplayDefaultProperty();
228 /// Determine background colour for this property.
229 void ctPropertyEditor::DeterminePropertyColour(ctProperty
* prop
, wxColour
& colour
)
231 if (prop
->IsCustom())
232 colour
= ctCUSTOM_CELL_BACKGROUND_COLOUR
;
234 colour
= ctCELL_BACKGROUND_COLOUR
;
237 /// Update the title at the top of the property editor
238 void ctPropertyEditor::UpdateTitle()
242 wxString
name(m_item
->GetTitle());
243 m_elementTitleTextCtrl
->SetValue(name
);
247 /// Updates the item display, assuming it was already displayed.
248 void ctPropertyEditor::UpdateItem()
250 if (m_attributeEditorGrid
->IsCellEditControlEnabled())
251 m_attributeEditorGrid
->SaveEditControlValue();
256 wxObjectList::compatibility_iterator node
= m_item
->GetProperties().GetList().GetFirst();
260 ctProperty
* prop
= (ctProperty
*) node
->GetData();
261 DisplayProperty(i
, prop
, true);
264 node
= node
->GetNext();
266 // Make sure scrollbars are up-to-date, etc.
267 wxSizeEvent
event(m_attributeEditorGrid
->GetSize(), this->GetId());
268 m_attributeEditorGrid
->GetEventHandler()->ProcessEvent(event
);
272 /// Display attribute at given row
273 bool ctPropertyEditor::DisplayProperty(int row
, ctProperty
* prop
, bool valueOnly
)
275 wxColour backgroundColour
;
277 DeterminePropertyColour(prop
, backgroundColour
);
281 m_attributeEditorGrid
->SetCellBackgroundColour(row
, 0, backgroundColour
);
282 m_attributeEditorGrid
->SetCellBackgroundColour(row
, 1, backgroundColour
);
284 m_attributeEditorGrid
->SetCellValue(row
, 0, prop
->GetName());
286 m_attributeEditorGrid
->SetReadOnly(row
, 0);
288 m_attributeEditorGrid
->SetCellAlignment(row
, 1, wxALIGN_LEFT
, wxALIGN_CENTER
);
291 if (!m_item
->CanEditProperty(prop
->GetName()))
293 m_attributeEditorGrid
->SetReadOnly(row
, 1);
295 wxColour
col(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT
));
296 m_attributeEditorGrid
->SetCellTextColour(row
, 1, col
);
300 m_attributeEditorGrid
->SetReadOnly(row
, 1, false);
301 m_attributeEditorGrid
->SetCellTextColour(row
, 1, * wxBLACK
);
305 m_attributeEditorGrid
->SetCellValue(row
, 1, ctConvertToSingleText(prop
->GetValue()));
310 // Set the value type
311 if (prop
->GetEditorType() == _T("choice"))
314 wxString
* strArr
= prop
->GetChoices().GetStringArray();
316 m_attributeEditorGrid
->SetCellEditor(row
, 1,
317 new wxGridCellChoiceEditor(prop
->GetChoices().GetCount(), strArr
));
321 m_attributeEditorGrid
->SetCellEditor(row
, 1,
322 new wxGridCellChoiceEditor(prop
->GetChoices()));
324 else if (prop
->GetEditorType() == _T("integer") || prop
->GetVariant().GetType() == _T("long"))
326 m_attributeEditorGrid
->SetCellEditor(row
, 1,
327 new wxGridCellNumberEditor
);
329 else if (prop
->GetEditorType() == _T("float") || prop
->GetVariant().GetType() == _T("double"))
331 m_attributeEditorGrid
->SetCellEditor(row
, 1,
332 new wxGridCellFloatEditor
);
334 else if (prop
->GetEditorType() == _T("bool") || prop
->GetVariant().GetType() == _T("bool"))
336 m_attributeEditorGrid
->SetCellValue(row
, 1, prop
->GetVariant().GetBool() ? _T("1") : _T("0"));
337 m_attributeEditorGrid
->SetCellEditor(row
, 1,
338 new wxGridCellBoolEditor
);
339 m_attributeEditorGrid
->SetCellRenderer(row
, 1, new wxGridCellBoolRenderer
);
343 m_attributeEditorGrid
->SetCellEditor(row
, 1,
344 new ctGridCellTextEditor
);
350 /// Display attribute value
351 bool ctPropertyEditor::DisplayProperty(ctProperty
* prop
)
356 int index
= m_item
->GetProperties().GetList().IndexOf(prop
);
357 return DisplayProperty(index
, prop
, true);
360 /// Display the default property
361 bool ctPropertyEditor::DisplayDefaultProperty()
366 wxString str
= m_item
->GetDefaultProperty();
368 ctProperty
* prop
= m_item
->GetProperties().FindProperty(str
);
371 int index
= m_item
->GetProperties().GetList().IndexOf(prop
);
372 this->m_attributeEditorGrid
->SelectRow(index
);
373 this->m_attributeEditorGrid
->SetGridCursor(index
, 1);
378 /// Edit the default property
379 bool ctPropertyEditor::EditDefaultProperty(ctConfigItem
* item
)
381 wxString defaultPropertyName
= item
->GetDefaultProperty();
382 if (!defaultPropertyName
.empty())
384 ctProperty
* prop
= item
->GetProperties().FindProperty(defaultPropertyName
);
387 int index
= item
->GetProperties().GetList().IndexOf(prop
);
390 this->m_attributeEditorGrid
->SelectRow(index
);
391 this->m_attributeEditorGrid
->SetGridCursor(index
, 1);
392 EditDetails(wxTheApp
->GetTopWindow());
401 /// Find the selected property
402 ctProperty
* ctPropertyEditor::FindSelectedProperty(int& row
)
407 int selRow
= m_attributeEditorGrid
->GetCursorRow();
412 if (selRow
< (int) m_item
->GetProperties().GetCount())
414 ctProperty
* prop
= m_item
->GetProperties().GetNth(selRow
);
421 /// Find the property
422 ctProperty
* ctPropertyEditor::FindProperty(int row
)
429 if (row
< (int) m_item
->GetProperties().GetCount())
431 ctProperty
* prop
= m_item
->GetProperties().GetNth(row
);
438 /// Edit the details of this cell appropriately.
439 bool ctPropertyEditor::EditDetails(wxWindow
* WXUNUSED(parent
))
441 if (CanEditDetails())
444 ctProperty
* prop
= FindSelectedProperty(row
);
448 wxString
type(prop
->GetEditorType());
449 wxString value
= m_attributeEditorGrid
->GetCellValue(row
, 1);
451 if (type
== _T("multiline"))
453 value
= ctConvertToMultilineText(value
);
455 msg
.Printf(wxT("Edit %s:"), (const wxChar
*) prop
->GetName());
456 ctMultiLineTextEditor
dialog(wxTheApp
->GetTopWindow(),
457 wxID_ANY
, wxT("Edit Text Property"), msg
, value
);
458 if (dialog
.ShowModal() == wxID_OK
)
460 value
= ctConvertToSingleText(dialog
.GetText());
461 m_attributeEditorGrid
->SetCellValue(row
, 1, value
);
462 ApplyCellValueToProperty(row
, 1);
468 else if (type
== _T("filename"))
470 wxString fullPath
= value
;
471 wxString defaultDir
;
472 wxString defaultFilename
= wxFileNameFromPath(fullPath
);
474 defaultDir
= wxPathOnly(value
);
476 wxString msg
= wxT("Choose a filename");
477 wxFileDialog
dialog(wxTheApp
->GetTopWindow(),
478 msg
, defaultDir
, defaultFilename
, wxT("*.*"));
479 if (dialog
.ShowModal() == wxID_OK
)
481 fullPath
= dialog
.GetPath();
484 m_attributeEditorGrid
->SetCellValue(row
, 1, value
);
485 ApplyCellValueToProperty(row
, 1);
491 else if (type
== _T("configitems"))
494 ctConfigItem::StringToArray(value
, items
);
496 ctConfigItemsSelector
dialog(wxTheApp
->GetTopWindow(),
497 wxID_ANY
, wxT("Select Configuration Items"));
498 dialog
.SetConfigList(items
);
499 if (dialog
.ShowModal() == wxID_OK
)
502 items
= dialog
.GetConfigList();
503 ctConfigItem::ArrayToString(items
, newValue
);
505 m_attributeEditorGrid
->SetCellValue(row
, 1, newValue
);
506 ApplyCellValueToProperty(row
, 1);
517 /// Intercept selection event.
518 void ctPropertyEditor::OnSelectCell(wxGridEvent
& event
)
520 int row
= event
.GetRow();
522 UpdateDescription(row
);
527 /// Update the description
528 void ctPropertyEditor::UpdateDescription(int row
)
532 row
= m_attributeEditorGrid
->GetCursorRow();
536 wxString str
= WrapDescription(wxEmptyString
);
537 m_propertyDescriptionWindow
->SetPage(str
);
541 ctProperty
* prop
= FindProperty(row
);
544 wxString str
= WrapDescription(m_item
->GetDescription(prop
));
545 m_propertyDescriptionWindow
->SetPage(str
);
550 /// Wraps a description string in HTML
551 wxString
ctPropertyEditor::WrapDescription(const wxString
& s
)
553 /// Convert a colour to a 6-digit hex string
554 wxColour col
= ctDESCRIPTION_BACKGROUND_COLOUR
;
555 wxString colStr
= apColourToHexString(col
);
556 colStr
= wxT("#") + colStr
;
559 str
<< _T("<HTML><BODY BGCOLOR=\"") << colStr
<< wxT("\"><FONT SIZE=-1>") ;
561 str
<< _T("</FONT></BODY></HTML>");
566 /// Intercept cell data change event.
567 void ctPropertyEditor::OnChangeCell(wxGridEvent
& event
)
569 int row
= event
.GetRow();
570 int col
= event
.GetCol();
572 ApplyCellValueToProperty(row
, col
);
575 /// Double-click to show specialised editor.
576 void ctPropertyEditor::OnDClickCell(wxGridEvent
& WXUNUSED(event
))
578 wxWindow
* parentFrame
= this;
579 while (parentFrame
&& !parentFrame
->IsKindOf(CLASSINFO(wxFrame
)))
580 parentFrame
= parentFrame
->GetParent();
582 EditDetails(parentFrame
);
585 /// Apply the cell value to the property, and notify the
587 void ctPropertyEditor::ApplyCellValueToProperty(int row
, int col
)
589 static bool s_Applying
= false;
595 if (col
== 1 && m_item
)
597 ctProperty
* prop
= m_item
->GetProperties().GetNth(row
);
599 wxString value
= m_attributeEditorGrid
->GetCellValue(row
, col
);
600 if (prop
->GetEditorType() == wxT("multiline"))
601 value
= ctConvertToMultilineText(value
);
603 wxVariant variant
= prop
->GetVariant();
605 if (prop
->GetVariant().GetType() == _T("bool"))
607 if (value
== _T("1"))
612 else if (prop
->GetVariant().GetType() == _T("long"))
618 else if (prop
->GetVariant().GetType() == _T("double"))
629 ApplyPropertyValue(m_item
, prop
, variant
);
631 if (prop
->GetName() == _T("description"))
632 UpdateDescription(row
);
637 /// Apply the cell value to the property, and notify the
639 void ctPropertyEditor::ApplyPropertyValue(ctConfigItem
* item
, ctProperty
* property
, const wxVariant
& variant
)
641 static bool s_Applying
= false;
648 // Save the old values
649 ctProperties
* oldProperties
= new ctProperties(item
->GetProperties());
651 wxVariant oldValue
= property
->GetVariant();
653 // Apply the new value
654 property
->GetVariant() = variant
;
655 item
->ApplyProperty(property
, oldValue
);
660 wxString
menuLabel(_T("Change ") + property
->GetName());
662 // This won't do anything first time Do is applied,
663 // since we've already done the action for this property.
664 // But when we Undo or Redo, the changed properties will be applied.
665 item
->GetDocument()->GetCommandProcessor()->Submit(
666 new ctConfigCommand(menuLabel
, ctCMD_APPLY_PROPERTY
,
667 item
, oldProperties
, true));
673 * Attribute editor grid
676 IMPLEMENT_CLASS(ctPropertyEditorGrid
, wxGrid
)
678 BEGIN_EVENT_TABLE(ctPropertyEditorGrid
, wxGrid
)
679 EVT_SIZE(ctPropertyEditorGrid::OnSize
)
682 ctPropertyEditorGrid::ctPropertyEditorGrid(wxWindow
* parent
, wxWindowID id
,
684 const wxSize
& sz
, long style
):
685 wxGrid(parent
, id
, pos
, sz
, style
)
688 m_stretchableColumn
= -1;
691 void ctPropertyEditorGrid::OnSize(wxSizeEvent
& event
)
693 if (m_stretchableColumn
!= -1)
695 // This window's client size = the internal window's
696 // client size if it has no borders
697 wxSize sz
= GetClientSize();
701 for (i
= 0; i
< GetNumberCols(); i
++)
703 if (i
!= m_stretchableColumn
)
705 totalSize
+= GetColSize(i
);
709 // Allow for grid lines
712 int stretchSize
= wxMax(5, sz
.x
- totalSize
);
713 SetColSize(m_stretchableColumn
, stretchSize
);
719 /// Use m_columnsToDisplay to set the label strings
720 void ctPropertyEditorGrid::DisplayLabels()
723 for (i
= 0; i
< m_columnsToDisplay
.GetCount(); i
++)
725 SetColLabelValue(i
, m_columnsToDisplay
[i
]);
730 bool ctPropertyEditorGrid::ClearAttributes()
732 if (GetNumberRows() > 0)
733 DeleteRows(0, GetNumberRows());
738 * Use a single-line text control.
741 void ctGridCellTextEditor::Create(wxWindow
* parent
, wxWindowID id
,
742 wxEvtHandler
* evtHandler
)
744 m_control
= new wxTextCtrl(parent
, id
, wxEmptyString
,
745 wxDefaultPosition
, wxDefaultSize
748 wxGridCellEditor::Create(parent
, id
, evtHandler
);
752 /// Translate the value to one which can be edited in a single-line
754 wxString
ctConvertToSingleText(const wxString
& value
)
756 wxString
value1(value
);
757 value1
.Replace(wxT("\n"), wxT("\\n"));
758 value1
.Replace(wxT("\t"), wxT("\\t"));
762 /// Translate back to 'real' characters, i.e. newlines are real
764 wxString
ctConvertToMultilineText(const wxString
& value
)
766 wxString
value1(value
);
767 value1
.Replace(wxT("\\n"), wxT("\n"));
768 value1
.Replace(wxT("\\t"), wxT("\t"));
772 //----------------------------------------------------------------------------
773 // ctMultiLineTextEditor
774 //----------------------------------------------------------------------------
776 BEGIN_EVENT_TABLE(ctMultiLineTextEditor
, wxDialog
)
779 ctMultiLineTextEditor::ctMultiLineTextEditor( wxWindow
*parent
, wxWindowID id
, const wxString
&title
,
781 const wxString
& value
,
785 wxDialog(parent
, id
, title
, pos
, size
, style
)
788 AddControls(this, msg
);
792 bool ctMultiLineTextEditor::AddControls(wxWindow
* parent
, const wxString
& msg
)
794 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
796 wxBoxSizer
*item1
= new wxBoxSizer( wxVERTICAL
);
798 wxStaticText
*item2
= new wxStaticText( parent
, wxID_STATIC
, msg
, wxDefaultPosition
, wxDefaultSize
, 0 );
799 item1
->Add( item2
, 0, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxLEFT
|wxRIGHT
, 5 );
801 wxTextCtrl
*item3
= new wxTextCtrl( parent
, wxID_ANY
, wxEmptyString
, wxDefaultPosition
, wxSize(330,180), wxTE_MULTILINE
|wxTE_RICH
);
802 item1
->Add( item3
, 1, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5 );
804 wxBoxSizer
*item4
= new wxBoxSizer( wxHORIZONTAL
);
806 item4
->Add( 5, 5, 1, wxALIGN_CENTRE
|wxALL
, 5 );
808 wxButton
*item5
= new wxButton( parent
, wxID_OK
);
809 item4
->Add( item5
, 0, wxALIGN_CENTRE
|wxALL
, 5 );
811 wxButton
*item6
= new wxButton( parent
, wxID_CANCEL
);
812 item4
->Add( item6
, 0, wxALIGN_CENTRE
|wxALL
, 5 );
814 item1
->Add( item4
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
, 5 );
816 item0
->Add( item1
, 1, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5 );
818 item3
->SetValue(m_text
);
819 item3
->SetValidator(wxGenericValidator(& m_text
));
825 parent
->SetSizer(item0
);
832 * Special-purpose splitter window for changing sash look and
833 * also saving sash width
836 BEGIN_EVENT_TABLE(ctSplitterWindow
, wxSplitterWindow
)
837 EVT_SPLITTER_SASH_POS_CHANGED(wxID_ANY
, ctSplitterWindow::OnChangeSash
)
840 ctSplitterWindow::ctSplitterWindow(wxWindow
* parent
, wxWindowID id
,
841 const wxPoint
& pos
, const wxSize
& size
, long style
):
842 wxSplitterWindow(parent
, id
, pos
, size
, style
)
844 m_updateSettings
= false;
848 void ctSplitterWindow::OnChangeSash(wxSplitterEvent
& event
)
850 if (!m_updateSettings
)
853 m_position
= event
.GetSashPosition();