#include <math.h>
#include <string.h>
+#if wxUSE_IOSTREAMH
#if defined(__WXMSW__) && !defined(__GNUWIN32__)
#include <strstrea.h>
#else
#include <strstream.h>
#endif
+#else
+#include <strstream>
+#endif
#include "wx/window.h"
#include "wx/utils.h"
long style, const wxString& name):
wxTextCtrl(parent, id, value, pos, size, style, wxDefaultValidator, name)
{
- view = v;
+ m_view = v;
}
void wxPropertyTextEdit::OnSetFocus(void)
EVT_TEXT_ENTER(wxID_PROP_TEXT, wxPropertyListView::OnText)
EVT_LISTBOX(wxID_PROP_SELECT, wxPropertyListView::OnPropertySelect)
EVT_COMMAND(wxID_PROP_SELECT, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxPropertyListView::OnPropertyDoubleClick)
- EVT_TEXT(wxID_PROP_VALUE_SELECT, wxPropertyListView::OnValueListSelect)
+ EVT_LISTBOX(wxID_PROP_VALUE_SELECT, wxPropertyListView::OnValueListSelect)
END_EVENT_TABLE()
-bool wxPropertyListView::dialogCancelled = FALSE;
-wxBitmap *wxPropertyListView::tickBitmap = NULL;
-wxBitmap *wxPropertyListView::crossBitmap = NULL;
+bool wxPropertyListView::sm_dialogCancelled = FALSE;
+wxBitmap *wxPropertyListView::sm_tickBitmap = NULL;
+wxBitmap *wxPropertyListView::sm_crossBitmap = NULL;
wxPropertyListView::wxPropertyListView(wxPanel *propPanel, long flags):wxPropertyView(flags)
{
- propertyScrollingList = NULL;
- valueList = NULL;
- valueText = NULL;
- editButton = NULL;
- confirmButton = NULL;
- cancelButton = NULL;
- propertyWindow = propPanel;
- managedWindow = NULL;
+ m_propertyScrollingList = NULL;
+ m_valueList = NULL;
+ m_valueText = NULL;
+ m_editButton = NULL;
+ m_confirmButton = NULL;
+ m_cancelButton = NULL;
+ m_propertyWindow = propPanel;
+ m_managedWindow = NULL;
- windowCloseButton = NULL;
- windowCancelButton = NULL;
- windowHelpButton = NULL;
+ m_windowCloseButton = NULL;
+ m_windowCancelButton = NULL;
+ m_windowHelpButton = NULL;
- detailedEditing = FALSE;
+ m_detailedEditing = FALSE;
}
wxPropertyListView::~wxPropertyListView(void)
{
/*
- if (tickBitmap)
- delete tickBitmap;
- if (crossBitmap)
- delete crossBitmap;
+ if (m_tickBitmap)
+ delete m_tickBitmap;
+ if (m_crossBitmap)
+ delete m_crossBitmap;
*/
}
void wxPropertyListView::ShowView(wxPropertySheet *ps, wxPanel *panel)
{
- propertySheet = ps;
-
+ m_propertySheet = ps;
+
AssociatePanel(panel);
CreateControls();
bool wxPropertyListView::UpdatePropertyList(bool clearEditArea)
{
- if (!propertyScrollingList || !propertySheet)
+ if (!m_propertyScrollingList || !m_propertySheet)
return FALSE;
- propertyScrollingList->Clear();
+ m_propertyScrollingList->Clear();
if (clearEditArea)
{
- valueList->Clear();
- valueText->SetValue("");
+ m_valueList->Clear();
+ m_valueText->SetValue("");
}
- wxNode *node = propertySheet->GetProperties().First();
+ wxNode *node = m_propertySheet->GetProperties().First();
// Should sort them... later...
while (node)
wxString stringValueRepr(property->GetValue().GetStringRepresentation());
wxString paddedString(MakeNameValueString(property->GetName(), stringValueRepr));
- propertyScrollingList->Append(paddedString.GetData(), (char *)property);
+ m_propertyScrollingList->Append(paddedString.GetData(), (char *)property);
node = node->Next();
}
return TRUE;
bool wxPropertyListView::UpdatePropertyDisplayInList(wxProperty *property)
{
- if (!propertyScrollingList || !propertySheet)
+ if (!m_propertyScrollingList || !m_propertySheet)
return FALSE;
- int currentlySelected = propertyScrollingList->GetSelection();
+ int currentlySelected = m_propertyScrollingList->GetSelection();
// #ifdef __WXMSW__
wxString stringValueRepr(property->GetValue().GetStringRepresentation());
wxString paddedString(MakeNameValueString(property->GetName(), stringValueRepr));
// Don't update the listbox unnecessarily because it can cause
// ugly flashing.
- if (paddedString != propertyScrollingList->GetString(sel))
- propertyScrollingList->SetString(sel, paddedString.GetData());
+ if (paddedString != m_propertyScrollingList->GetString(sel))
+ m_propertyScrollingList->SetString(sel, paddedString.GetData());
}
//#else
// UpdatePropertyList(FALSE);
//#endif
+ // TODO: why is this necessary?
+#ifdef __WXMSW__
if (currentlySelected > -1)
- propertyScrollingList->SetSelection(currentlySelected);
+ m_propertyScrollingList->SetSelection(currentlySelected);
+#endif
return TRUE;
}
// Find the wxListBox index corresponding to this property
int wxPropertyListView::FindListIndexForProperty(wxProperty *property)
{
- int n = propertyScrollingList->Number();
+ int n = m_propertyScrollingList->Number();
for (int i = 0; i < n; i++)
{
- if (property == (wxProperty *)propertyScrollingList->wxListBox::GetClientData(i))
+ if (property == (wxProperty *)m_propertyScrollingList->wxListBox::GetClientData(i))
return i;
}
return -1;
// property. NULL resets to show no property.
bool wxPropertyListView::ShowProperty(wxProperty *property, bool select)
{
- if (currentProperty)
+ if (m_currentProperty)
{
- EndShowingProperty(currentProperty);
- currentProperty = NULL;
+ EndShowingProperty(m_currentProperty);
+ m_currentProperty = NULL;
}
- valueList->Clear();
- valueText->SetValue("");
+ m_valueList->Clear();
+ m_valueText->SetValue("");
if (property)
{
- currentProperty = property;
+ m_currentProperty = property;
BeginShowingProperty(property);
}
if (select)
{
int sel = FindListIndexForProperty(property);
if (sel > -1)
- propertyScrollingList->SetSelection(sel);
+ m_propertyScrollingList->SetSelection(sel);
}
return TRUE;
}
// Find appropriate validator and load property into value controls
bool wxPropertyListView::BeginShowingProperty(wxProperty *property)
{
- currentValidator = FindPropertyValidator(property);
- if (!currentValidator)
+ m_currentValidator = FindPropertyValidator(property);
+ if (!m_currentValidator)
return FALSE;
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return FALSE;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
- listValidator->OnPrepareControls(property, this, propertyWindow);
+ listValidator->OnPrepareControls(property, this, m_propertyWindow);
DisplayProperty(property);
return TRUE;
}
// Find appropriate validator and unload property from value controls
bool wxPropertyListView::EndShowingProperty(wxProperty *property)
{
- if (!currentValidator)
+ if (!m_currentValidator)
return FALSE;
RetrieveProperty(property);
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return FALSE;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
- listValidator->OnClearControls(property, this, propertyWindow);
- if (detailedEditing)
+ listValidator->OnClearControls(property, this, m_propertyWindow);
+ if (m_detailedEditing)
{
- listValidator->OnClearDetailControls(property, this, propertyWindow);
- detailedEditing = FALSE;
+ listValidator->OnClearDetailControls(property, this, m_propertyWindow);
+ m_detailedEditing = FALSE;
}
return TRUE;
}
void wxPropertyListView::BeginDetailedEditing(void)
{
- if (!currentValidator)
+ if (!m_currentValidator)
return;
- if (!currentProperty)
+ if (!m_currentProperty)
return;
- if (detailedEditing)
+ if (m_detailedEditing)
return;
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return;
- if (!currentProperty->IsEnabled())
+ if (!m_currentProperty->IsEnabled())
return;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
- if (listValidator->OnPrepareDetailControls(currentProperty, this, propertyWindow))
- detailedEditing = TRUE;
+ if (listValidator->OnPrepareDetailControls(m_currentProperty, this, m_propertyWindow))
+ m_detailedEditing = TRUE;
}
void wxPropertyListView::EndDetailedEditing(void)
{
- if (!currentValidator)
+ if (!m_currentValidator)
return;
- if (!currentProperty)
+ if (!m_currentProperty)
return;
- RetrieveProperty(currentProperty);
+ RetrieveProperty(m_currentProperty);
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
- if (detailedEditing)
+ if (m_detailedEditing)
{
- listValidator->OnClearDetailControls(currentProperty, this, propertyWindow);
- detailedEditing = FALSE;
+ listValidator->OnClearDetailControls(m_currentProperty, this, m_propertyWindow);
+ m_detailedEditing = FALSE;
}
}
bool wxPropertyListView::DisplayProperty(wxProperty *property)
{
- if (!currentValidator)
+ if (!m_currentValidator)
return FALSE;
- if (((currentValidator->GetFlags() & wxPROP_ALLOW_TEXT_EDITING) == 0) || !property->IsEnabled())
- valueText->SetEditable(FALSE);
+ if (((m_currentValidator->GetFlags() & wxPROP_ALLOW_TEXT_EDITING) == 0) || !property->IsEnabled())
+ m_valueText->SetEditable(FALSE);
else
- valueText->SetEditable(TRUE);
+ m_valueText->SetEditable(TRUE);
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return FALSE;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
- listValidator->OnDisplayValue(property, this, propertyWindow);
+ listValidator->OnDisplayValue(property, this, m_propertyWindow);
return TRUE;
}
bool wxPropertyListView::RetrieveProperty(wxProperty *property)
{
- if (!currentValidator)
+ if (!m_currentValidator)
return FALSE;
if (!property->IsEnabled())
return FALSE;
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return FALSE;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
- if (listValidator->OnCheckValue(property, this, propertyWindow))
+ if (listValidator->OnCheckValue(property, this, m_propertyWindow))
{
- if (listValidator->OnRetrieveValue(property, this, propertyWindow))
+ if (listValidator->OnRetrieveValue(property, this, m_propertyWindow))
{
UpdatePropertyDisplayInList(property);
OnPropertyChanged(property);
else
{
// Revert to old value
- listValidator->OnDisplayValue(property, this, propertyWindow);
+ listValidator->OnDisplayValue(property, this, m_propertyWindow);
}
return TRUE;
}
// Called by the listbox callback
void wxPropertyListView::OnPropertySelect(wxCommandEvent& WXUNUSED(event))
{
- int sel = propertyScrollingList->GetSelection();
+ int sel = m_propertyScrollingList->GetSelection();
if (sel > -1)
{
- wxProperty *newSel = (wxProperty *)propertyScrollingList->wxListBox::GetClientData(sel);
- if (newSel && newSel != currentProperty)
+ wxProperty *newSel = (wxProperty *)m_propertyScrollingList->wxListBox::GetClientData(sel);
+ if (newSel && newSel != m_currentProperty)
{
ShowProperty(newSel, FALSE);
}
bool wxPropertyListView::CreateControls(void)
{
- wxPanel *panel = (wxPanel *)propertyWindow;
+ wxPanel *panel = (wxPanel *)m_propertyWindow;
int largeButtonWidth = 60;
int largeButtonHeight = 25;
smallButtonHeight = -1;
#endif
- if (valueText)
+ if (m_valueText)
return TRUE;
if (!panel)
wxFont guiFont = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
#ifdef __WXMSW__
- wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxDEFAULT, wxNORMAL, wxNORMAL, FALSE, "Courier New");
+ wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxMODERN, wxNORMAL, wxNORMAL, FALSE, "Courier New");
#else
- wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxMODERN, wxNORMAL, wxNORMAL);
+ wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxTELETYPE, wxNORMAL, wxNORMAL);
#endif
// May need to be changed in future to eliminate clashes with app.
// These buttons are at the bottom of the window, but create them now
// so the constraints are evaluated in the correct order
- if (buttonFlags & wxPROP_BUTTON_OK)
+ if (m_buttonFlags & wxPROP_BUTTON_OK)
{
- windowCloseButton = new wxButton(panel, wxID_OK, "OK",
+ m_windowCloseButton = new wxButton(panel, wxID_OK, "OK",
wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
- windowCloseButton->SetDefault();
- windowCloseButton->SetFocus();
+ m_windowCloseButton->SetDefault();
+ m_windowCloseButton->SetFocus();
}
- else if (buttonFlags & wxPROP_BUTTON_CLOSE)
+ else if (m_buttonFlags & wxPROP_BUTTON_CLOSE)
{
- windowCloseButton = new wxButton(panel, wxID_OK, "Close",
+ m_windowCloseButton = new wxButton(panel, wxID_OK, "Close",
wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
}
- if (buttonFlags & wxPROP_BUTTON_CANCEL)
+ if (m_buttonFlags & wxPROP_BUTTON_CANCEL)
{
- windowCancelButton = new wxButton(panel, wxID_CANCEL, "Cancel",
+ m_windowCancelButton = new wxButton(panel, wxID_CANCEL, "Cancel",
wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
}
- if (buttonFlags & wxPROP_BUTTON_HELP)
+ if (m_buttonFlags & wxPROP_BUTTON_HELP)
{
- windowHelpButton = new wxButton(panel, wxID_HELP, "Help",
+ m_windowHelpButton = new wxButton(panel, wxID_HELP, "Help",
wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
}
- if (windowCloseButton)
+ if (m_windowCloseButton)
{
wxLayoutConstraints *c1 = new wxLayoutConstraints;
c1->bottom.SameAs (panel, wxBottom, 2);
c1->width.AsIs();
c1->height.AsIs();
- windowCloseButton->SetConstraints(c1);
- leftMostWindow = windowCloseButton;
+ m_windowCloseButton->SetConstraints(c1);
+ leftMostWindow = m_windowCloseButton;
}
- if (windowCancelButton)
+ if (m_windowCancelButton)
{
wxLayoutConstraints *c2 = new wxLayoutConstraints;
c2->bottom.SameAs (panel, wxBottom, 2);
c2->width.AsIs();
c2->height.AsIs();
- windowCancelButton->SetConstraints(c2);
- leftMostWindow = windowCancelButton;
+ m_windowCancelButton->SetConstraints(c2);
+ leftMostWindow = m_windowCancelButton;
}
- if (windowHelpButton)
+ if (m_windowHelpButton)
{
wxLayoutConstraints *c2 = new wxLayoutConstraints;
if (leftMostWindow == panel)
c2->bottom.SameAs (panel, wxBottom, 2);
c2->width.AsIs();
c2->height.AsIs();
- windowHelpButton->SetConstraints(c2);
- leftMostWindow = windowHelpButton;
+ m_windowHelpButton->SetConstraints(c2);
+ leftMostWindow = m_windowHelpButton;
}
- if (buttonFlags & wxPROP_BUTTON_CHECK_CROSS)
+ if (m_buttonFlags & wxPROP_BUTTON_CHECK_CROSS)
{
/*
if (!tickBitmap)
/*
if (tickBitmap && crossBitmap)
{
- confirmButton = new wxBitmapButton(panel, wxID_PROP_CHECK, tickBitmap,
+ m_confirmButton = new wxBitmapButton(panel, wxID_PROP_CHECK, tickBitmap,
wxPoint(-1, -1), wxSize(smallButtonWidth-5, smallButtonHeight-5));
- cancelButton = new wxBitmapButton(panel, wxID_PROP_CROSS, crossBitmap,
+ m_cancelButton = new wxBitmapButton(panel, wxID_PROP_CROSS, crossBitmap,
wxPoint(-1, -1), wxSize(smallButtonWidth-5, smallButtonHeight-5));
}
else
*/
{
- confirmButton = new wxButton(panel, wxID_PROP_CHECK, ":-)",
+ m_confirmButton = new wxButton(panel, wxID_PROP_CHECK, ":-)",
wxPoint(-1, -1), wxSize(smallButtonWidth, smallButtonHeight));
- cancelButton = new wxButton(panel, wxID_PROP_CROSS, "X",
+ m_cancelButton = new wxButton(panel, wxID_PROP_CROSS, "X",
wxPoint(-1, -1), wxSize(smallButtonWidth, smallButtonHeight));
}
c->left.SameAs (panel, wxLeft, 2);
/*
if (windowCloseButton)
- c->top.Below (windowCloseButton, 2);
+ c->top.Below (m_windowCloseButton, 2);
else
*/
c->top.SameAs (panel, wxTop, 2);
c->width.AsIs();
c->height.AsIs();
- cancelButton->SetConstraints(c);
+ m_cancelButton->SetConstraints(c);
c = new wxLayoutConstraints;
- c->left.RightOf (cancelButton, 2);
- c->top.SameAs (cancelButton, wxTop, 0);
+ c->left.RightOf (m_cancelButton, 2);
+ c->top.SameAs (m_cancelButton, wxTop, 0);
c->width.AsIs();
c->height.AsIs();
- confirmButton->SetConstraints(c);
+ m_confirmButton->SetConstraints(c);
- cancelButton->Enable(FALSE);
- confirmButton->Enable(FALSE);
+ m_cancelButton->Enable(FALSE);
+ m_confirmButton->Enable(FALSE);
}
- if (buttonFlags & wxPROP_PULLDOWN)
+ if (m_buttonFlags & wxPROP_PULLDOWN)
{
- editButton = new wxButton(panel, wxID_PROP_EDIT, "...",
+ m_editButton = new wxButton(panel, wxID_PROP_EDIT, "...",
wxPoint(-1, -1), wxSize(smallButtonWidth, smallButtonHeight));
- editButton->Enable(FALSE);
+ m_editButton->Enable(FALSE);
wxLayoutConstraints *c = new wxLayoutConstraints;
/*
- if (windowCloseButton)
- c->top.Below (windowCloseButton, 2);
+ if (m_windowCloseButton)
+ c->top.Below (m_windowCloseButton, 2);
else
*/
c->top.SameAs (panel, wxTop, 2);
c->right.SameAs (panel, wxRight, 2);
c->width.AsIs();
c->height.AsIs();
- editButton->SetConstraints(c);
+ m_editButton->SetConstraints(c);
}
- valueText = new wxPropertyTextEdit(this, panel, wxID_PROP_TEXT, "", wxPoint(-1, -1), wxSize(-1, -1), wxPROCESS_ENTER);
- valueText->Enable(FALSE);
+ m_valueText = new wxPropertyTextEdit(this, panel, wxID_PROP_TEXT, "", wxPoint(-1, -1), wxSize(-1, -1), wxPROCESS_ENTER);
+ m_valueText->Enable(FALSE);
wxLayoutConstraints *c = new wxLayoutConstraints;
- if (cancelButton)
- c->left.RightOf (confirmButton, 2);
+ if (m_cancelButton)
+ c->left.RightOf (m_confirmButton, 2);
else
c->left.SameAs (panel, wxLeft, 2);
/*
- if (windowCloseButton)
- c->top.Below (windowCloseButton, 2);
+ if (m_windowCloseButton)
+ c->top.Below (m_windowCloseButton, 2);
else
*/
c->top.SameAs (panel, wxTop, 2);
- if (editButton)
- c->right.LeftOf (editButton, 2);
+ if (m_editButton)
+ c->right.LeftOf (m_editButton, 2);
else
c->right.SameAs (panel, wxRight, 2);
c->height.AsIs();
- valueText->SetConstraints(c);
+ m_valueText->SetConstraints(c);
- valueList = new wxListBox(panel, wxID_PROP_VALUE_SELECT, wxPoint(-1, -1), wxSize(-1, 60));
- valueList->Show(FALSE);
+ m_valueList = new wxListBox(panel, wxID_PROP_VALUE_SELECT, wxPoint(-1, -1), wxSize(-1, 60));
+ m_valueList->Show(FALSE);
c = new wxLayoutConstraints;
c->left.SameAs (panel, wxLeft, 2);
- c->top.Below (valueText, 2);
+ c->top.Below (m_valueText, 2);
c->right.SameAs (panel, wxRight, 2);
c->height.Absolute(60);
- valueList->SetConstraints(c);
+ m_valueList->SetConstraints(c);
- propertyScrollingList = new wxListBox(panel, wxID_PROP_SELECT,
+ m_propertyScrollingList = new wxListBox(panel, wxID_PROP_SELECT,
wxPoint(-1, -1), wxSize(300, 300));
- propertyScrollingList->SetFont(boringFont);
+ m_propertyScrollingList->SetFont(boringFont);
c = new wxLayoutConstraints;
c->left.SameAs (panel, wxLeft, 2);
- if (buttonFlags & wxPROP_DYNAMIC_VALUE_FIELD)
- c->top.Below (valueText, 2);
+ if (m_buttonFlags & wxPROP_DYNAMIC_VALUE_FIELD)
+ c->top.Below (m_valueText, 2);
else
- c->top.Below (valueList, 2);
+ c->top.Below (m_valueList, 2);
c->right.SameAs (panel, wxRight, 2);
- if (windowCloseButton)
- c->bottom.Above (windowCloseButton, -2);
+ if (m_windowCloseButton)
+ c->bottom.Above (m_windowCloseButton, -2);
else
c->bottom.SameAs (panel, wxBottom, 2);
- propertyScrollingList->SetConstraints(c);
-
+ m_propertyScrollingList->SetConstraints(c);
// Note: if this is called now, it causes a GPF.
// Why?
void wxPropertyListView::ShowTextControl(bool show)
{
- if (valueText)
- valueText->Show(show);
+ if (m_valueText)
+ m_valueText->Show(show);
}
void wxPropertyListView::ShowListBoxControl(bool show)
{
- if (valueList)
+ if (m_valueList)
{
- valueList->Show(show);
- if (buttonFlags & wxPROP_DYNAMIC_VALUE_FIELD)
+ m_valueList->Show(show);
+ if (m_buttonFlags & wxPROP_DYNAMIC_VALUE_FIELD)
{
- wxLayoutConstraints *constraints = propertyScrollingList->GetConstraints();
+ wxLayoutConstraints *constraints = m_propertyScrollingList->GetConstraints();
if (constraints)
{
if (show)
- constraints->top.Below(valueList, 2);
+ {
+ constraints->top.Below(m_valueList, 2);
+ // Maintain back-pointer so when valueList is deleted,
+ // any reference to it from this window is removed.
+ m_valueList->AddConstraintReference(m_propertyScrollingList);
+ }
else
- constraints->top.Below(valueText, 2);
- propertyWindow->Layout();
+ {
+ constraints->top.Below(m_valueText, 2);
+ m_valueText->AddConstraintReference(m_propertyScrollingList);
+ }
+ m_propertyWindow->Layout();
}
}
}
void wxPropertyListView::EnableCheck(bool show)
{
- if (confirmButton)
- confirmButton->Enable(show);
+ if (m_confirmButton)
+ m_confirmButton->Enable(show);
}
void wxPropertyListView::EnableCross(bool show)
{
- if (cancelButton)
- cancelButton->Enable(show);
+ if (m_cancelButton)
+ m_cancelButton->Enable(show);
}
bool wxPropertyListView::OnClose(void)
void wxPropertyListView::OnValueListSelect(wxCommandEvent& WXUNUSED(event))
{
- if (currentProperty && currentValidator)
+ if (m_currentProperty && m_currentValidator)
{
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
- listValidator->OnValueListSelect(currentProperty, this, propertyWindow);
+ listValidator->OnValueListSelect(m_currentProperty, this, m_propertyWindow);
}
}
// Retrieve the value if any
OnCheck(event);
- managedWindow->Close(TRUE);
+ m_managedWindow->Close(TRUE);
}
void wxPropertyListView::OnCancel(wxCommandEvent& WXUNUSED(event))
{
// SetReturnCode(wxID_CANCEL);
- managedWindow->Close(TRUE);
- dialogCancelled = TRUE;
+ m_managedWindow->Close(TRUE);
+ sm_dialogCancelled = TRUE;
}
void wxPropertyListView::OnHelp(wxCommandEvent& WXUNUSED(event))
void wxPropertyListView::OnCheck(wxCommandEvent& WXUNUSED(event))
{
- if (currentProperty)
+ if (m_currentProperty)
{
- RetrieveProperty(currentProperty);
+ RetrieveProperty(m_currentProperty);
}
}
void wxPropertyListView::OnCross(wxCommandEvent& WXUNUSED(event))
{
- if (currentProperty && currentValidator)
+ if (m_currentProperty && m_currentValidator)
{
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
// Revert to old value
- listValidator->OnDisplayValue(currentProperty, this, propertyWindow);
+ listValidator->OnDisplayValue(m_currentProperty, this, m_propertyWindow);
}
}
void wxPropertyListView::OnPropertyDoubleClick(wxCommandEvent& WXUNUSED(event))
{
- if (currentProperty && currentValidator)
+ if (m_currentProperty && m_currentValidator)
{
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
// Revert to old value
- listValidator->OnDoubleClick(currentProperty, this, propertyWindow);
+ listValidator->OnDoubleClick(m_currentProperty, this, m_propertyWindow);
}
}
void wxPropertyListView::OnEdit(wxCommandEvent& WXUNUSED(event))
{
- if (currentProperty && currentValidator)
+ if (m_currentProperty && m_currentValidator)
{
- if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
+ if (!m_currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator)))
return;
- wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator;
+ wxPropertyListValidator *listValidator = (wxPropertyListValidator *)m_currentValidator;
- listValidator->OnEdit(currentProperty, this, propertyWindow);
+ listValidator->OnEdit(m_currentProperty, this, m_propertyWindow);
}
}
const wxSize& size, long style, const wxString& name):
wxDialog(parent, -1, title, pos, size, style, name)
{
- view = v;
- view->AssociatePanel( ((wxPanel*)this) );
- view->SetManagedWindow(this);
+ m_view = v;
+ m_view->AssociatePanel( ((wxPanel*)this) );
+ m_view->SetManagedWindow(this);
SetAutoLayout(TRUE);
}
bool wxPropertyListDialog::OnClose(void)
{
- if (view)
+ if (m_view)
{
SetReturnCode(wxID_CANCEL);
- view->OnClose();
- view = NULL;
+ m_view->OnClose();
+ m_view = NULL;
return TRUE;
}
else
void wxPropertyListDialog::OnDefaultAction(wxControl *item)
{
/*
- if (item == view->GetPropertyScrollingList())
+ if (item == m_view->GetPropertyScrollingList())
view->OnDoubleClick();
*/
}
// Extend event processing to search the view's event table
bool wxPropertyListDialog::ProcessEvent(wxEvent& event)
{
- if ( !view || ! view->ProcessEvent(event) )
+ if ( !m_view || ! m_view->ProcessEvent(event) )
return wxEvtHandler::ProcessEvent(event);
else
return TRUE;
EVT_SIZE(wxPropertyListPanel::OnSize)
END_EVENT_TABLE()
+wxPropertyListPanel::~wxPropertyListPanel()
+{
+}
+
void wxPropertyListPanel::OnDefaultAction(wxControl *item)
{
/*
// Extend event processing to search the view's event table
bool wxPropertyListPanel::ProcessEvent(wxEvent& event)
{
- if ( !view || ! view->ProcessEvent(event) )
+ if ( !m_view || ! m_view->ProcessEvent(event) )
return wxEvtHandler::ProcessEvent(event);
else
return TRUE;
bool wxPropertyListFrame::OnClose(void)
{
- if (view)
+ if (m_view)
{
- if (propertyPanel)
- propertyPanel->SetView(NULL);
- view->OnClose();
- view = NULL;
+ if (m_propertyPanel)
+ m_propertyPanel->SetView(NULL);
+ m_view->OnClose();
+ m_view = NULL;
return TRUE;
}
else
bool wxPropertyListFrame::Initialize(void)
{
- propertyPanel = OnCreatePanel(this, view);
- if (propertyPanel)
+ m_propertyPanel = OnCreatePanel(this, m_view);
+ if (m_propertyPanel)
{
- view->AssociatePanel(propertyPanel);
- view->SetManagedWindow(this);
- propertyPanel->SetAutoLayout(TRUE);
+ m_view->AssociatePanel(m_propertyPanel);
+ m_view->SetManagedWindow(this);
+ m_propertyPanel->SetAutoLayout(TRUE);
return TRUE;
}
else
// view->GetValueText()->Show(TRUE);
wxString str(property->GetValue().GetStringRepresentation());
- view->GetValueText()->SetValue(str.GetData());
+ view->GetValueText()->SetValue(str);
return TRUE;
}
///
bool wxRealListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
{
- if (realMin == 0.0 && realMax == 0.0)
+ if (m_realMin == 0.0 && m_realMax == 0.0)
return TRUE;
if (!view->GetValueText())
return FALSE;
}
- if (val < realMin || val > realMax)
+ if (val < m_realMin || val > m_realMax)
{
char buf[200];
- sprintf(buf, "Value must be a real number between %.2f and %.2f!", realMin, realMax);
+ sprintf(buf, "Value must be a real number between %.2f and %.2f!", m_realMin, m_realMax);
wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
bool wxIntegerListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
{
- if (integerMin == 0 && integerMax == 0)
+ if (m_integerMin == 0 && m_integerMax == 0)
return TRUE;
if (!view->GetValueText())
wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
- if (val < integerMin || val > integerMax)
+ if (val < m_integerMin || val > m_integerMax)
{
char buf[200];
- sprintf(buf, "Value must be an integer between %ld and %ld!", integerMin, integerMax);
+ sprintf(buf, "Value must be an integer between %ld and %ld!", m_integerMin, m_integerMax);
wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
return FALSE;
wxString str(property->GetValue().GetStringRepresentation());
- view->GetValueText()->SetValue(str.GetData());
- view->GetValueList()->SetStringSelection(str.GetData());
+ view->GetValueText()->SetValue(str);
+
+ if (view->GetValueList()->IsShown())
+ {
+ view->GetValueList()->SetStringSelection(str);
+ }
return TRUE;
}
wxStringListValidator::wxStringListValidator(wxStringList *list, long flags):
wxPropertyListValidator(flags)
{
- strings = list;
+ m_strings = list;
// If no constraint, we just allow the string to be edited.
- if (!strings && ((validatorFlags & wxPROP_ALLOW_TEXT_EDITING) == 0))
- validatorFlags |= wxPROP_ALLOW_TEXT_EDITING;
+ if (!m_strings && ((m_validatorFlags & wxPROP_ALLOW_TEXT_EDITING) == 0))
+ m_validatorFlags |= wxPROP_ALLOW_TEXT_EDITING;
}
bool wxStringListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
{
- if (!strings)
+ if (!m_strings)
return TRUE;
if (!view->GetValueText())
return FALSE;
wxString value(view->GetValueText()->GetValue());
- if (!strings->Member(value.GetData()))
+ if (!m_strings->Member(value.GetData()))
{
wxString s("Value ");
s += value.GetData();
if (!view->GetValueText())
return FALSE;
wxString str(property->GetValue().GetStringRepresentation());
- view->GetValueText()->SetValue(str.GetData());
- if (strings)
+ view->GetValueText()->SetValue(str);
+ if (m_strings && view->GetValueList() && view->GetValueList()->IsShown() && view->GetValueList()->Number() > 0)
{
- view->GetValueList()->SetStringSelection(str.GetData());
+ view->GetValueList()->SetStringSelection(str);
}
return TRUE;
}
bool wxStringListValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
{
// Unconstrained
- if (!strings)
+ if (!m_strings)
{
if (view->GetEditButton())
view->GetEditButton()->Enable(FALSE);
{
view->ShowListBoxControl(TRUE);
view->GetValueList()->Enable(TRUE);
- wxNode *node = strings->First();
+ wxNode *node = m_strings->First();
while (node)
{
char *s = (char *)node->Data();
bool wxStringListValidator::OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
{
- if (!strings)
+ if (!m_strings)
{
return TRUE;
}
{
if (!view->GetValueText())
return FALSE;
- if (!strings)
+ if (!m_strings)
return FALSE;
- wxNode *node = strings->First();
+ wxNode *node = m_strings->First();
char *currentString = property->GetValue().StringValue();
while (node)
{
if (node->Next())
nextString = (char *)node->Next()->Data();
else
- nextString = (char *)strings->First()->Data();
+ nextString = (char *)m_strings->First()->Data();
property->GetValue() = wxString(nextString);
view->DisplayProperty(property);
view->UpdatePropertyDisplayInList(property);
IMPLEMENT_DYNAMIC_CLASS(wxFilenameListValidator, wxPropertyListValidator)
wxFilenameListValidator::wxFilenameListValidator(wxString message , wxString wildcard, long flags):
- wxPropertyListValidator(flags), filenameWildCard(wildcard), filenameMessage(message)
+ wxPropertyListValidator(flags), m_filenameWildCard(wildcard), m_filenameMessage(message)
{
}
return;
char *s = wxFileSelector(
- filenameMessage.GetData(),
+ m_filenameMessage.GetData(),
wxPathOnly(property->GetValue().StringValue()),
wxFileNameFromPath(property->GetValue().StringValue()),
NULL,
- filenameWildCard.GetData(),
+ m_filenameWildCard.GetData(),
0,
parentWindow);
if (s)
if (!view->GetValueText())
return FALSE;
wxString str(property->GetValue().GetStringRepresentation());
- view->GetValueText()->SetValue(str.GetData());
+ view->GetValueText()->SetValue(str);
return TRUE;
}
class wxPropertyStringListEditorDialog: public wxDialog
{
public:
- wxStringList *stringList;
- wxListBox *listBox;
- wxTextCtrl *stringText;
- static bool dialogCancelled;
- int currentSelection;
wxPropertyStringListEditorDialog(wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long windowStyle = wxDEFAULT_DIALOG_STYLE, const wxString& name = "stringEditorDialogBox"):
wxDialog(parent, -1, title, pos, size, windowStyle, name)
{
- stringList = NULL;
- stringText = NULL;
- listBox = NULL;
- dialogCancelled = FALSE;
- currentSelection = -1;
+ m_stringList = NULL;
+ m_stringText = NULL;
+ m_listBox = NULL;
+ sm_dialogCancelled = FALSE;
+ m_currentSelection = -1;
}
~wxPropertyStringListEditorDialog(void) {}
bool OnClose(void);
void OnStrings(wxCommandEvent& event);
void OnText(wxCommandEvent& event);
+public:
+ wxStringList* m_stringList;
+ wxListBox* m_listBox;
+ wxTextCtrl* m_stringText;
+ static bool sm_dialogCancelled;
+ int m_currentSelection;
DECLARE_EVENT_TABLE()
};
EVT_BUTTON(wxID_PROP_SL_ADD, wxPropertyStringListEditorDialog::OnAdd)
EVT_BUTTON(wxID_PROP_SL_DELETE, wxPropertyStringListEditorDialog::OnDelete)
EVT_LISTBOX(wxID_PROP_SL_STRINGS, wxPropertyStringListEditorDialog::OnStrings)
- EVT_TEXT(wxID_PROP_SL_TEXT, wxPropertyStringListEditorDialog::OnText)
+ EVT_TEXT_ENTER(wxID_PROP_SL_TEXT, wxPropertyStringListEditorDialog::OnText)
END_EVENT_TABLE()
class wxPropertyStringListEditorText: public wxTextCtrl
}
};
-bool wxPropertyStringListEditorDialog::dialogCancelled = FALSE;
+bool wxPropertyStringListEditorDialog::sm_dialogCancelled = FALSE;
// Edit the string list.
bool wxListOfStringsListValidator::EditStringList(wxWindow *parent, wxStringList *stringList, const char *title)
{
+ int largeButtonWidth = 60;
+ int largeButtonHeight = 25;
+
wxBeginBusyCursor();
wxPropertyStringListEditorDialog *dialog = new wxPropertyStringListEditorDialog(parent,
title, wxPoint(10, 10), wxSize(400, 400), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL);
- dialog->stringList = stringList;
+ dialog->m_stringList = stringList;
- wxButton *okButton = new wxButton(dialog, wxID_OK, "OK", wxPoint(5, 5));
- wxButton *cancelButton = new wxButton(dialog, wxID_CANCEL, "Cancel", wxPoint(40, 5));
+ dialog->m_listBox = new wxListBox(dialog, wxID_PROP_SL_STRINGS,
+ wxPoint(-1, -1), wxSize(-1, -1), 0, NULL, wxLB_SINGLE);
-// wxButton *helpButton = new wxButton(dialog, (wxFunction)StringListEditorHelpProc, "Help");
-// helpButton->SetClientData((char *)this);
-
- dialog->listBox = new wxListBox(dialog, wxID_PROP_SL_STRINGS,
- wxPoint(5, 30), wxSize(300, 200), 0, NULL, wxLB_SINGLE);
-
- dialog->stringText = new wxPropertyStringListEditorText(dialog,
+ dialog->m_stringText = new wxPropertyStringListEditorText(dialog,
wxID_PROP_SL_TEXT, "", wxPoint(5, 240),
wxSize(300, -1), wxPROCESS_ENTER);
- dialog->stringText->Enable(FALSE);
+ dialog->m_stringText->Enable(FALSE);
+
+ wxButton *addButton = new wxButton(dialog, wxID_PROP_SL_ADD, "Add", wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
+ wxButton *deleteButton = new wxButton(dialog, wxID_PROP_SL_DELETE, "Delete", wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
+ wxButton *cancelButton = new wxButton(dialog, wxID_CANCEL, "Cancel", wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
+ wxButton *okButton = new wxButton(dialog, wxID_OK, "OK", wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
+
+ okButton->SetDefault();
+
+ wxLayoutConstraints *c = new wxLayoutConstraints;
- wxButton *addButton = new wxButton(dialog, wxID_PROP_SL_ADD, "Add", wxPoint(5, 280));
- wxButton *deleteButton = new wxButton(dialog, wxID_PROP_SL_DELETE, "Delete", wxPoint(40, 280));
+ c->top.SameAs (dialog, wxTop, 2);
+ c->left.SameAs (dialog, wxLeft, 2);
+ c->right.SameAs (dialog, wxRight, 2);
+ c->bottom.SameAs (dialog->m_stringText, wxTop, 2);
+ dialog->m_listBox->SetConstraints(c);
+
+ c = new wxLayoutConstraints;
+ c->left.SameAs (dialog, wxLeft, 2);
+ c->right.SameAs (dialog, wxRight, 2);
+ c->bottom.SameAs (addButton, wxTop, 2);
+ c->height.AsIs();
+ dialog->m_stringText->SetConstraints(c);
+
+ c = new wxLayoutConstraints;
+ c->bottom.SameAs (dialog, wxBottom, 2);
+ c->left.SameAs (dialog, wxLeft, 2);
+ c->width.AsIs();
+ c->height.AsIs();
+ addButton->SetConstraints(c);
+
+ c = new wxLayoutConstraints;
+ c->bottom.SameAs (dialog, wxBottom, 2);
+ c->left.SameAs (addButton, wxRight, 2);
+ c->width.AsIs();
+ c->height.AsIs();
+ deleteButton->SetConstraints(c);
+
+ c = new wxLayoutConstraints;
+ c->bottom.SameAs (dialog, wxBottom, 2);
+ c->right.SameAs (dialog, wxRight, 2);
+ c->width.AsIs();
+ c->height.AsIs();
+ cancelButton->SetConstraints(c);
+
+ c = new wxLayoutConstraints;
+ c->bottom.SameAs (dialog, wxBottom, 2);
+ c->right.SameAs (cancelButton, wxLeft, 2);
+ c->width.AsIs();
+ c->height.AsIs();
+ okButton->SetConstraints(c);
wxNode *node = stringList->First();
while (node)
{
char *str = (char *)node->Data();
// Save node as client data for each listbox item
- dialog->listBox->Append(str, (char *)node);
+ dialog->m_listBox->Append(str, (char *)node);
node = node->Next();
}
dialog->SetClientSize(310, 305);
+ dialog->Layout();
dialog->Centre(wxBOTH);
wxEndBusyCursor();
void wxPropertyStringListEditorDialog::OnStrings(wxCommandEvent& WXUNUSED(event))
{
- int sel = listBox->GetSelection();
+ int sel = m_listBox->GetSelection();
if (sel > -1)
{
- currentSelection = sel;
+ m_currentSelection = sel;
ShowCurrentSelection();
}
void wxPropertyStringListEditorDialog::OnDelete(wxCommandEvent& WXUNUSED(event))
{
- int sel = listBox->GetSelection();
+ int sel = m_listBox->GetSelection();
if (sel == -1)
return;
- wxNode *node = (wxNode *)listBox->wxListBox::GetClientData(sel);
+ wxNode *node = (wxNode *)m_listBox->wxListBox::GetClientData(sel);
if (!node)
return;
- listBox->Delete(sel);
+ m_listBox->Delete(sel);
delete[] (char *)node->Data();
delete node;
- currentSelection = -1;
- stringText->SetValue("");
+ m_currentSelection = -1;
+ m_stringText->SetValue("");
}
void wxPropertyStringListEditorDialog::OnAdd(wxCommandEvent& WXUNUSED(event))
SaveCurrentSelection();
char *initialText = "";
- wxNode *node = stringList->Add(initialText);
- listBox->Append(initialText, (char *)node);
- currentSelection = stringList->Number() - 1;
- listBox->SetSelection(currentSelection);
+ wxNode *node = m_stringList->Add(initialText);
+ m_listBox->Append(initialText, (char *)node);
+ m_currentSelection = m_stringList->Number() - 1;
+ m_listBox->SetSelection(m_currentSelection);
ShowCurrentSelection();
- stringText->SetFocus();
+ m_stringText->SetFocus();
}
void wxPropertyStringListEditorDialog::OnOK(wxCommandEvent& WXUNUSED(event))
void wxPropertyStringListEditorDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
{
- dialogCancelled = TRUE;
+ sm_dialogCancelled = TRUE;
EndModal(wxID_CANCEL);
Close(TRUE);
}
void wxPropertyStringListEditorDialog::SaveCurrentSelection(void)
{
- if (currentSelection == -1)
+ if (m_currentSelection == -1)
return;
- wxNode *node = (wxNode *)listBox->wxListBox::GetClientData(currentSelection);
+ wxNode *node = (wxNode *)m_listBox->wxListBox::GetClientData(m_currentSelection);
if (!node)
return;
- wxString txt(stringText->GetValue());
+ wxString txt(m_stringText->GetValue());
if (node->Data())
delete[] (char *)node->Data();
node->SetData((wxObject *)copystring(txt));
- listBox->SetString(currentSelection, (char *)node->Data());
+ m_listBox->SetString(m_currentSelection, (char *)node->Data());
}
void wxPropertyStringListEditorDialog::ShowCurrentSelection(void)
{
- if (currentSelection == -1)
+ if (m_currentSelection == -1)
{
- stringText->SetValue("");
+ m_stringText->SetValue("");
return;
}
- wxNode *node = (wxNode *)listBox->wxListBox::GetClientData(currentSelection);
+ wxNode *node = (wxNode *)m_listBox->wxListBox::GetClientData(m_currentSelection);
char *txt = (char *)node->Data();
- stringText->SetValue(txt);
- stringText->Enable(TRUE);
+ m_stringText->SetValue(txt);
+ m_stringText->Enable(TRUE);
}