avoid flicker in methods which don't change listbox size by not calling XtUnmanage/ManageChild() unnecessarily (patch 1566670)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41591 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-10-03 14:55:49 +00:00
parent dd47af27e1
commit 0d194444a7

View File

@@ -209,33 +209,18 @@ void wxListBox::DoSetFirstItem( int N )
void wxListBox::Delete(unsigned int n) void wxListBox::Delete(unsigned int n)
{ {
wxSizeKeeper sk( this );
Widget listBox = (Widget) m_mainWidget; Widget listBox = (Widget) m_mainWidget;
bool managed = XtIsManaged(listBox);
if (managed)
XtUnmanageChild (listBox);
XmListDeletePos (listBox, n + 1); XmListDeletePos (listBox, n + 1);
if (managed)
XtManageChild (listBox);
sk.Restore();
m_clientDataDict.Delete(n, HasClientObjectData()); m_clientDataDict.Delete(n, HasClientObjectData());
m_noItems --; m_noItems --;
} }
int wxListBox::DoAppend(const wxString& item) int wxListBox::DoAppend(const wxString& item)
{ {
wxSizeKeeper sk( this );
Widget listBox = (Widget) m_mainWidget; Widget listBox = (Widget) m_mainWidget;
bool managed = XtIsManaged(listBox);
if (managed)
XtUnmanageChild (listBox);
int n; int n;
XtVaGetValues (listBox, XmNitemCount, &n, NULL); XtVaGetValues (listBox, XmNitemCount, &n, NULL);
wxXmString text( item ); wxXmString text( item );
@@ -246,10 +231,6 @@ int wxListBox::DoAppend(const wxString& item)
// selection policy!! // selection policy!!
SetSelectionPolicy(); SetSelectionPolicy();
if (managed)
XtManageChild (listBox);
sk.Restore();
m_noItems ++; m_noItems ++;
return GetCount() - 1; return GetCount() - 1;
@@ -257,16 +238,11 @@ int wxListBox::DoAppend(const wxString& item)
void wxListBox::DoSetItems(const wxArrayString& items, void** clientData) void wxListBox::DoSetItems(const wxArrayString& items, void** clientData)
{ {
wxSizeKeeper sk( this );
Widget listBox = (Widget) m_mainWidget; Widget listBox = (Widget) m_mainWidget;
if( HasClientObjectData() ) if( HasClientObjectData() )
m_clientDataDict.DestroyData(); m_clientDataDict.DestroyData();
bool managed = XtIsManaged(listBox);
if (managed)
XtUnmanageChild (listBox);
XmString *text = new XmString[items.GetCount()]; XmString *text = new XmString[items.GetCount()];
unsigned int i; unsigned int i;
for (i = 0; i < items.GetCount(); ++i) for (i = 0; i < items.GetCount(); ++i)
@@ -285,11 +261,6 @@ void wxListBox::DoSetItems(const wxArrayString& items, void** clientData)
// selection policy!! // selection policy!!
SetSelectionPolicy(); SetSelectionPolicy();
if (managed)
XtManageChild (listBox);
sk.Restore();
m_noItems = items.GetCount(); m_noItems = items.GetCount();
} }
@@ -487,14 +458,8 @@ wxString wxListBox::GetString(unsigned int n) const
void wxListBox::DoInsertItems(const wxArrayString& items, unsigned int pos) void wxListBox::DoInsertItems(const wxArrayString& items, unsigned int pos)
{ {
wxSizeKeeper sk( this );
Widget listBox = (Widget) m_mainWidget; Widget listBox = (Widget) m_mainWidget;
bool managed = XtIsManaged(listBox);
if (managed)
XtUnmanageChild(listBox);
XmString *text = new XmString[items.GetCount()]; XmString *text = new XmString[items.GetCount()];
unsigned int i; unsigned int i;
// Steve Hammes: Motif 1.1 compatibility // Steve Hammes: Motif 1.1 compatibility
@@ -520,11 +485,6 @@ void wxListBox::DoInsertItems(const wxArrayString& items, unsigned int pos)
// selection policy!! // selection policy!!
SetSelectionPolicy(); SetSelectionPolicy();
if (managed)
XtManageChild(listBox);
sk.Restore();
m_noItems += items.GetCount(); m_noItems += items.GetCount();
} }