本文整理汇总了C++中HasClientObjectData函数的典型用法代码示例。如果您正苦于以下问题:C++ HasClientObjectData函数的具体用法?C++ HasClientObjectData怎么用?C++ HasClientObjectData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HasClientObjectData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxCHECK_RET
void wxChoice::SetString(unsigned int n, const wxString& s)
{
wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::SetString") );
// we have to delete and add back the string as there is no way to change a
// string in place
// we need to preserve the client data manually
void *oldData = NULL;
wxClientData *oldObjData = NULL;
if ( HasClientUntypedData() )
oldData = GetClientData(n);
else if ( HasClientObjectData() )
oldObjData = GetClientObject(n);
::SendMessage(GetHwnd(), CB_DELETESTRING, n, 0);
::SendMessage(GetHwnd(), CB_INSERTSTRING, n, (LPARAM)s.wx_str() );
// restore the client data
if ( oldData )
SetClientData(n, oldData);
else if ( oldObjData )
SetClientObject(n, oldObjData);
InvalidateBestSize();
}
示例2: WXUNUSED
bool wxChoice::OS2Command(
WXUINT uParam
, WXWORD WXUNUSED(wId)
)
{
if (uParam != LN_SELECT)
{
//
// "selection changed" is the only event we're after
//
return false;
}
int n = GetSelection();
if (n > -1)
{
wxCommandEvent vEvent( wxEVT_CHOICE
,m_windowId
);
vEvent.SetInt(n);
vEvent.SetEventObject(this);
vEvent.SetString(GetStringSelection());
if (HasClientObjectData())
vEvent.SetClientObject(GetClientObject(n));
else if (HasClientUntypedData())
vEvent.SetClientData(GetClientData(n));
ProcessCommand(vEvent);
}
return true;
} // end of wxChoice::OS2Command
示例3: wxCHECK_RET
void wxChoice::SetString(unsigned int n, const wxString& s)
{
wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::SetString") );
// we have to delete and add back the string as there is no way to change a
// string in place
// we need to preserve the client data manually
void *oldData = NULL;
wxClientData *oldObjData = NULL;
if ( HasClientUntypedData() )
oldData = GetClientData(n);
else if ( HasClientObjectData() )
oldObjData = GetClientObject(n);
// and also the selection if we're going to delete the item that was
// selected
const bool wasSelected = static_cast<int>(n) == GetSelection();
::SendMessage(GetHwnd(), CB_DELETESTRING, n, 0);
::SendMessage(GetHwnd(), CB_INSERTSTRING, n, (LPARAM)s.wx_str() );
// restore the client data
if ( oldData )
SetClientData(n, oldData);
else if ( oldObjData )
SetClientObject(n, oldObjData);
// and the selection
if ( wasSelected )
SetSelection(n);
// the width could have changed so the best size needs to be recomputed
InvalidateBestSize();
}
示例4: wxCHECK_RET
void wxListBox::Clear()
{
wxCHECK_RET( m_list != NULL, wxT("invalid listbox") );
gtk_list_clear_items( m_list, 0, (int)GetCount() );
if ( GTK_LIST(m_list)->last_focus_child != NULL )
{
// This should be NULL, I think.
GTK_LIST(m_list)->last_focus_child = NULL;
}
if ( HasClientObjectData() )
{
// destroy the data (due to Robert's idea of using wxList<wxObject>
// and not wxList<wxClientData> we can't just say
// m_clientList.DeleteContents(true) - this would crash!
wxList::compatibility_iterator node = m_clientList.GetFirst();
while ( node )
{
delete (wxClientData *)node->GetData();
node = node->GetNext();
}
}
m_clientList.Clear();
if ( m_strings )
m_strings->Clear();
}
示例5: wxCHECK_MSG
wxClientData *wxItemContainer::GetClientObject(unsigned int n) const
{
wxCHECK_MSG( HasClientObjectData(), NULL,
wxT("this window doesn't have object client data") );
return static_cast<wxClientData *>(DoGetItemClientData(n));
}
示例6: event
bool wxListBox::SendEvent(wxEventType type, int item)
{
wxCommandEvent event(type, m_windowId);
event.SetEventObject(this);
// use the current item by default
if ( item == -1 )
{
item = m_current;
}
// client data and string parameters only make sense if we have an item
if ( item != -1 )
{
if ( HasClientObjectData() )
event.SetClientObject(GetClientObject(item));
else if ( HasClientUntypedData() )
event.SetClientData(GetClientData(item));
event.SetString(GetString(item));
}
event.SetInt(item);
return GetEventHandler()->ProcessEvent(event);
}
示例7: DoSetItems
void wxListBox::DoSetItems(const wxArrayString& items, void** clientData)
{
Widget listBox = (Widget) m_mainWidget;
if( HasClientObjectData() )
m_clientDataDict.DestroyData();
XmString *text = new XmString[items.GetCount()];
unsigned int i;
for (i = 0; i < items.GetCount(); ++i)
text[i] = wxStringToXmString (items[i]);
if ( clientData )
for (i = 0; i < items.GetCount(); ++i)
m_clientDataDict.Set(i, (wxClientData*)clientData[i], false);
XmListAddItems (listBox, text, items.GetCount(), 0);
for (i = 0; i < items.GetCount(); i++)
XmStringFree (text[i]);
delete[] text;
// It seems that if the list is cleared, we must re-ask for
// selection policy!!
SetSelectionPolicy();
m_noItems = items.GetCount();
}
示例8: wxCHECK_RET
void wxListBox::SetString(unsigned int n, const wxString& rsString)
{
wxCHECK_RET( IsValid(n),
wxT("invalid index in wxListBox::SetString") );
//
// Remember the state of the item
//
bool bWasSelected = IsSelected(n);
void* pOldData = NULL;
wxClientData* pOldObjData = NULL;
if ( HasClientUntypedData() )
pOldData = GetClientData(n);
else if ( HasClientObjectData() )
pOldObjData = GetClientObject(n);
//
// Delete and recreate it
//
::WinSendMsg( GetHwnd()
,LM_DELETEITEM
,(MPARAM)n
,(MPARAM)0
);
int nNewN = n;
if (n == (m_nNumItems - 1))
nNewN = -1;
::WinSendMsg( GetHwnd()
,LM_INSERTITEM
,(MPARAM)nNewN
,(MPARAM)rsString.wx_str()
);
//
// Restore the client data
//
if (pOldData)
SetClientData(n, pOldData);
else if (pOldObjData)
SetClientObject(n, pOldObjData);
//
// We may have lost the selection
//
if (bWasSelected)
Select(n);
#if wxUSE_OWNER_DRAWN
if (m_windowStyle & wxLB_OWNERDRAW)
//
// Update item's text
//
m_aItems[n]->SetName(rsString);
#endif //USE_OWNER_DRAWN
} // end of wxListBox::SetString
示例9: DetachWidget
wxComboBox::~wxComboBox()
{
DetachWidget((Widget) m_mainWidget); // Removes event handlers
XtDestroyWidget((Widget) m_mainWidget);
m_mainWidget = (WXWidget) 0;
if ( HasClientObjectData() )
m_clientDataDict.DestroyData();
}
示例10: XmComboBoxDeleteAllItems
void wxComboBox::Clear()
{
XmComboBoxDeleteAllItems((Widget) m_mainWidget);
m_stringList.Clear();
if ( HasClientObjectData() )
m_clientDataDict.DestroyData();
m_noStrings = 0;
}
示例11: XmListDeletePos
void wxListBox::Delete(unsigned int n)
{
Widget listBox = (Widget) m_mainWidget;
XmListDeletePos (listBox, n + 1);
m_clientDataDict.Delete(n, HasClientObjectData());
m_noItems --;
}
示例12: FreeData
void wxChoice::FreeData()
{
if ( HasClientObjectData() )
{
size_t count = GetCount();
for ( size_t n = 0; n < count; n++ )
{
delete GetClientObject(n);
}
}
}
示例13: Free
void wxChoice::Free()
{
if ( HasClientObjectData() )
{
unsigned int count = GetCount();
for ( unsigned int n = 0; n < count; n++ )
{
delete GetClientObject(n);
}
}
}
示例14: wxCHECK_RET
void wxChoice::Delete(int n)
{
wxCHECK_RET( n < GetCount(), wxT("invalid item index in wxChoice::Delete") );
if ( HasClientObjectData() )
{
delete GetClientObject(n);
}
::SendMessage(GetBuddyHwnd(), LB_DELETESTRING, n, 0);
}
示例15: GetClientObject
wxChoice::~wxChoice()
{
if ( HasClientObjectData() )
{
unsigned int i, max = GetCount();
for ( i = 0; i < max; ++i )
delete GetClientObject( i );
}
delete m_popUpMenu;
}