1 /////////////////////////////////////////////////////////////////////////////
2 // Name: propeditor.cpp
3 // Purpose: wxWidgets Configuration Tool property editor
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
10 /////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "propeditor.h"
16 // For compilers that support precompilation, includes "wx/wx.h".
17 #include "wx/wxprec.h"
26 #include "wx/filedlg.h"
30 #include "wx/html/htmlwin.h"
31 #include "wx/tokenzr.h"
32 #include "wx/valgen.h"
33 #include "propeditor.h"
36 #include "configtooldoc.h"
37 #include "configitemselector.h"
39 #include "bitmaps/ellipsis.xpm"
43 * A container window for the property editor.
44 * and attribute editor.
47 IMPLEMENT_CLASS(ctPropertyEditor
, wxPanel
)
49 BEGIN_EVENT_TABLE(ctPropertyEditor
, wxPanel
)
50 EVT_BUTTON(ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS
, ctPropertyEditor::OnEditDetails
)
51 EVT_GRID_SELECT_CELL(ctPropertyEditor::OnSelectCell
)
52 EVT_GRID_CELL_CHANGE(ctPropertyEditor::OnChangeCell
)
53 EVT_GRID_CELL_LEFT_DCLICK(ctPropertyEditor::OnDClickCell
)
54 EVT_UPDATE_UI(ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS
, ctPropertyEditor::OnUpdateEditDetails
)
57 ctPropertyEditor::ctPropertyEditor(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
):
58 wxPanel(parent
, id
, pos
, size
, style
)
60 m_splitterWindow
= NULL
;
61 m_attributeEditorGrid
= NULL
;
62 m_propertyDescriptionWindow
= NULL
;
63 m_elementTitleTextCtrl
= NULL
;
68 void ctPropertyEditor::CreateControls(wxWindow
* parent
)
70 m_elementTitleTextCtrl
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
, wxDefaultPosition
, wxDefaultSize
, wxTE_READONLY
);
71 wxBitmap
detailsIcon(ellipsis_xpm
);
73 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
75 wxBoxSizer
*item1
= new wxBoxSizer( wxHORIZONTAL
);
77 wxTextCtrl
*item2
= m_elementTitleTextCtrl
;
78 item1
->Add( item2
, 1, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5 );
80 m_attributeEditorEditDetails
= new wxButton( parent
, ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS
, wxT("Edit..."));
81 item1
->Add( m_attributeEditorEditDetails
, 0, wxALIGN_CENTRE
|wxRIGHT
|wxTOP
|wxBOTTOM
, 5 );
83 item0
->Add( item1
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
, 5 );
85 // TODO: find sash pos from last time
88 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
);
89 m_splitterWindow
->SetMinimumPaneSize(10);
91 m_propertyDescriptionWindow
= new wxHtmlWindow(m_splitterWindow
, ctID_ATTRIBUTE_EDITOR_DESCRIPTION
, wxDefaultPosition
, wxSize(200, 60), wxSUNKEN_BORDER
);
92 m_propertyDescriptionWindow
->SetBackgroundColour(ctDESCRIPTION_BACKGROUND_COLOUR
);
93 m_propertyDescriptionWindow
->SetBorders(4);
94 m_attributeEditorGrid
= new ctPropertyEditorGrid(m_splitterWindow
, ctID_ATTRIBUTE_EDITOR_GRID
, wxPoint(0, 0), wxSize(200, 100), wxBORDER_SUNKEN
| wxWANTS_CHARS
);
96 m_splitterWindow
->SplitHorizontally(m_propertyDescriptionWindow
, m_attributeEditorGrid
, sashPos
);
98 // TODO: show or hide description window
100 // ShowDescriptionWindow(false);
102 item0
->Add( m_splitterWindow
, 1, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxRIGHT
|wxBOTTOM
, 5 );
104 this->SetSizer( item0
);
107 m_elementTitleTextCtrl
->SetHelpText(_("The title of the property being edited."));
108 m_attributeEditorEditDetails
->SetHelpText(_("Click to use an appropriate editor for the selected property (if any)."));
109 m_attributeEditorGrid
->SetHelpText(_("Shows the properties of the selected item."));
110 m_propertyDescriptionWindow
->SetHelpText(_("Shows a description of the selected property, or a summary of the whole item."));
112 /// Set up the grid to display properties
113 m_attributeEditorGrid
->RegisterDataType(ctGRID_VALUE_STRING
,
114 new wxGridCellStringRenderer
,
115 new ctGridCellTextEditor
);
117 m_attributeEditorGrid
->CreateGrid( 0, 2, wxGrid::wxGridSelectRows
);
118 m_attributeEditorGrid
->SetRowLabelSize(0);
119 m_attributeEditorGrid
->SetColLabelSize(0 /* 18 */);
121 wxArrayString columns
;
122 columns
.Add(_T("Name"));
123 columns
.Add(_T("Value"));
125 m_attributeEditorGrid
->SetColSize(0, 140);
126 m_attributeEditorGrid
->SetColSize(1, 80);
128 m_attributeEditorGrid
->SetColumnsToDisplay(columns
);
129 m_attributeEditorGrid
->DisplayLabels();
131 m_attributeEditorGrid
->SetStretchableColumn(1);
133 m_attributeEditorGrid
->SetDefaultCellBackgroundColour(ctCELL_BACKGROUND_COLOUR
);
138 /// Show/hide the description control
139 void ctPropertyEditor::ShowDescriptionWindow(bool show
)
143 if (m_splitterWindow
->IsSplit())
144 m_splitterWindow
->Unsplit(m_propertyDescriptionWindow
);
150 m_propertyDescriptionWindow
->Show(true);
151 if (!m_splitterWindow
->IsSplit())
153 m_splitterWindow
->SplitHorizontally(m_propertyDescriptionWindow
, m_attributeEditorGrid
, pos
);
158 /// Clear grid editor
159 void ctPropertyEditor::ClearEditor()
161 m_attributeEditorGrid
->ClearAttributes();
162 m_propertyDescriptionWindow
->SetPage(WrapDescription(wxEmptyString
));
163 m_elementTitleTextCtrl
->SetValue(wxEmptyString
);
166 /// Handles detailed editing event.
167 void ctPropertyEditor::OnEditDetails(wxCommandEvent
& WXUNUSED(event
))
169 wxWindow
* parentFrame
= this;
170 while (parentFrame
&& !parentFrame
->IsKindOf(CLASSINFO(wxFrame
)))
171 parentFrame
= parentFrame
->GetParent();
173 EditDetails(parentFrame
);
176 /// Handles detailed editing update event.
177 void ctPropertyEditor::OnUpdateEditDetails(wxUpdateUIEvent
& event
)
179 event
.Enable(CanEditDetails());
182 /// Can we edit the details of the selected property?
183 bool ctPropertyEditor::CanEditDetails()
189 ctProperty
* prop
= FindSelectedProperty(row
);
190 if (!prop
|| prop
->GetEditorType().empty())
196 void ctPropertyEditor::ShowItem(ctConfigItem
* item
)
198 if (m_attributeEditorGrid
->IsCellEditControlEnabled())
199 m_attributeEditorGrid
->SaveEditControlValue();
208 m_attributeEditorGrid
->AppendRows(m_item
->GetProperties().GetCount());
210 wxObjectList::compatibility_iterator node
= m_item
->GetProperties().GetList().GetFirst();
214 ctProperty
* prop
= (ctProperty
*) node
->GetData();
215 DisplayProperty(i
, prop
);
218 node
= node
->GetNext();
220 // Make sure scrollbars are up-to-date, etc.
221 wxSizeEvent
event(m_attributeEditorGrid
->GetSize(), m_attributeEditorGrid
->GetId());
222 m_attributeEditorGrid
->GetEventHandler()->ProcessEvent(event
);
224 DisplayDefaultProperty();
232 /// Determine background colour for this property.
233 void ctPropertyEditor::DeterminePropertyColour(ctProperty
* prop
, wxColour
& colour
)
235 if (prop
->IsCustom())
236 colour
= ctCUSTOM_CELL_BACKGROUND_COLOUR
;
238 colour
= ctCELL_BACKGROUND_COLOUR
;
241 /// Update the title at the top of the property editor
242 void ctPropertyEditor::UpdateTitle()
246 wxString
name(m_item
->GetTitle());
247 m_elementTitleTextCtrl
->SetValue(name
);
251 /// Updates the item display, assuming it was already displayed.
252 void ctPropertyEditor::UpdateItem()
254 if (m_attributeEditorGrid
->IsCellEditControlEnabled())
255 m_attributeEditorGrid
->SaveEditControlValue();
260 wxObjectList::compatibility_iterator node
= m_item
->GetProperties().GetList().GetFirst();
264 ctProperty
* prop
= (ctProperty
*) node
->GetData();
265 DisplayProperty(i
, prop
, true);
268 node
= node
->GetNext();
270 // Make sure scrollbars are up-to-date, etc.
271 wxSizeEvent
event(m_attributeEditorGrid
->GetSize(), this->GetId());
272 m_attributeEditorGrid
->GetEventHandler()->ProcessEvent(event
);
276 /// Display attribute at given row
277 bool ctPropertyEditor::DisplayProperty(int row
, ctProperty
* prop
, bool valueOnly
)
279 wxColour backgroundColour
;
281 DeterminePropertyColour(prop
, backgroundColour
);
285 m_attributeEditorGrid
->SetCellBackgroundColour(row
, 0, backgroundColour
);
286 m_attributeEditorGrid
->SetCellBackgroundColour(row
, 1, backgroundColour
);
288 m_attributeEditorGrid
->SetCellValue(row
, 0, prop
->GetName());
290 m_attributeEditorGrid
->SetReadOnly(row
, 0);
292 m_attributeEditorGrid
->SetCellAlignment(row
, 1, wxALIGN_LEFT
, wxALIGN_CENTER
);
295 if (!m_item
->CanEditProperty(prop
->GetName()))
297 m_attributeEditorGrid
->SetReadOnly(row
, 1);
299 wxColour
col(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT
));
300 m_attributeEditorGrid
->SetCellTextColour(row
, 1, col
);
304 m_attributeEditorGrid
->SetReadOnly(row
, 1, false);
305 m_attributeEditorGrid
->SetCellTextColour(row
, 1, * wxBLACK
);
309 m_attributeEditorGrid
->SetCellValue(row
, 1, ctConvertToSingleText(prop
->GetValue()));
314 // Set the value type
315 if (prop
->GetEditorType() == _T("choice"))
318 wxString
* strArr
= prop
->GetChoices().GetStringArray();
320 m_attributeEditorGrid
->SetCellEditor(row
, 1,
321 new wxGridCellChoiceEditor(prop
->GetChoices().GetCount(), strArr
));
325 m_attributeEditorGrid
->SetCellEditor(row
, 1,
326 new wxGridCellChoiceEditor(prop
->GetChoices()));
328 else if (prop
->GetEditorType() == _T("integer") || prop
->GetVariant().GetType() == _T("long"))
330 m_attributeEditorGrid
->SetCellEditor(row
, 1,
331 new wxGridCellNumberEditor
);
333 else if (prop
->GetEditorType() == _T("float") || prop
->GetVariant().GetType() == _T("double"))
335 m_attributeEditorGrid
->SetCellEditor(row
, 1,
336 new wxGridCellFloatEditor
);
338 else if (prop
->GetEditorType() == _T("bool") || prop
->GetVariant().GetType() == _T("bool"))
340 m_attributeEditorGrid
->SetCellValue(row
, 1, prop
->GetVariant().GetBool() ? _T("1") : _T("0"));
341 m_attributeEditorGrid
->SetCellEditor(row
, 1,
342 new wxGridCellBoolEditor
);
343 m_attributeEditorGrid
->SetCellRenderer(row
, 1, new wxGridCellBoolRenderer
);
347 m_attributeEditorGrid
->SetCellEditor(row
, 1,
348 new ctGridCellTextEditor
);
354 /// Display attribute value
355 bool ctPropertyEditor::DisplayProperty(ctProperty
* prop
)
360 int index
= m_item
->GetProperties().GetList().IndexOf(prop
);
361 return DisplayProperty(index
, prop
, true);
364 /// Display the default property
365 bool ctPropertyEditor::DisplayDefaultProperty()
370 wxString str
= m_item
->GetDefaultProperty();
372 ctProperty
* prop
= m_item
->GetProperties().FindProperty(str
);
375 int index
= m_item
->GetProperties().GetList().IndexOf(prop
);
376 this->m_attributeEditorGrid
->SelectRow(index
);
377 this->m_attributeEditorGrid
->SetGridCursor(index
, 1);
382 /// Edit the default property
383 bool ctPropertyEditor::EditDefaultProperty(ctConfigItem
* item
)
385 wxString defaultPropertyName
= item
->GetDefaultProperty();
386 if (!defaultPropertyName
.empty())
388 ctProperty
* prop
= item
->GetProperties().FindProperty(defaultPropertyName
);
391 int index
= item
->GetProperties().GetList().IndexOf(prop
);
394 this->m_attributeEditorGrid
->SelectRow(index
);
395 this->m_attributeEditorGrid
->SetGridCursor(index
, 1);
396 EditDetails(wxTheApp
->GetTopWindow());
405 /// Find the selected property
406 ctProperty
* ctPropertyEditor::FindSelectedProperty(int& row
)
411 int selRow
= m_attributeEditorGrid
->GetCursorRow();
416 if (selRow
< (int) m_item
->GetProperties().GetCount())
418 ctProperty
* prop
= m_item
->GetProperties().GetNth(selRow
);
425 /// Find the property
426 ctProperty
* ctPropertyEditor::FindProperty(int row
)
433 if (row
< (int) m_item
->GetProperties().GetCount())
435 ctProperty
* prop
= m_item
->GetProperties().GetNth(row
);
442 /// Edit the details of this cell appropriately.
443 bool ctPropertyEditor::EditDetails(wxWindow
* WXUNUSED(parent
))
445 if (CanEditDetails())
448 ctProperty
* prop
= FindSelectedProperty(row
);
452 wxString
type(prop
->GetEditorType());
453 wxString value
= m_attributeEditorGrid
->GetCellValue(row
, 1);
455 if (type
== _T("multiline"))
457 value
= ctConvertToMultilineText(value
);
459 msg
.Printf(wxT("Edit %s:"), (const wxChar
*) prop
->GetName());
460 ctMultiLineTextEditor
dialog(wxTheApp
->GetTopWindow(),
461 wxID_ANY
, wxT("Edit Text Property"), msg
, value
);
462 if (dialog
.ShowModal() == wxID_OK
)
464 value
= ctConvertToSingleText(dialog
.GetText());
465 m_attributeEditorGrid
->SetCellValue(row
, 1, value
);
466 ApplyCellValueToProperty(row
, 1);
472 else if (type
== _T("filename"))
474 wxString fullPath
= value
;
475 wxString defaultDir
;
476 wxString defaultFilename
= wxFileNameFromPath(fullPath
);
478 defaultDir
= wxPathOnly(value
);
480 wxString msg
= wxT("Choose a filename");
481 wxFileDialog
dialog(wxTheApp
->GetTopWindow(),
482 msg
, defaultDir
, defaultFilename
, wxT("*.*"));
483 if (dialog
.ShowModal() == wxID_OK
)
485 fullPath
= dialog
.GetPath();
488 m_attributeEditorGrid
->SetCellValue(row
, 1, value
);
489 ApplyCellValueToProperty(row
, 1);
495 else if (type
== _T("configitems"))
498 ctConfigItem::StringToArray(value
, items
);
500 ctConfigItemsSelector
dialog(wxTheApp
->GetTopWindow(),
501 wxID_ANY
, wxT("Select Configuration Items"));
502 dialog
.SetConfigList(items
);
503 if (dialog
.ShowModal() == wxID_OK
)
506 items
= dialog
.GetConfigList();
507 ctConfigItem::ArrayToString(items
, newValue
);
509 m_attributeEditorGrid
->SetCellValue(row
, 1, newValue
);
510 ApplyCellValueToProperty(row
, 1);
521 /// Intercept selection event.
522 void ctPropertyEditor::OnSelectCell(wxGridEvent
& event
)
524 int row
= event
.GetRow();
526 UpdateDescription(row
);
531 /// Update the description
532 void ctPropertyEditor::UpdateDescription(int row
)
536 row
= m_attributeEditorGrid
->GetCursorRow();
540 wxString str
= WrapDescription(wxEmptyString
);
541 m_propertyDescriptionWindow
->SetPage(str
);
545 ctProperty
* prop
= FindProperty(row
);
548 wxString str
= WrapDescription(m_item
->GetDescription(prop
));
549 m_propertyDescriptionWindow
->SetPage(str
);
554 /// Wraps a description string in HTML
555 wxString
ctPropertyEditor::WrapDescription(const wxString
& s
)
557 /// Convert a colour to a 6-digit hex string
558 wxColour col
= ctDESCRIPTION_BACKGROUND_COLOUR
;
559 wxString colStr
= apColourToHexString(col
);
560 colStr
= wxT("#") + colStr
;
563 str
<< _T("<HTML><BODY BGCOLOR=\"") << colStr
<< wxT("\"><FONT SIZE=-1>") ;
565 str
<< _T("</FONT></BODY></HTML>");
570 /// Intercept cell data change event.
571 void ctPropertyEditor::OnChangeCell(wxGridEvent
& event
)
573 int row
= event
.GetRow();
574 int col
= event
.GetCol();
576 ApplyCellValueToProperty(row
, col
);
579 /// Double-click to show specialised editor.
580 void ctPropertyEditor::OnDClickCell(wxGridEvent
& WXUNUSED(event
))
582 wxWindow
* parentFrame
= this;
583 while (parentFrame
&& !parentFrame
->IsKindOf(CLASSINFO(wxFrame
)))
584 parentFrame
= parentFrame
->GetParent();
586 EditDetails(parentFrame
);
589 /// Apply the cell value to the property, and notify the
591 void ctPropertyEditor::ApplyCellValueToProperty(int row
, int col
)
593 static bool s_Applying
= false;
599 if (col
== 1 && m_item
)
601 ctProperty
* prop
= m_item
->GetProperties().GetNth(row
);
603 wxString value
= m_attributeEditorGrid
->GetCellValue(row
, col
);
604 if (prop
->GetEditorType() == wxT("multiline"))
605 value
= ctConvertToMultilineText(value
);
607 wxVariant variant
= prop
->GetVariant();
609 if (prop
->GetVariant().GetType() == _T("bool"))
611 if (value
== _T("1"))
616 else if (prop
->GetVariant().GetType() == _T("long"))
622 else if (prop
->GetVariant().GetType() == _T("double"))
633 ApplyPropertyValue(m_item
, prop
, variant
);
635 if (prop
->GetName() == _T("description"))
636 UpdateDescription(row
);
641 /// Apply the cell value to the property, and notify the
643 void ctPropertyEditor::ApplyPropertyValue(ctConfigItem
* item
, ctProperty
* property
, const wxVariant
& variant
)
645 static bool s_Applying
= false;
652 // Save the old values
653 ctProperties
* oldProperties
= new ctProperties(item
->GetProperties());
655 wxVariant oldValue
= property
->GetVariant();
657 // Apply the new value
658 property
->GetVariant() = variant
;
659 item
->ApplyProperty(property
, oldValue
);
664 wxString
menuLabel(_T("Change ") + property
->GetName());
666 // This won't do anything first time Do is applied,
667 // since we've already done the action for this property.
668 // But when we Undo or Redo, the changed properties will be applied.
669 item
->GetDocument()->GetCommandProcessor()->Submit(
670 new ctConfigCommand(menuLabel
, ctCMD_APPLY_PROPERTY
,
671 item
, oldProperties
, true));
677 * Attribute editor grid
680 IMPLEMENT_CLASS(ctPropertyEditorGrid
, wxGrid
)
682 BEGIN_EVENT_TABLE(ctPropertyEditorGrid
, wxGrid
)
683 EVT_SIZE(ctPropertyEditorGrid::OnSize
)
686 ctPropertyEditorGrid::ctPropertyEditorGrid(wxWindow
* parent
, wxWindowID id
,
688 const wxSize
& sz
, long style
):
689 wxGrid(parent
, id
, pos
, sz
, style
)
692 m_stretchableColumn
= -1;
695 void ctPropertyEditorGrid::OnSize(wxSizeEvent
& event
)
697 if (m_stretchableColumn
!= -1)
699 // This window's client size = the internal window's
700 // client size if it has no borders
701 wxSize sz
= GetClientSize();
705 for (i
= 0; i
< GetNumberCols(); i
++)
707 if (i
!= m_stretchableColumn
)
709 totalSize
+= GetColSize(i
);
713 // Allow for grid lines
716 int stretchSize
= wxMax(5, sz
.x
- totalSize
);
717 SetColSize(m_stretchableColumn
, stretchSize
);
723 /// Use m_columnsToDisplay to set the label strings
724 void ctPropertyEditorGrid::DisplayLabels()
727 for (i
= 0; i
< m_columnsToDisplay
.GetCount(); i
++)
729 SetColLabelValue(i
, m_columnsToDisplay
[i
]);
734 bool ctPropertyEditorGrid::ClearAttributes()
736 if (GetNumberRows() > 0)
737 DeleteRows(0, GetNumberRows());
742 * Use a single-line text control.
745 void ctGridCellTextEditor::Create(wxWindow
* parent
, wxWindowID id
,
746 wxEvtHandler
* evtHandler
)
748 m_control
= new wxTextCtrl(parent
, id
, wxEmptyString
,
749 wxDefaultPosition
, wxDefaultSize
752 wxGridCellEditor::Create(parent
, id
, evtHandler
);
756 /// Translate the value to one which can be edited in a single-line
758 wxString
ctConvertToSingleText(const wxString
& value
)
760 wxString
value1(value
);
761 value1
.Replace(wxT("\n"), wxT("\\n"));
762 value1
.Replace(wxT("\t"), wxT("\\t"));
766 /// Translate back to 'real' characters, i.e. newlines are real
768 wxString
ctConvertToMultilineText(const wxString
& value
)
770 wxString
value1(value
);
771 value1
.Replace(wxT("\\n"), wxT("\n"));
772 value1
.Replace(wxT("\\t"), wxT("\t"));
776 //----------------------------------------------------------------------------
777 // ctMultiLineTextEditor
778 //----------------------------------------------------------------------------
780 BEGIN_EVENT_TABLE(ctMultiLineTextEditor
, wxDialog
)
783 ctMultiLineTextEditor::ctMultiLineTextEditor( wxWindow
*parent
, wxWindowID id
, const wxString
&title
,
785 const wxString
& value
,
789 wxDialog(parent
, id
, title
, pos
, size
, style
)
792 AddControls(this, msg
);
796 bool ctMultiLineTextEditor::AddControls(wxWindow
* parent
, const wxString
& msg
)
798 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
800 wxBoxSizer
*item1
= new wxBoxSizer( wxVERTICAL
);
802 wxStaticText
*item2
= new wxStaticText( parent
, wxID_STATIC
, msg
, wxDefaultPosition
, wxDefaultSize
, 0 );
803 item1
->Add( item2
, 0, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxLEFT
|wxRIGHT
, 5 );
805 wxTextCtrl
*item3
= new wxTextCtrl( parent
, wxID_ANY
, wxEmptyString
, wxDefaultPosition
, wxSize(330,180), wxTE_MULTILINE
|wxTE_RICH
);
806 item1
->Add( item3
, 1, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5 );
808 wxBoxSizer
*item4
= new wxBoxSizer( wxHORIZONTAL
);
810 item4
->Add( 5, 5, 1, wxALIGN_CENTRE
|wxALL
, 5 );
812 wxButton
*item5
= new wxButton( parent
, wxID_OK
);
813 item4
->Add( item5
, 0, wxALIGN_CENTRE
|wxALL
, 5 );
815 wxButton
*item6
= new wxButton( parent
, wxID_CANCEL
);
816 item4
->Add( item6
, 0, wxALIGN_CENTRE
|wxALL
, 5 );
818 item1
->Add( item4
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
, 5 );
820 item0
->Add( item1
, 1, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5 );
822 item3
->SetValue(m_text
);
823 item3
->SetValidator(wxGenericValidator(& m_text
));
829 parent
->SetSizer(item0
);
836 * Special-purpose splitter window for changing sash look and
837 * also saving sash width
840 BEGIN_EVENT_TABLE(ctSplitterWindow
, wxSplitterWindow
)
841 EVT_SPLITTER_SASH_POS_CHANGED(wxID_ANY
, ctSplitterWindow::OnChangeSash
)
844 ctSplitterWindow::ctSplitterWindow(wxWindow
* parent
, wxWindowID id
,
845 const wxPoint
& pos
, const wxSize
& size
, long style
):
846 wxSplitterWindow(parent
, id
, pos
, size
, style
)
848 m_updateSettings
= false;
852 void ctSplitterWindow::OnChangeSash(wxSplitterEvent
& event
)
854 if (!m_updateSettings
)
857 m_position
= event
.GetSashPosition();