// Created: 2008-08-24
// RCS-ID: $Id$
// Copyright: (c) Jaakko Salli
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
return iface->GetPropertyByNameA(*m_ptr.stringName);
else if ( m_flags & IsCharPtr )
return iface->GetPropertyByNameA(m_ptr.charName);
-#if wxUSE_WCHAR_T
else if ( m_flags & IsWCharPtr )
return iface->GetPropertyByNameA(m_ptr.wcharName);
-#endif
return NULL;
}
wxPGProperty* wxPropertyGridInterface::Append( wxPGProperty* property )
{
wxPGProperty* retp = m_pState->DoAppend(property);
-
+
wxPropertyGrid* grid = m_pState->GetGrid();
if ( grid )
grid->RefreshGrid();
wxPG_PROP_ARG_CALL_PROLOG()
wxPropertyGridPageState* state = p->GetParentState();
- wxPropertyGrid* grid = state->GetGrid();
-
- if ( grid->GetState() == state )
- grid->DoSelectProperty(NULL, wxPG_SEL_DELETING|wxPG_SEL_NOVALIDATE);
state->DoDelete( p, true );
wxNullProperty);
wxPropertyGridPageState* state = p->GetParentState();
- wxPropertyGrid* grid = state->GetGrid();
-
- if ( grid->GetState() == state )
- {
- grid->DoSelectProperty(NULL,
- wxPG_SEL_DELETING|wxPG_SEL_NOVALIDATE);
- }
state->DoDelete( p, false );
- // Mark the property as 'unattached'
- p->m_parentState = NULL;
- p->m_parent = NULL;
-
RefreshGrid(state);
return p;
// wxPropertyGridInterface property operations
// -----------------------------------------------------------------------
+wxPGProperty* wxPropertyGridInterface::GetSelection() const
+{
+ return m_pState->GetSelection();
+}
+
+// -----------------------------------------------------------------------
+
bool wxPropertyGridInterface::ClearSelection( bool validation )
{
- int flags = 0;
+ bool res = DoClearSelection(validation, wxPG_SEL_DONT_SEND_EVENT);
+ wxPropertyGrid* pg = GetPropertyGrid();
+ if ( pg )
+ pg->Refresh();
+ return res;
+}
+
+// -----------------------------------------------------------------------
+
+bool wxPropertyGridInterface::DoClearSelection( bool validation,
+ int selFlags )
+{
if ( !validation )
- flags |= wxPG_SEL_NOVALIDATE;
+ selFlags |= wxPG_SEL_NOVALIDATE;
wxPropertyGridPageState* state = m_pState;
{
wxPropertyGrid* pg = state->GetGrid();
if ( pg->GetState() == state )
- return pg->DoSelectProperty(NULL, flags);
+ return pg->DoSelectProperty(NULL, selFlags);
else
- state->SetSelection(NULL);
+ state->DoSetSelection(NULL);
}
return true;
return false;
// If active, Set active Editor.
- if ( grid->GetState() == state && p == grid->GetSelection() )
+ if ( grid && grid->GetState() == state && p == grid->GetSelection() )
grid->DoSelectProperty( p, wxPG_SEL_FORCE );
}
else
return false;
// If active, Disable as active Editor.
- if ( grid->GetState() == state && p == grid->GetSelection() )
+ if ( grid && grid->GetState() == state && p == grid->GetSelection() )
grid->DoSelectProperty( p, wxPG_SEL_FORCE );
}
- state->DoEnableProperty(p, enable);
+ p->DoEnable(enable);
RefreshProperty( p );
if ( GetSelection() && GetSelection() != state->DoGetRoot() &&
!doExpand )
{
- pg->ClearSelection(false);
+ pg->DoClearSelection();
}
wxPGVIterator it;
if ( !page ) break;
page->DoGetRoot()->SetFlagRecursively(wxPG_PROP_MODIFIED, false);
+ page->m_anyModified = false;
pageIndex++;
}
GetPropertyGrid()->RefreshEditor();
}
+bool wxPropertyGridInterface::SetColumnProportion( unsigned int column,
+ int proportion )
+{
+ wxCHECK(m_pState, false);
+ wxPropertyGrid* pg = m_pState->GetGrid();
+ wxCHECK(pg, false);
+ wxCHECK(pg->HasFlag(wxPG_SPLITTER_AUTO_CENTER), false);
+ m_pState->DoSetColumnProportion(column, proportion);
+ return true;
+}
+
// -----------------------------------------------------------------------
// wxPropertyGridInterface property value setting and getting
// -----------------------------------------------------------------------
{
wxPropertyGrid* pg = GetPropertyGrid();
- pg->ClearSelection(false);
-
unsigned int pageIndex = 0;
for (;;)
page->DoSort(flags);
pageIndex++;
}
+
+ // Fix positions of any open editor controls
+ if ( pg )
+ pg->CorrectEditorWidgetPosY();
}
// -----------------------------------------------------------------------
void
wxPropertyGridInterface::SetPropertyBackgroundColour( wxPGPropArg id,
const wxColour& colour,
- bool recursively )
+ int flags )
{
wxPG_PROP_ARG_CALL_PROLOG()
- p->SetBackgroundColour( colour, recursively );
- RefreshProperty( p );
+ p->SetBackgroundColour(colour, flags);
+ RefreshProperty(p);
}
// -----------------------------------------------------------------------
void wxPropertyGridInterface::SetPropertyTextColour( wxPGPropArg id,
const wxColour& colour,
- bool recursively )
+ int flags )
{
wxPG_PROP_ARG_CALL_PROLOG()
- p->SetTextColour( colour, recursively );
- RefreshProperty( p );
+ p->SetTextColour(colour, flags);
+ RefreshProperty(p);
}
// -----------------------------------------------------------------------
wxPG_PROP_ARG_CALL_PROLOG()
wxPGCell& cell = p->GetCell(column);
- if ( text.length() && text != wxPG_LABEL )
+ if ( !text.empty() && text != wxPG_LABEL )
cell.SetText(text);
if ( bitmap.IsOk() )
cell.SetBitmap(bitmap);
if ( includedStates & ExpandedState )
{
wxArrayPGProperty ptrs;
- wxPropertyGridConstIterator it =
+ wxPropertyGridConstIterator it =
wxPropertyGridConstIterator( pageState,
wxPG_ITERATE_ALL_PARENTS_RECURSIVELY|wxPG_ITERATE_HIDDEN,
wxNullProperty );
}
// Remove last '|'
- if ( result.length() )
+ if ( !result.empty() )
result.RemoveLast();
return result;
{
if ( restoreStates & ExpandedState )
{
- wxPropertyGridIterator it =
+ wxPropertyGridIterator it =
wxPropertyGridIterator( pageState,
wxPG_ITERATE_ALL,
wxNullProperty );
{
if ( pageState->IsDisplayed() )
{
- if ( values[0].length() )
+ if ( !values[0].empty() )
newSelection = GetPropertyByName(value);
pgSelectionSet = true;
}
else
{
- if ( values[0].length() )
- pageState->SetSelection(GetPropertyByName(value));
+ if ( !values[0].empty() )
+ pageState->DoSetSelection(GetPropertyByName(value));
else
pageState->DoClearSelection();
}
if ( pgSelectionSet )
{
if ( newSelection )
- pg->SelectProperty(newSelection);
+ pg->DoSelectProperty(newSelection);
else
- pg->ClearSelection();
+ pg->DoClearSelection();
}
if ( selectedPage != -1 )