本文整理匯總了C++中GetClientObject函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetClientObject函數的具體用法?C++ GetClientObject怎麽用?C++ GetClientObject使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GetClientObject函數的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);
// 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();
}
示例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: 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);
}
示例4: 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();
}
示例5: 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
示例6: GetSelection
wxString ctlComboBoxFix::GetStringKey(int sel)
{
if (sel < 0)
sel = GetSelection();
StringClientData *scd=(StringClientData*)GetClientObject(sel);
if (scd)
return scd->str;
return wxEmptyString;
}
示例7: GetClientObject
void wxItemContainer::ResetItemClientObject(unsigned int n)
{
wxClientData * const data = GetClientObject(n);
if ( data )
{
delete data;
DoSetItemClientData(n, NULL);
}
}
示例8: progress
void MainFrame::OnImageButtonClick(wxCommandEvent &event) {
wxProgressDialog progress("Loading", "Now Loading", 4, this);
auto button = dynamic_cast<wxButton *>(event.GetEventObject());
auto clientData =
dynamic_cast<wxStringClientData *>(button->GetClientObject());
auto page = notebook->GetPageCount();
progress.Update(1);
auto childEntry =
dynamic_cast<EntryItemData *>(button->GetClientObject())->Get();
progress.Update(2);
auto bitmapCtl = new ImageViewPanel(notebook, childEntry);
progress.Update(3);
notebook->AddPage(bitmapCtl, childEntry->Name());
progress.Update(4);
bitmapCtl->SwitchToTheActualImage();
notebook->SetSelection(page);
}
示例9: wxSwap
void wxRearrangeList::Swap(int pos1, int pos2)
{
// update the internally stored order
wxSwap(m_order[pos1], m_order[pos2]);
// and now also swap all the attributes of the items
// first the label
const wxString stringTmp = GetString(pos1);
SetString(pos1, GetString(pos2));
Check(pos1, IsChecked(pos2));
// then the checked state
const bool checkedTmp = IsChecked(pos1);
SetString(pos2, stringTmp);
Check(pos2, checkedTmp);
// and finally the client data, if necessary
switch ( GetClientDataType() )
{
case wxClientData_None:
// nothing to do
break;
case wxClientData_Object:
{
wxClientData * const dataTmp = GetClientObject(pos1);
SetClientObject(pos1, GetClientObject(pos2));
SetClientObject(pos2, dataTmp);
}
break;
case wxClientData_Void:
{
void * const dataTmp = GetClientData(pos1);
SetClientData(pos1, GetClientData(pos2));
SetClientData(pos2, dataTmp);
}
break;
}
}
示例10: GetCount
void wxChoice::FreeData()
{
if ( HasClientObjectData() )
{
size_t count = GetCount();
for ( size_t n = 0; n < count; n++ )
{
delete GetClientObject(n);
}
}
}
示例11: GetCount
wxChoice::~wxChoice()
{
if ( HasClientObjectData() )
{
unsigned int i, max = GetCount();
for ( i = 0; i < max; ++i )
delete GetClientObject( i );
}
delete m_popUpMenu;
}
示例12: GetCount
void wxChoice::Free()
{
if ( HasClientObjectData() )
{
unsigned int count = GetCount();
for ( unsigned int n = 0; n < count; n++ )
{
delete GetClientObject(n);
}
}
}
示例13: 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);
}
示例14: wxCHECK_RET
void wxChoice::Delete(int n)
{
wxCHECK_RET( n < GetCount(), wxT("invalid item index in wxChoice::Delete") );
if ( HasClientObjectData() )
{
delete GetClientObject(n);
}
::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , n + 1) ;
m_strings.RemoveAt( n ) ;
m_datas.RemoveAt( n ) ;
m_peer->SetMaximum( GetCount() ) ;
}
示例15: wxCHECK_RET
void wxChoice::Delete(unsigned int n)
{
wxCHECK_RET( IsValid(n) , wxT("wxChoice::Delete: invalid index") );
if ( HasClientObjectData() )
delete GetClientObject( n );
::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , n + 1 ) ;
m_strings.RemoveAt( n ) ;
m_datas.RemoveAt( n ) ;
m_peer->SetMaximum( GetCount() ) ;
}