当前位置: 首页>>代码示例>>C++>>正文


C++ HasClientObjectData函数代码示例

本文整理汇总了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();
}
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:26,代码来源:choice.cpp

示例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
开发者ID:CustomCardsOnline,项目名称:wxWidgets,代码行数:31,代码来源:choice.cpp

示例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();
}
开发者ID:Annovae,项目名称:Dolphin-Core,代码行数:35,代码来源:choice.cpp

示例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();
}
开发者ID:Bluehorn,项目名称:wxPython,代码行数:29,代码来源:listbox.cpp

示例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));
}
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:7,代码来源:ctrlsub.cpp

示例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);
}
开发者ID:project-renard-survey,项目名称:chandler,代码行数:26,代码来源:listbox.cpp

示例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();
}
开发者ID:hgwells,项目名称:tive,代码行数:27,代码来源:listbox.cpp

示例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
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:59,代码来源:listbox.cpp

示例9: DetachWidget

wxComboBox::~wxComboBox()
{
    DetachWidget((Widget) m_mainWidget); // Removes event handlers
    XtDestroyWidget((Widget) m_mainWidget);
    m_mainWidget = (WXWidget) 0;
    if ( HasClientObjectData() )
        m_clientDataDict.DestroyData();
}
开发者ID:EdgarTx,项目名称:wx,代码行数:8,代码来源:combobox.cpp

示例10: XmComboBoxDeleteAllItems

void wxComboBox::Clear()
{
    XmComboBoxDeleteAllItems((Widget) m_mainWidget);
    m_stringList.Clear();

    if ( HasClientObjectData() )
        m_clientDataDict.DestroyData();
    m_noStrings = 0;
}
开发者ID:EdgarTx,项目名称:wx,代码行数:9,代码来源:combobox.cpp

示例11: XmListDeletePos

void wxListBox::Delete(unsigned int n)
{
    Widget listBox = (Widget) m_mainWidget;

    XmListDeletePos (listBox, n + 1);

    m_clientDataDict.Delete(n, HasClientObjectData());
    m_noItems --;
}
开发者ID:hgwells,项目名称:tive,代码行数:9,代码来源:listbox.cpp

示例12: FreeData

void wxChoice::FreeData()
{
    if ( HasClientObjectData() )
    {
        size_t count = GetCount();
        for ( size_t n = 0; n < count; n++ )
        {
            delete GetClientObject(n);
        }
    }
}
开发者ID:Duion,项目名称:Torsion,代码行数:11,代码来源:choice.cpp

示例13: Free

void wxChoice::Free()
{
    if ( HasClientObjectData() )
    {
        unsigned int count = GetCount();
        for ( unsigned int n = 0; n < count; n++ )
        {
            delete GetClientObject(n);
        }
    }
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:11,代码来源:choice.cpp

示例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);
}
开发者ID:project-renard-survey,项目名称:chandler,代码行数:11,代码来源:choicece.cpp

示例15: GetClientObject

wxChoice::~wxChoice()
{
    if ( HasClientObjectData() )
    {
        unsigned int i, max = GetCount();

        for ( i = 0; i < max; ++i )
            delete GetClientObject( i );
    }
    delete m_popUpMenu;
}
开发者ID:chromylei,项目名称:third_party,代码行数:11,代码来源:choice_osx.cpp


注:本文中的HasClientObjectData函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。