1 /////////////////////////////////////////////////////////////////////////////
2 // Name: propeditor.cpp
3 // Purpose: wxWindows 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"
22 #include "wx/html/htmlwin.h"
24 #include "wx/filedlg.h"
25 #include "wx/tokenzr.h"
26 #include "wx/valgen.h"
28 #include "propeditor.h"
31 #include "configtooldoc.h"
32 #include "configitemselector.h"
33 #include "bitmaps/ellipsis.xpm"
37 * A container window for the property editor.
38 * and attribute editor.
41 IMPLEMENT_CLASS(ctPropertyEditor
, wxPanel
)
43 BEGIN_EVENT_TABLE(ctPropertyEditor
, wxPanel
)
44 EVT_BUTTON(ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS
, ctPropertyEditor::OnEditDetails
)
45 EVT_GRID_SELECT_CELL(ctPropertyEditor::OnSelectCell
)
46 EVT_GRID_CELL_CHANGE(ctPropertyEditor::OnChangeCell
)
47 EVT_GRID_CELL_LEFT_DCLICK(ctPropertyEditor::OnDClickCell
)
48 EVT_UPDATE_UI(ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS
, ctPropertyEditor::OnUpdateEditDetails
)
51 ctPropertyEditor::ctPropertyEditor(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
):
52 wxPanel(parent
, id
, pos
, size
, style
)
54 m_splitterWindow
= NULL
;
55 m_attributeEditorGrid
= NULL
;
56 m_propertyDescriptionWindow
= NULL
;
57 m_elementTitleTextCtrl
= NULL
;
62 ctPropertyEditor::~ctPropertyEditor()
66 void ctPropertyEditor::CreateControls(wxWindow
* parent
)
68 m_elementTitleTextCtrl
= new wxTextCtrl(this, -1, wxEmptyString
, wxDefaultPosition
, wxDefaultSize
, wxTE_READONLY
);
69 wxBitmap
detailsIcon(ellipsis_xpm
);
71 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
73 wxBoxSizer
*item1
= new wxBoxSizer( wxHORIZONTAL
);
75 wxTextCtrl
*item2
= m_elementTitleTextCtrl
;
76 item1
->Add( item2
, 1, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5 );
78 wxButton
*item3a
= new wxButton( parent
, ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS
, wxT("Edit..."), wxDefaultPosition
, wxSize(-1, -1));
79 item1
->Add( item3a
, 0, wxALIGN_CENTRE
|wxRIGHT
|wxTOP
|wxBOTTOM
, 5 );
81 item0
->Add( item1
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
, 5 );
83 // TODO: find sash pos from last time
86 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
);
87 m_splitterWindow
->SetMinimumPaneSize(10);
89 m_propertyDescriptionWindow
= new wxHtmlWindow(m_splitterWindow
, ctID_ATTRIBUTE_EDITOR_DESCRIPTION
, wxDefaultPosition
, wxSize(200, 60), wxSUNKEN_BORDER
);
90 m_propertyDescriptionWindow
->SetBackgroundColour(ctDESCRIPTION_BACKGROUND_COLOUR
);
91 m_propertyDescriptionWindow
->SetBorders(4);
92 m_attributeEditorGrid
= new ctPropertyEditorGrid(m_splitterWindow
, ctID_ATTRIBUTE_EDITOR_GRID
, wxPoint(0, 0), wxSize(200, 100), wxBORDER_SUNKEN
| wxWANTS_CHARS
);
94 m_splitterWindow
->SplitHorizontally(m_propertyDescriptionWindow
, m_attributeEditorGrid
, sashPos
);
96 // TODO: show or hide description window
98 // ShowDescriptionWindow(FALSE);
100 item0
->Add( m_splitterWindow
, 1, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxRIGHT
|wxBOTTOM
, 5 );
102 this->SetAutoLayout( TRUE
);
103 this->SetSizer( item0
);
106 m_elementTitleTextCtrl
->SetHelpText(_("The title of the property being edited."));
107 FindWindow(ctID_ATTRIBUTE_EDITOR_EDIT_DETAILS
)->SetHelpText(_("Click to use an appropriate editor for the selected property (if any)."));
108 FindWindow(ctID_ATTRIBUTE_EDITOR_GRID
)->SetHelpText(_("Shows the properties of the selected item."));
109 FindWindow(ctID_ATTRIBUTE_EDITOR_DESCRIPTION
)->SetHelpText(_("Shows a description of the selected property, or a summary of the whole item."));
111 /// Set up the grid to display properties
112 m_attributeEditorGrid
->RegisterDataType(ctGRID_VALUE_STRING
,
113 new wxGridCellStringRenderer
,
114 new ctGridCellTextEditor
);
116 m_attributeEditorGrid
->CreateGrid( 0, 2, wxGrid::wxGridSelectRows
);
117 m_attributeEditorGrid
->SetRowLabelSize(0);
118 m_attributeEditorGrid
->SetColLabelSize(0 /* 18 */);
120 wxArrayString columns
;
121 columns
.Add(_T("Name"));
122 columns
.Add(_T("Value"));
124 m_attributeEditorGrid
->SetColSize(0, 140);
125 m_attributeEditorGrid
->SetColSize(1, 80);
127 m_attributeEditorGrid
->SetColumnsToDisplay(columns
);
128 m_attributeEditorGrid
->DisplayLabels();
130 m_attributeEditorGrid
->SetStretchableColumn(1);
132 m_attributeEditorGrid
->SetDefaultCellBackgroundColour(ctCELL_BACKGROUND_COLOUR
);
137 /// Show/hide the description control
138 void ctPropertyEditor::ShowDescriptionWindow(bool show
)
142 if (m_splitterWindow
->IsSplit())
143 m_splitterWindow
->Unsplit(m_propertyDescriptionWindow
);
149 m_propertyDescriptionWindow
->Show(TRUE
);
150 if (!m_splitterWindow
->IsSplit())
152 m_splitterWindow
->SplitHorizontally(m_propertyDescriptionWindow
, m_attributeEditorGrid
, pos
);
157 /// Clear grid editor
158 void ctPropertyEditor::ClearEditor()
160 m_attributeEditorGrid
->ClearAttributes();
161 m_propertyDescriptionWindow
->SetPage(WrapDescription(wxEmptyString
));
162 m_elementTitleTextCtrl
->SetValue(_T(""));
165 /// Handles detailed editing event.
166 void ctPropertyEditor::OnEditDetails(wxCommandEvent
& WXUNUSED(event
))
168 wxWindow
* parentFrame
= this;
169 while (parentFrame
&& !parentFrame
->IsKindOf(CLASSINFO(wxFrame
)))
170 parentFrame
= parentFrame
->GetParent();
172 EditDetails(parentFrame
);
175 /// Handles detailed editing update event.
176 void ctPropertyEditor::OnUpdateEditDetails(wxUpdateUIEvent
& event
)
178 event
.Enable(CanEditDetails());
181 /// Can we edit the details of the selected property?
182 bool ctPropertyEditor::CanEditDetails()
188 ctProperty
* prop
= FindSelectedProperty(row
);
189 if (!prop
|| prop
->GetEditorType().IsEmpty())
195 void ctPropertyEditor::ShowItem(ctConfigItem
* item
)
197 if (m_attributeEditorGrid
->IsCellEditControlEnabled())
198 m_attributeEditorGrid
->SaveEditControlValue();
207 m_attributeEditorGrid
->AppendRows(m_item
->GetProperties().GetCount());
209 wxNode
* node
= m_item
->GetProperties().GetList().GetFirst();
213 ctProperty
* prop
= (ctProperty
*) node
->GetData();
214 DisplayProperty(i
, prop
);
217 node
= node
->GetNext();
219 // Make sure scrollbars are up-to-date, etc.
220 wxSizeEvent
event(m_attributeEditorGrid
->GetSize(), m_attributeEditorGrid
->GetId());
221 m_attributeEditorGrid
->GetEventHandler()->ProcessEvent(event
);
223 DisplayDefaultProperty();
231 /// Determine background colour for this property.
232 void ctPropertyEditor::DeterminePropertyColour(ctProperty
* prop
, wxColour
& colour
)
234 if (prop
->IsCustom())
235 colour
= ctCUSTOM_CELL_BACKGROUND_COLOUR
;
237 colour
= ctCELL_BACKGROUND_COLOUR
;
240 /// Update the title at the top of the property editor
241 void ctPropertyEditor::UpdateTitle()
245 wxString
name(m_item
->GetTitle());
246 m_elementTitleTextCtrl
->SetValue(name
);
250 /// Updates the item display, assuming it was already displayed.
251 void ctPropertyEditor::UpdateItem()
253 if (m_attributeEditorGrid
->IsCellEditControlEnabled())
254 m_attributeEditorGrid
->SaveEditControlValue();
259 wxNode
* node
= m_item
->GetProperties().GetList().GetFirst();
263 ctProperty
* prop
= (ctProperty
*) node
->GetData();
264 DisplayProperty(i
, prop
, TRUE
);
267 node
= node
->GetNext();
269 // Make sure scrollbars are up-to-date, etc.
270 wxSizeEvent
event(m_attributeEditorGrid
->GetSize(), this->GetId());
271 m_attributeEditorGrid
->GetEventHandler()->ProcessEvent(event
);
275 /// Display attribute at given row
276 bool ctPropertyEditor::DisplayProperty(int row
, ctProperty
* prop
, bool valueOnly
)
278 wxColour backgroundColour
;
280 DeterminePropertyColour(prop
, backgroundColour
);
284 m_attributeEditorGrid
->SetCellBackgroundColour(row
, 0, backgroundColour
);
285 m_attributeEditorGrid
->SetCellBackgroundColour(row
, 1, backgroundColour
);
287 m_attributeEditorGrid
->SetCellValue(row
, 0, prop
->GetName());
289 m_attributeEditorGrid
->SetReadOnly(row
, 0);
291 m_attributeEditorGrid
->SetCellAlignment(row
, 1, wxALIGN_LEFT
, wxALIGN_CENTER
);
294 if (!m_item
->CanEditProperty(prop
->GetName()))
296 m_attributeEditorGrid
->SetReadOnly(row
, 1);
298 wxColour
col(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT
));
299 m_attributeEditorGrid
->SetCellTextColour(row
, 1, col
);
303 m_attributeEditorGrid
->SetReadOnly(row
, 1, FALSE
);
304 m_attributeEditorGrid
->SetCellTextColour(row
, 1, * wxBLACK
);
308 m_attributeEditorGrid
->SetCellValue(row
, 1, ctConvertToSingleText(prop
->GetValue()));
313 // Set the value type
314 if (prop
->GetEditorType() == _T("choice"))
317 wxString
* strArr
= prop
->GetChoices().GetStringArray();
319 m_attributeEditorGrid
->SetCellEditor(row
, 1,
320 new wxGridCellChoiceEditor(prop
->GetChoices().GetCount(), strArr
));
324 m_attributeEditorGrid
->SetCellEditor(row
, 1,
325 new wxGridCellChoiceEditor(prop
->GetChoices()));
327 else if (prop
->GetEditorType() == _T("integer") || prop
->GetVariant().GetType() == _T("long"))
329 m_attributeEditorGrid
->SetCellEditor(row
, 1,
330 new wxGridCellNumberEditor
);
332 else if (prop
->GetEditorType() == _T("float") || prop
->GetVariant().GetType() == _T("double"))
334 m_attributeEditorGrid
->SetCellEditor(row
, 1,
335 new wxGridCellFloatEditor
);
337 else if (prop
->GetEditorType() == _T("bool") || prop
->GetVariant().GetType() == _T("bool"))
339 m_attributeEditorGrid
->SetCellValue(row
, 1, prop
->GetVariant().GetBool() ? _T("1") : _T("0"));
340 m_attributeEditorGrid
->SetCellEditor(row
, 1,
341 new wxGridCellBoolEditor
);
342 m_attributeEditorGrid
->SetCellRenderer(row
, 1, new wxGridCellBoolRenderer
);
346 m_attributeEditorGrid
->SetCellEditor(row
, 1,
347 new ctGridCellTextEditor
);
353 /// Display attribute value
354 bool ctPropertyEditor::DisplayProperty(ctProperty
* prop
)
359 int index
= m_item
->GetProperties().GetList().IndexOf(prop
);
360 return DisplayProperty(index
, prop
, TRUE
);
363 /// Display the default property
364 bool ctPropertyEditor::DisplayDefaultProperty()
369 wxString str
= m_item
->GetDefaultProperty();
371 ctProperty
* prop
= m_item
->GetProperties().FindProperty(str
);
374 int index
= m_item
->GetProperties().GetList().IndexOf(prop
);
375 this->m_attributeEditorGrid
->SelectRow(index
);
376 this->m_attributeEditorGrid
->SetGridCursor(index
, 1);
381 /// Edit the default property
382 bool ctPropertyEditor::EditDefaultProperty(ctConfigItem
* item
)
384 wxString defaultPropertyName
= item
->GetDefaultProperty();
385 if (!defaultPropertyName
.IsEmpty())
387 ctProperty
* prop
= item
->GetProperties().FindProperty(defaultPropertyName
);
390 int index
= item
->GetProperties().GetList().IndexOf(prop
);
393 this->m_attributeEditorGrid
->SelectRow(index
);
394 this->m_attributeEditorGrid
->SetGridCursor(index
, 1);
395 EditDetails(wxTheApp
->GetTopWindow());
404 /// Find the selected property
405 ctProperty
* ctPropertyEditor::FindSelectedProperty(int& row
)
410 int selRow
= m_attributeEditorGrid
->GetCursorRow();
415 if (selRow
< (int) m_item
->GetProperties().GetCount())
417 ctProperty
* prop
= m_item
->GetProperties().GetNth(selRow
);
424 /// Find the property
425 ctProperty
* ctPropertyEditor::FindProperty(int row
)
432 if (row
< (int) m_item
->GetProperties().GetCount())
434 ctProperty
* prop
= m_item
->GetProperties().GetNth(row
);
441 /// Edit the details of this cell appropriately.
442 bool ctPropertyEditor::EditDetails(wxWindow
* WXUNUSED(parent
))
444 if (CanEditDetails())
447 ctProperty
* prop
= FindSelectedProperty(row
);
451 wxString
type(prop
->GetEditorType());
452 wxString value
= m_attributeEditorGrid
->GetCellValue(row
, 1);
454 if (type
== _T("multiline"))
456 value
= ctConvertToMultilineText(value
);
458 msg
.Printf(wxT("Edit %s:"), (const wxChar
*) prop
->GetName());
459 ctMultiLineTextEditor
dialog(wxTheApp
->GetTopWindow(),
460 -1, wxT("Edit Text Property"), msg
, value
);
461 if (dialog
.ShowModal() == wxID_OK
)
463 value
= ctConvertToSingleText(dialog
.GetText());
464 m_attributeEditorGrid
->SetCellValue(row
, 1, value
);
465 ApplyCellValueToProperty(row
, 1);
471 else if (type
== _T("filename"))
473 wxString fullPath
= value
;
474 wxString defaultDir
;
475 wxString defaultFilename
= wxFileNameFromPath(fullPath
);
477 defaultDir
= wxPathOnly(value
);
479 wxString msg
= wxT("Choose a filename");
480 wxFileDialog
dialog(wxTheApp
->GetTopWindow(),
481 msg
, defaultDir
, defaultFilename
, wxT("*.*"));
482 if (dialog
.ShowModal() == wxID_OK
)
484 fullPath
= dialog
.GetPath();
487 m_attributeEditorGrid
->SetCellValue(row
, 1, value
);
488 ApplyCellValueToProperty(row
, 1);
494 else if (type
== _T("configitems"))
497 ctConfigItem::StringToArray(value
, items
);
499 ctConfigItemsSelector
dialog(wxTheApp
->GetTopWindow(),
500 -1, wxT("Select Configuration Items"));
501 dialog
.SetConfigList(items
);
502 if (dialog
.ShowModal() == wxID_OK
)
505 items
= dialog
.GetConfigList();
506 ctConfigItem::ArrayToString(items
, newValue
);
508 m_attributeEditorGrid
->SetCellValue(row
, 1, newValue
);
509 ApplyCellValueToProperty(row
, 1);
520 /// Intercept selection event.
521 void ctPropertyEditor::OnSelectCell(wxGridEvent
& event
)
523 int row
= event
.GetRow();
525 UpdateDescription(row
);
530 /// Update the description
531 void ctPropertyEditor::UpdateDescription(int row
)
535 row
= m_attributeEditorGrid
->GetCursorRow();
539 wxString str
= WrapDescription(wxEmptyString
);
540 m_propertyDescriptionWindow
->SetPage(str
);
544 ctProperty
* prop
= FindProperty(row
);
547 wxString str
= WrapDescription(m_item
->GetDescription(prop
));
548 m_propertyDescriptionWindow
->SetPage(str
);
553 /// Wraps a description string in HTML
554 wxString
ctPropertyEditor::WrapDescription(const wxString
& s
)
556 /// Convert a colour to a 6-digit hex string
557 wxColour col
= ctDESCRIPTION_BACKGROUND_COLOUR
;
558 wxString colStr
= apColourToHexString(col
);
559 colStr
= wxT("#") + colStr
;
562 str
<< _T("<HTML><BODY BGCOLOR=\"") << colStr
<< wxT("\"><FONT SIZE=-1>") ;
564 str
<< _T("</FONT></BODY></HTML>");
569 /// Intercept cell data change event.
570 void ctPropertyEditor::OnChangeCell(wxGridEvent
& event
)
572 int row
= event
.GetRow();
573 int col
= event
.GetCol();
575 ApplyCellValueToProperty(row
, col
);
578 /// Double-click to show specialised editor.
579 void ctPropertyEditor::OnDClickCell(wxGridEvent
& WXUNUSED(event
))
581 wxWindow
* parentFrame
= this;
582 while (parentFrame
&& !parentFrame
->IsKindOf(CLASSINFO(wxFrame
)))
583 parentFrame
= parentFrame
->GetParent();
585 EditDetails(parentFrame
);
588 /// Apply the cell value to the property, and notify the
590 void ctPropertyEditor::ApplyCellValueToProperty(int row
, int col
)
592 static bool s_Applying
= FALSE
;
598 if (col
== 1 && m_item
)
600 ctProperty
* prop
= m_item
->GetProperties().GetNth(row
);
602 wxString value
= m_attributeEditorGrid
->GetCellValue(row
, col
);
603 if (prop
->GetEditorType() == wxT("multiline"))
604 value
= ctConvertToMultilineText(value
);
606 wxVariant variant
= prop
->GetVariant();
608 if (prop
->GetVariant().GetType() == _T("bool"))
610 if (value
== _T("1"))
611 variant
= (bool) TRUE
;
613 variant
= (bool) FALSE
;
615 else if (prop
->GetVariant().GetType() == _T("long"))
621 else if (prop
->GetVariant().GetType() == _T("double"))
632 ApplyPropertyValue(m_item
, prop
, variant
);
634 if (prop
->GetName() == _T("description"))
635 UpdateDescription(row
);
640 /// Apply the cell value to the property, and notify the
642 void ctPropertyEditor::ApplyPropertyValue(ctConfigItem
* item
, ctProperty
* property
, const wxVariant
& variant
)
644 static bool s_Applying
= FALSE
;
651 // Save the old values
652 ctProperties
* oldProperties
= new ctProperties(item
->GetProperties());
654 wxVariant oldValue
= property
->GetVariant();
656 // Apply the new value
657 property
->GetVariant() = variant
;
658 item
->ApplyProperty(property
, oldValue
);
663 wxString
menuLabel(_T("Change ") + property
->GetName());
665 // This won't do anything first time Do is applied,
666 // since we've already done the action for this property.
667 // But when we Undo or Redo, the changed properties will be applied.
668 item
->GetDocument()->GetCommandProcessor()->Submit(
669 new ctConfigCommand(menuLabel
, ctCMD_APPLY_PROPERTY
,
670 item
, oldProperties
, TRUE
));
676 * Attribute editor grid
679 IMPLEMENT_CLASS(ctPropertyEditorGrid
, wxGrid
)
681 BEGIN_EVENT_TABLE(ctPropertyEditorGrid
, wxGrid
)
682 EVT_SIZE(ctPropertyEditorGrid::OnSize
)
685 ctPropertyEditorGrid::ctPropertyEditorGrid(wxWindow
* parent
, wxWindowID id
,
687 const wxSize
& sz
, long style
):
688 wxGrid(parent
, id
, pos
, sz
, style
)
691 m_stretchableColumn
= -1;
694 void ctPropertyEditorGrid::OnSize(wxSizeEvent
& event
)
696 if (m_stretchableColumn
!= -1)
698 // This window's client size = the internal window's
699 // client size if it has no borders
700 wxSize sz
= GetClientSize();
704 for (i
= 0; i
< GetNumberCols(); i
++)
706 if (i
!= m_stretchableColumn
)
708 totalSize
+= GetColSize(i
);
712 // Allow for grid lines
715 int stretchSize
= wxMax(5, sz
.x
- totalSize
);
716 SetColSize(m_stretchableColumn
, stretchSize
);
722 /// Use m_columnsToDisplay to set the label strings
723 void ctPropertyEditorGrid::DisplayLabels()
726 for (i
= 0; i
< m_columnsToDisplay
.GetCount(); i
++)
728 SetColLabelValue(i
, m_columnsToDisplay
[i
]);
733 bool ctPropertyEditorGrid::ClearAttributes()
735 if (GetNumberRows() > 0)
736 DeleteRows(0, GetNumberRows());
741 * Use a single-line text control.
744 void ctGridCellTextEditor::Create(wxWindow
* parent
, wxWindowID id
,
745 wxEvtHandler
* evtHandler
)
747 m_control
= new wxTextCtrl(parent
, id
, wxEmptyString
,
748 wxDefaultPosition
, wxDefaultSize
751 wxGridCellEditor::Create(parent
, id
, evtHandler
);
755 /// Translate the value to one which can be edited in a single-line
757 wxString
ctConvertToSingleText(const wxString
& value
)
759 wxString
value1(value
);
760 value1
.Replace(wxT("\n"), wxT("\\n"));
761 value1
.Replace(wxT("\t"), wxT("\\t"));
765 /// Translate back to 'real' characters, i.e. newlines are real
767 wxString
ctConvertToMultilineText(const wxString
& value
)
769 wxString
value1(value
);
770 value1
.Replace(wxT("\\n"), wxT("\n"));
771 value1
.Replace(wxT("\\t"), wxT("\t"));
775 //----------------------------------------------------------------------------
776 // ctMultiLineTextEditor
777 //----------------------------------------------------------------------------
779 BEGIN_EVENT_TABLE(ctMultiLineTextEditor
, wxDialog
)
782 ctMultiLineTextEditor::ctMultiLineTextEditor( wxWindow
*parent
, wxWindowID id
, const wxString
&title
,
784 const wxString
& value
,
788 wxDialog(parent
, id
, title
, pos
, size
, style
)
791 AddControls(this, msg
);
795 bool ctMultiLineTextEditor::AddControls(wxWindow
* parent
, const wxString
& msg
)
797 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
799 wxBoxSizer
*item1
= new wxBoxSizer( wxVERTICAL
);
801 wxStaticText
*item2
= new wxStaticText( parent
, wxID_STATIC
, msg
, wxDefaultPosition
, wxDefaultSize
, 0 );
802 item1
->Add( item2
, 0, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxLEFT
|wxRIGHT
, 5 );
804 wxTextCtrl
*item3
= new wxTextCtrl( parent
, -1, wxT(""), wxDefaultPosition
, wxSize(330,180), wxTE_MULTILINE
|wxTE_RICH
);
805 item1
->Add( item3
, 1, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5 );
807 wxBoxSizer
*item4
= new wxBoxSizer( wxHORIZONTAL
);
809 item4
->Add( 5, 5, 1, wxALIGN_CENTRE
|wxALL
, 5 );
811 wxButton
*item5
= new wxButton( parent
, wxID_OK
, _("&OK"), wxDefaultPosition
, wxDefaultSize
, 0 );
813 item4
->Add( item5
, 0, wxALIGN_CENTRE
|wxALL
, 5 );
815 wxButton
*item6
= new wxButton( parent
, wxID_CANCEL
, _("&Cancel"), wxDefaultPosition
, wxDefaultSize
, 0 );
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
));
827 ((wxButton
*) FindWindow(wxID_OK
))->SetDefault();
829 parent
->SetAutoLayout( TRUE
);
830 parent
->SetSizer(item0
);
837 * Special-purpose splitter window for changing sash look and
838 * also saving sash width
841 BEGIN_EVENT_TABLE(ctSplitterWindow
, wxSplitterWindow
)
842 EVT_SPLITTER_SASH_POS_CHANGED(-1, ctSplitterWindow::OnChangeSash
)
845 ctSplitterWindow::ctSplitterWindow(wxWindow
* parent
, wxWindowID id
,
846 const wxPoint
& pos
, const wxSize
& size
, long style
):
847 wxSplitterWindow(parent
, id
, pos
, size
, style
)
849 m_updateSettings
= FALSE
;
853 void ctSplitterWindow::OnChangeSash(wxSplitterEvent
& event
)
855 if (!m_updateSettings
)
858 m_position
= event
.GetSashPosition();