1. sorted wxListBox and wxComboBox seem to work under wxGTK
2. to support this, new class wxControlWithItems added (ctrlsub.h/cpp) and the controls sample modified to test it git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4141 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -30,7 +30,6 @@
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/choice.h"
|
||||
#include "wx/log.h"
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
@@ -38,80 +37,26 @@
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// events
|
||||
// selection
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxChoiceBase::Command(wxCommandEvent &event)
|
||||
bool wxChoiceBase::SetStringSelection(const wxString& s)
|
||||
{
|
||||
SetSelection(event.GetInt());
|
||||
(void)ProcessEvent(event);
|
||||
}
|
||||
int sel = FindString(s);
|
||||
wxCHECK_MSG( sel != -1, FALSE,
|
||||
wxT("invalid string in wxChoice::SetStringSelection") );
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// string selection management
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxString wxChoiceBase::GetStringSelection() const
|
||||
{
|
||||
int sel = GetSelection();
|
||||
wxString str;
|
||||
wxCHECK_MSG( sel != wxNOT_FOUND, str, wxT("no selection, hence no string") );
|
||||
|
||||
str = GetString(sel);
|
||||
return str;
|
||||
}
|
||||
|
||||
bool wxChoiceBase::SetStringSelection(const wxString& sel)
|
||||
{
|
||||
int selIndex = FindString(sel);
|
||||
wxCHECK_MSG( selIndex != wxNOT_FOUND, FALSE,
|
||||
wxT("can't set selection to string not in the control") );
|
||||
|
||||
SetSelection(selIndex);
|
||||
Select(sel);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// client data
|
||||
// misc
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxChoiceBase::SetClientObject(int n, wxClientData *data)
|
||||
void wxChoiceBase::Command(wxCommandEvent& event)
|
||||
{
|
||||
wxASSERT_MSG( m_clientDataItemsType != ClientData_Void,
|
||||
wxT("can't have both object and void client data") );
|
||||
|
||||
wxClientData *clientDataOld = DoGetClientObject(n);
|
||||
if ( clientDataOld )
|
||||
delete clientDataOld;
|
||||
|
||||
DoSetClientObject(n, data);
|
||||
m_clientDataItemsType = ClientData_Object;
|
||||
SetSelection(event.m_commandInt);
|
||||
(void)ProcessEvent(event);
|
||||
}
|
||||
|
||||
wxClientData *wxChoiceBase::GetClientObject(int n) const
|
||||
{
|
||||
wxASSERT_MSG( m_clientDataItemsType == ClientData_Object,
|
||||
wxT("this window doesn't have object client data") );
|
||||
|
||||
return DoGetClientObject(n);
|
||||
}
|
||||
|
||||
void wxChoiceBase::SetClientData(int n, void *data)
|
||||
{
|
||||
wxASSERT_MSG( m_clientDataItemsType != ClientData_Object,
|
||||
wxT("can't have both object and void client data") );
|
||||
|
||||
DoSetClientData(n, data);
|
||||
m_clientDataItemsType = ClientData_Void;
|
||||
}
|
||||
|
||||
void *wxChoiceBase::GetClientData(int n) const
|
||||
{
|
||||
wxASSERT_MSG( m_clientDataItemsType == ClientData_Void,
|
||||
wxT("this window doesn't have void client data") );
|
||||
|
||||
return DoGetClientData(n);
|
||||
}
|
||||
|
||||
|
||||
|
94
src/common/ctrlsub.cpp
Normal file
94
src/common/ctrlsub.cpp
Normal file
@@ -0,0 +1,94 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: common/ctrlsub.cpp
|
||||
// Purpose: wxControlWithItems implementation
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 22.10.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "controlwithitems.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/ctrlsub.h"
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// selection
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxString wxControlWithItems::GetStringSelection() const
|
||||
{
|
||||
wxString s;
|
||||
int sel = GetSelection();
|
||||
if ( sel != -1 )
|
||||
s = GetString(sel);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// client data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxControlWithItems::SetClientObject(int n, wxClientData *data)
|
||||
{
|
||||
wxASSERT_MSG( m_clientDataItemsType != ClientData_Void,
|
||||
wxT("can't have both object and void client data") );
|
||||
|
||||
wxClientData *clientDataOld = DoGetItemClientObject(n);
|
||||
if ( clientDataOld )
|
||||
delete clientDataOld;
|
||||
|
||||
DoSetItemClientObject(n, data);
|
||||
m_clientDataItemsType = ClientData_Object;
|
||||
}
|
||||
|
||||
wxClientData *wxControlWithItems::GetClientObject(int n) const
|
||||
{
|
||||
wxASSERT_MSG( m_clientDataItemsType == ClientData_Object,
|
||||
wxT("this window doesn't have object client data") );
|
||||
|
||||
return DoGetItemClientObject(n);
|
||||
}
|
||||
|
||||
void wxControlWithItems::SetClientData(int n, void *data)
|
||||
{
|
||||
wxASSERT_MSG( m_clientDataItemsType != ClientData_Object,
|
||||
wxT("can't have both object and void client data") );
|
||||
|
||||
DoSetItemClientData(n, data);
|
||||
m_clientDataItemsType = ClientData_Void;
|
||||
}
|
||||
|
||||
void *wxControlWithItems::GetClientData(int n) const
|
||||
{
|
||||
wxASSERT_MSG( m_clientDataItemsType == ClientData_Void,
|
||||
wxT("this window doesn't have void client data") );
|
||||
|
||||
return DoGetItemClientData(n);
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@
|
||||
// Created: 22.10.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
@@ -67,73 +67,27 @@ void wxListBoxBase::Set(int nItems, const wxString* items, void **clientData)
|
||||
// selection
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxString wxListBoxBase::GetStringSelection () const
|
||||
{
|
||||
wxString s;
|
||||
int sel = GetSelection();
|
||||
if ( sel != -1 )
|
||||
s = GetString(sel);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
bool wxListBoxBase::SetStringSelection(const wxString& s, bool select)
|
||||
{
|
||||
int sel = FindString(s);
|
||||
wxCHECK_MSG( sel != -1, FALSE,
|
||||
wxT("invalid string in wxListBox::SetStringSelection") );
|
||||
wxT("invalid string in SetStringSelection") );
|
||||
|
||||
SetSelection(sel, select);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// client data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxListBoxBase::SetClientObject(int n, wxClientData *data)
|
||||
{
|
||||
wxASSERT_MSG( m_clientDataItemsType != ClientData_Void,
|
||||
wxT("can't have both object and void client data") );
|
||||
|
||||
wxClientData *clientDataOld = DoGetClientObject(n);
|
||||
if ( clientDataOld )
|
||||
delete clientDataOld;
|
||||
|
||||
DoSetClientObject(n, data);
|
||||
m_clientDataItemsType = ClientData_Object;
|
||||
}
|
||||
|
||||
wxClientData *wxListBoxBase::GetClientObject(int n) const
|
||||
{
|
||||
wxASSERT_MSG( m_clientDataItemsType == ClientData_Object,
|
||||
wxT("this window doesn't have object client data") );
|
||||
|
||||
return DoGetClientObject(n);
|
||||
}
|
||||
|
||||
void wxListBoxBase::SetClientData(int n, void *data)
|
||||
{
|
||||
wxASSERT_MSG( m_clientDataItemsType != ClientData_Object,
|
||||
wxT("can't have both object and void client data") );
|
||||
|
||||
DoSetClientData(n, data);
|
||||
m_clientDataItemsType = ClientData_Void;
|
||||
}
|
||||
|
||||
void *wxListBoxBase::GetClientData(int n) const
|
||||
{
|
||||
wxASSERT_MSG( m_clientDataItemsType == ClientData_Void,
|
||||
wxT("this window doesn't have void client data") );
|
||||
|
||||
return DoGetClientData(n);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// misc
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxListBoxBase::Command(wxCommandEvent& event)
|
||||
{
|
||||
SetSelection(event.m_commandInt, event.m_extraLong);
|
||||
(void)ProcessEvent(event);
|
||||
}
|
||||
|
||||
void wxListBoxBase::SetFirstItem(const wxString& s)
|
||||
{
|
||||
int n = FindString(s);
|
||||
@@ -142,10 +96,3 @@ void wxListBoxBase::SetFirstItem(const wxString& s)
|
||||
|
||||
DoSetFirstItem(n);
|
||||
}
|
||||
|
||||
void wxListBoxBase::Command(wxCommandEvent & event)
|
||||
{
|
||||
SetSelection(event.m_commandInt, event.m_extraLong);
|
||||
(void)ProcessEvent(event);
|
||||
}
|
||||
|
||||
|
@@ -46,9 +46,17 @@ static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
|
||||
event.SetInt( choice->GetSelection() );
|
||||
int n = choice->GetSelection();
|
||||
|
||||
event.SetInt( n );
|
||||
event.SetString( choice->GetStringSelection() );
|
||||
event.SetEventObject(choice);
|
||||
|
||||
if ( choice->HasClientObjectData() )
|
||||
event.SetClientObject( choice->GetClientObject(n) );
|
||||
else if ( choice->HasClientUntypedData() )
|
||||
event.SetClientData( choice->GetClientData(n) );
|
||||
|
||||
choice->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
@@ -134,32 +142,32 @@ int wxChoice::DoAppend( const wxString &item )
|
||||
return AppendHelper(menu, item);
|
||||
}
|
||||
|
||||
void wxChoice::DoSetClientData( int n, void* clientData )
|
||||
void wxChoice::DoSetItemClientData( int n, void* clientData )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
|
||||
|
||||
wxNode *node = m_clientList.Nth( n );
|
||||
wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetClientData") );
|
||||
wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientData") );
|
||||
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
void* wxChoice::DoGetClientData( int n ) const
|
||||
void* wxChoice::DoGetItemClientData( int n ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid choice control") );
|
||||
|
||||
wxNode *node = m_clientList.Nth( n );
|
||||
wxCHECK_MSG( node, NULL, wxT("invalid index in wxChoice::DoGetClientData") );
|
||||
wxCHECK_MSG( node, NULL, wxT("invalid index in wxChoice::DoGetItemClientData") );
|
||||
|
||||
return node->Data();
|
||||
}
|
||||
|
||||
void wxChoice::DoSetClientObject( int n, wxClientData* clientData )
|
||||
void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
|
||||
|
||||
wxNode *node = m_clientList.Nth( n );
|
||||
wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetClientObject") );
|
||||
wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientObject") );
|
||||
|
||||
wxClientData *cd = (wxClientData*) node->Data();
|
||||
delete cd;
|
||||
@@ -167,13 +175,13 @@ void wxChoice::DoSetClientObject( int n, wxClientData* clientData )
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
wxClientData* wxChoice::DoGetClientObject( int n ) const
|
||||
wxClientData* wxChoice::DoGetItemClientObject( int n ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid choice control") );
|
||||
|
||||
wxNode *node = m_clientList.Nth( n );
|
||||
wxCHECK_MSG( node, (wxClientData *)NULL,
|
||||
wxT("invalid index in wxChoice::DoGetClientObject") );
|
||||
wxT("invalid index in wxChoice::DoGetItemClientObject") );
|
||||
|
||||
return (wxClientData*) node->Data();
|
||||
}
|
||||
@@ -186,8 +194,18 @@ void wxChoice::Clear()
|
||||
GtkWidget *menu = gtk_menu_new();
|
||||
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
|
||||
|
||||
if ( m_clientDataItemsType == ClientData_Object )
|
||||
m_clientList.DeleteContents(TRUE);
|
||||
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!
|
||||
wxNode *node = m_clientList.First();
|
||||
while ( node )
|
||||
{
|
||||
delete (wxClientData *)node->Data();
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
m_clientList.Clear();
|
||||
|
||||
if ( m_strings )
|
||||
@@ -246,6 +264,13 @@ int wxChoice::GetSelection() const
|
||||
return -1;
|
||||
}
|
||||
|
||||
void wxChoice::SetString( int WXUNUSED(n), const wxString& WXUNUSED(string) )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, wxT("invalid choice") );
|
||||
|
||||
wxFAIL_MSG(wxT("not implemented"));
|
||||
}
|
||||
|
||||
wxString wxChoice::GetString( int n ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid choice") );
|
||||
@@ -372,8 +397,7 @@ size_t wxChoice::AppendHelper(GtkWidget *menu, const wxString& item)
|
||||
}
|
||||
else
|
||||
{
|
||||
// can't use Insert() :-(
|
||||
m_clientList.Append( (wxObject*) NULL );
|
||||
m_clientList.Insert( (wxObject*) NULL );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@@ -102,25 +102,28 @@ gtk_listbox_button_release_callback( GtkWidget * WXUNUSED(widget),
|
||||
|
||||
if (!g_hasDoubleClicked) return FALSE;
|
||||
|
||||
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
|
||||
event.SetEventObject( listbox );
|
||||
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
|
||||
event.SetEventObject( listbox );
|
||||
|
||||
wxArrayInt aSelections;
|
||||
int count = listbox->GetSelections(aSelections);
|
||||
if ( count > 0 )
|
||||
{
|
||||
event.m_commandInt = aSelections[0] ;
|
||||
event.m_clientData = listbox->GetClientData( event.m_commandInt );
|
||||
wxString str(listbox->GetString(event.m_commandInt));
|
||||
if (!str.IsEmpty()) event.m_commandString = str;
|
||||
}
|
||||
else
|
||||
{
|
||||
event.m_commandInt = -1 ;
|
||||
event.m_commandString.Empty();
|
||||
}
|
||||
wxArrayInt aSelections;
|
||||
int n, count = listbox->GetSelections(aSelections);
|
||||
if ( count > 0 )
|
||||
{
|
||||
n = aSelections[0];
|
||||
if ( listbox->HasClientObjectData() )
|
||||
event.SetClientObject( listbox->GetClientObject(n) );
|
||||
else if ( listbox->HasClientUntypedData() )
|
||||
event.SetClientData( listbox->GetClientData(n) );
|
||||
event.SetString( listbox->GetString(n) );
|
||||
}
|
||||
else
|
||||
{
|
||||
n = -1;
|
||||
}
|
||||
|
||||
listbox->GetEventHandler()->ProcessEvent( event );
|
||||
event.m_commandInt = n;
|
||||
|
||||
listbox->GetEventHandler()->ProcessEvent( event );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -213,14 +216,18 @@ static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
|
||||
event.SetEventObject( listbox );
|
||||
|
||||
wxArrayInt aSelections;
|
||||
int n, count = listbox->GetSelections(aSelections);
|
||||
if ( count > 0 )
|
||||
{
|
||||
n = aSelections[0];
|
||||
event.m_clientData = listbox->m_clientData.Item(n);
|
||||
event.m_commandString = listbox->GetString(n);
|
||||
if ( listbox->HasClientObjectData() )
|
||||
event.SetClientObject( listbox->GetClientObject(n) );
|
||||
else if ( listbox->HasClientUntypedData() )
|
||||
event.SetClientData( listbox->GetClientData(n) );
|
||||
event.SetString( listbox->GetString(n) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -229,8 +236,6 @@ static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox
|
||||
|
||||
event.m_commandInt = n;
|
||||
|
||||
event.SetEventObject( listbox );
|
||||
|
||||
listbox->GetEventHandler()->ProcessEvent( event );
|
||||
}
|
||||
|
||||
@@ -317,8 +322,6 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
m_clientData.Append((wxObject *)NULL);
|
||||
|
||||
DoAppend(choices[i]);
|
||||
|
||||
#if 0
|
||||
@@ -431,7 +434,6 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
||||
|
||||
// remove the old items
|
||||
wxArrayString deletedLabels;
|
||||
wxArrayPtrVoid deletedData;
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
wxArrayInt deletedChecks;
|
||||
#endif
|
||||
@@ -446,9 +448,6 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
||||
wxString str(GET_REAL_LABEL(label->label),*wxConvCurrent);
|
||||
deletedLabels.Add(str);
|
||||
|
||||
// save data
|
||||
deletedData.Add(m_clientData.Item(n));
|
||||
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
// save check state
|
||||
if ( m_hasCheckBoxes )
|
||||
@@ -458,33 +457,28 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
||||
#endif // wxUSE_CHECKLISTBOX
|
||||
}
|
||||
|
||||
// don't delete contents, the data will be reappended soon
|
||||
m_clientData.Clear();
|
||||
|
||||
size_t nDeletedCount = n;
|
||||
|
||||
gtk_list_clear_items( m_list, pos, length );
|
||||
|
||||
// now append the new items
|
||||
wxNode *node = m_clientData.Item(pos);
|
||||
for ( n = 0; n < nItems; n++ )
|
||||
{
|
||||
AppendWithoutSorting(items[n]);
|
||||
|
||||
m_clientData.Append((wxObject *)NULL);
|
||||
// make sure we have the correct number of items in this list
|
||||
m_clientData.Insert(node, (wxObject *)NULL);
|
||||
}
|
||||
|
||||
// and append the old items too
|
||||
pos += nItems; // now the indices are shifter
|
||||
pos += nItems; // now the indices are shifted
|
||||
for ( n = 0; n < nDeletedCount; n++ )
|
||||
{
|
||||
AppendWithoutSorting(deletedLabels[n]);
|
||||
|
||||
m_clientData.Append((wxObject *)NULL);
|
||||
|
||||
if ( m_clientDataItemsType == ClientData_Object )
|
||||
SetClientObject(n, (wxClientData *)deletedData[n]);
|
||||
else if ( m_clientDataItemsType == ClientData_Void )
|
||||
SetClientData(n, deletedData[n]);
|
||||
// the data is already correct - the indices have been rearranged in
|
||||
// such manner that we now correspond to the same node as before
|
||||
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
if ( m_hasCheckBoxes )
|
||||
@@ -617,32 +611,32 @@ void wxListBox::DoSetItems( const wxArrayString& items,
|
||||
// client data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxListBox::DoSetClientData( int n, void* clientData )
|
||||
void wxListBox::DoSetItemClientData( int n, void* clientData )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
|
||||
|
||||
wxNode *node = m_clientData.Nth( n );
|
||||
wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetClientData") );
|
||||
wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetItemClientData") );
|
||||
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
void* wxListBox::DoGetClientData( int n ) const
|
||||
void* wxListBox::DoGetItemClientData( int n ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid listbox control") );
|
||||
|
||||
wxNode *node = m_clientData.Nth( n );
|
||||
wxCHECK_MSG( node, NULL, wxT("invalid index in wxListBox::DoGetClientData") );
|
||||
wxCHECK_MSG( node, NULL, wxT("invalid index in wxListBox::DoGetItemClientData") );
|
||||
|
||||
return node->Data();
|
||||
}
|
||||
|
||||
void wxListBox::DoSetClientObject( int n, wxClientData* clientData )
|
||||
void wxListBox::DoSetItemClientObject( int n, wxClientData* clientData )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
|
||||
|
||||
wxNode *node = m_clientData.Nth( n );
|
||||
wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetClientObject") );
|
||||
wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetItemClientObject") );
|
||||
|
||||
wxClientData *cd = (wxClientData*) node->Data();
|
||||
delete cd;
|
||||
@@ -650,13 +644,13 @@ void wxListBox::DoSetClientObject( int n, wxClientData* clientData )
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
wxClientData* wxListBox::DoGetClientObject( int n ) const
|
||||
wxClientData* wxListBox::DoGetItemClientObject( int n ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid listbox control") );
|
||||
|
||||
wxNode *node = m_clientData.Nth( n );
|
||||
wxCHECK_MSG( node, (wxClientData *)NULL,
|
||||
wxT("invalid index in wxListBox::DoGetClientObject") );
|
||||
wxT("invalid index in wxListBox::DoGetItemClientObject") );
|
||||
|
||||
return (wxClientData*) node->Data();
|
||||
}
|
||||
@@ -667,8 +661,18 @@ void wxListBox::Clear()
|
||||
|
||||
gtk_list_clear_items( m_list, 0, Number() );
|
||||
|
||||
if ( m_clientDataItemsType == ClientData_Object )
|
||||
m_clientData.DeleteContents(TRUE);
|
||||
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!
|
||||
wxNode *node = m_clientData.First();
|
||||
while ( node )
|
||||
{
|
||||
delete (wxClientData *)node->Data();
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
m_clientData.Clear();
|
||||
|
||||
if ( m_strings )
|
||||
|
@@ -46,9 +46,17 @@ static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
|
||||
event.SetInt( choice->GetSelection() );
|
||||
int n = choice->GetSelection();
|
||||
|
||||
event.SetInt( n );
|
||||
event.SetString( choice->GetStringSelection() );
|
||||
event.SetEventObject(choice);
|
||||
|
||||
if ( choice->HasClientObjectData() )
|
||||
event.SetClientObject( choice->GetClientObject(n) );
|
||||
else if ( choice->HasClientUntypedData() )
|
||||
event.SetClientData( choice->GetClientData(n) );
|
||||
|
||||
choice->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
@@ -134,32 +142,32 @@ int wxChoice::DoAppend( const wxString &item )
|
||||
return AppendHelper(menu, item);
|
||||
}
|
||||
|
||||
void wxChoice::DoSetClientData( int n, void* clientData )
|
||||
void wxChoice::DoSetItemClientData( int n, void* clientData )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
|
||||
|
||||
wxNode *node = m_clientList.Nth( n );
|
||||
wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetClientData") );
|
||||
wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientData") );
|
||||
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
void* wxChoice::DoGetClientData( int n ) const
|
||||
void* wxChoice::DoGetItemClientData( int n ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid choice control") );
|
||||
|
||||
wxNode *node = m_clientList.Nth( n );
|
||||
wxCHECK_MSG( node, NULL, wxT("invalid index in wxChoice::DoGetClientData") );
|
||||
wxCHECK_MSG( node, NULL, wxT("invalid index in wxChoice::DoGetItemClientData") );
|
||||
|
||||
return node->Data();
|
||||
}
|
||||
|
||||
void wxChoice::DoSetClientObject( int n, wxClientData* clientData )
|
||||
void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
|
||||
|
||||
wxNode *node = m_clientList.Nth( n );
|
||||
wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetClientObject") );
|
||||
wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientObject") );
|
||||
|
||||
wxClientData *cd = (wxClientData*) node->Data();
|
||||
delete cd;
|
||||
@@ -167,13 +175,13 @@ void wxChoice::DoSetClientObject( int n, wxClientData* clientData )
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
wxClientData* wxChoice::DoGetClientObject( int n ) const
|
||||
wxClientData* wxChoice::DoGetItemClientObject( int n ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid choice control") );
|
||||
|
||||
wxNode *node = m_clientList.Nth( n );
|
||||
wxCHECK_MSG( node, (wxClientData *)NULL,
|
||||
wxT("invalid index in wxChoice::DoGetClientObject") );
|
||||
wxT("invalid index in wxChoice::DoGetItemClientObject") );
|
||||
|
||||
return (wxClientData*) node->Data();
|
||||
}
|
||||
@@ -186,8 +194,18 @@ void wxChoice::Clear()
|
||||
GtkWidget *menu = gtk_menu_new();
|
||||
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
|
||||
|
||||
if ( m_clientDataItemsType == ClientData_Object )
|
||||
m_clientList.DeleteContents(TRUE);
|
||||
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!
|
||||
wxNode *node = m_clientList.First();
|
||||
while ( node )
|
||||
{
|
||||
delete (wxClientData *)node->Data();
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
m_clientList.Clear();
|
||||
|
||||
if ( m_strings )
|
||||
@@ -246,6 +264,13 @@ int wxChoice::GetSelection() const
|
||||
return -1;
|
||||
}
|
||||
|
||||
void wxChoice::SetString( int WXUNUSED(n), const wxString& WXUNUSED(string) )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, wxT("invalid choice") );
|
||||
|
||||
wxFAIL_MSG(wxT("not implemented"));
|
||||
}
|
||||
|
||||
wxString wxChoice::GetString( int n ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid choice") );
|
||||
@@ -372,8 +397,7 @@ size_t wxChoice::AppendHelper(GtkWidget *menu, const wxString& item)
|
||||
}
|
||||
else
|
||||
{
|
||||
// can't use Insert() :-(
|
||||
m_clientList.Append( (wxObject*) NULL );
|
||||
m_clientList.Insert( (wxObject*) NULL );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@@ -102,25 +102,28 @@ gtk_listbox_button_release_callback( GtkWidget * WXUNUSED(widget),
|
||||
|
||||
if (!g_hasDoubleClicked) return FALSE;
|
||||
|
||||
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
|
||||
event.SetEventObject( listbox );
|
||||
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
|
||||
event.SetEventObject( listbox );
|
||||
|
||||
wxArrayInt aSelections;
|
||||
int count = listbox->GetSelections(aSelections);
|
||||
if ( count > 0 )
|
||||
{
|
||||
event.m_commandInt = aSelections[0] ;
|
||||
event.m_clientData = listbox->GetClientData( event.m_commandInt );
|
||||
wxString str(listbox->GetString(event.m_commandInt));
|
||||
if (!str.IsEmpty()) event.m_commandString = str;
|
||||
}
|
||||
else
|
||||
{
|
||||
event.m_commandInt = -1 ;
|
||||
event.m_commandString.Empty();
|
||||
}
|
||||
wxArrayInt aSelections;
|
||||
int n, count = listbox->GetSelections(aSelections);
|
||||
if ( count > 0 )
|
||||
{
|
||||
n = aSelections[0];
|
||||
if ( listbox->HasClientObjectData() )
|
||||
event.SetClientObject( listbox->GetClientObject(n) );
|
||||
else if ( listbox->HasClientUntypedData() )
|
||||
event.SetClientData( listbox->GetClientData(n) );
|
||||
event.SetString( listbox->GetString(n) );
|
||||
}
|
||||
else
|
||||
{
|
||||
n = -1;
|
||||
}
|
||||
|
||||
listbox->GetEventHandler()->ProcessEvent( event );
|
||||
event.m_commandInt = n;
|
||||
|
||||
listbox->GetEventHandler()->ProcessEvent( event );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -213,14 +216,18 @@ static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
|
||||
event.SetEventObject( listbox );
|
||||
|
||||
wxArrayInt aSelections;
|
||||
int n, count = listbox->GetSelections(aSelections);
|
||||
if ( count > 0 )
|
||||
{
|
||||
n = aSelections[0];
|
||||
event.m_clientData = listbox->m_clientData.Item(n);
|
||||
event.m_commandString = listbox->GetString(n);
|
||||
if ( listbox->HasClientObjectData() )
|
||||
event.SetClientObject( listbox->GetClientObject(n) );
|
||||
else if ( listbox->HasClientUntypedData() )
|
||||
event.SetClientData( listbox->GetClientData(n) );
|
||||
event.SetString( listbox->GetString(n) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -229,8 +236,6 @@ static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox
|
||||
|
||||
event.m_commandInt = n;
|
||||
|
||||
event.SetEventObject( listbox );
|
||||
|
||||
listbox->GetEventHandler()->ProcessEvent( event );
|
||||
}
|
||||
|
||||
@@ -317,8 +322,6 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
m_clientData.Append((wxObject *)NULL);
|
||||
|
||||
DoAppend(choices[i]);
|
||||
|
||||
#if 0
|
||||
@@ -431,7 +434,6 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
||||
|
||||
// remove the old items
|
||||
wxArrayString deletedLabels;
|
||||
wxArrayPtrVoid deletedData;
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
wxArrayInt deletedChecks;
|
||||
#endif
|
||||
@@ -446,9 +448,6 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
||||
wxString str(GET_REAL_LABEL(label->label),*wxConvCurrent);
|
||||
deletedLabels.Add(str);
|
||||
|
||||
// save data
|
||||
deletedData.Add(m_clientData.Item(n));
|
||||
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
// save check state
|
||||
if ( m_hasCheckBoxes )
|
||||
@@ -458,33 +457,28 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
||||
#endif // wxUSE_CHECKLISTBOX
|
||||
}
|
||||
|
||||
// don't delete contents, the data will be reappended soon
|
||||
m_clientData.Clear();
|
||||
|
||||
size_t nDeletedCount = n;
|
||||
|
||||
gtk_list_clear_items( m_list, pos, length );
|
||||
|
||||
// now append the new items
|
||||
wxNode *node = m_clientData.Item(pos);
|
||||
for ( n = 0; n < nItems; n++ )
|
||||
{
|
||||
AppendWithoutSorting(items[n]);
|
||||
|
||||
m_clientData.Append((wxObject *)NULL);
|
||||
// make sure we have the correct number of items in this list
|
||||
m_clientData.Insert(node, (wxObject *)NULL);
|
||||
}
|
||||
|
||||
// and append the old items too
|
||||
pos += nItems; // now the indices are shifter
|
||||
pos += nItems; // now the indices are shifted
|
||||
for ( n = 0; n < nDeletedCount; n++ )
|
||||
{
|
||||
AppendWithoutSorting(deletedLabels[n]);
|
||||
|
||||
m_clientData.Append((wxObject *)NULL);
|
||||
|
||||
if ( m_clientDataItemsType == ClientData_Object )
|
||||
SetClientObject(n, (wxClientData *)deletedData[n]);
|
||||
else if ( m_clientDataItemsType == ClientData_Void )
|
||||
SetClientData(n, deletedData[n]);
|
||||
// the data is already correct - the indices have been rearranged in
|
||||
// such manner that we now correspond to the same node as before
|
||||
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
if ( m_hasCheckBoxes )
|
||||
@@ -617,32 +611,32 @@ void wxListBox::DoSetItems( const wxArrayString& items,
|
||||
// client data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxListBox::DoSetClientData( int n, void* clientData )
|
||||
void wxListBox::DoSetItemClientData( int n, void* clientData )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
|
||||
|
||||
wxNode *node = m_clientData.Nth( n );
|
||||
wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetClientData") );
|
||||
wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetItemClientData") );
|
||||
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
void* wxListBox::DoGetClientData( int n ) const
|
||||
void* wxListBox::DoGetItemClientData( int n ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid listbox control") );
|
||||
|
||||
wxNode *node = m_clientData.Nth( n );
|
||||
wxCHECK_MSG( node, NULL, wxT("invalid index in wxListBox::DoGetClientData") );
|
||||
wxCHECK_MSG( node, NULL, wxT("invalid index in wxListBox::DoGetItemClientData") );
|
||||
|
||||
return node->Data();
|
||||
}
|
||||
|
||||
void wxListBox::DoSetClientObject( int n, wxClientData* clientData )
|
||||
void wxListBox::DoSetItemClientObject( int n, wxClientData* clientData )
|
||||
{
|
||||
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
|
||||
|
||||
wxNode *node = m_clientData.Nth( n );
|
||||
wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetClientObject") );
|
||||
wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetItemClientObject") );
|
||||
|
||||
wxClientData *cd = (wxClientData*) node->Data();
|
||||
delete cd;
|
||||
@@ -650,13 +644,13 @@ void wxListBox::DoSetClientObject( int n, wxClientData* clientData )
|
||||
node->SetData( (wxObject*) clientData );
|
||||
}
|
||||
|
||||
wxClientData* wxListBox::DoGetClientObject( int n ) const
|
||||
wxClientData* wxListBox::DoGetItemClientObject( int n ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid listbox control") );
|
||||
|
||||
wxNode *node = m_clientData.Nth( n );
|
||||
wxCHECK_MSG( node, (wxClientData *)NULL,
|
||||
wxT("invalid index in wxListBox::DoGetClientObject") );
|
||||
wxT("invalid index in wxListBox::DoGetItemClientObject") );
|
||||
|
||||
return (wxClientData*) node->Data();
|
||||
}
|
||||
@@ -667,8 +661,18 @@ void wxListBox::Clear()
|
||||
|
||||
gtk_list_clear_items( m_list, 0, Number() );
|
||||
|
||||
if ( m_clientDataItemsType == ClientData_Object )
|
||||
m_clientData.DeleteContents(TRUE);
|
||||
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!
|
||||
wxNode *node = m_clientData.First();
|
||||
while ( node )
|
||||
{
|
||||
delete (wxClientData *)node->Data();
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
m_clientData.Clear();
|
||||
|
||||
if ( m_strings )
|
||||
|
@@ -104,11 +104,25 @@ void wxChoice::Delete(int n)
|
||||
{
|
||||
wxCHECK_RET( n < GetCount(), wxT("invalid item index in wxChoice::Delete") );
|
||||
|
||||
if ( HasClientObjectData() )
|
||||
{
|
||||
delete GetClientObject(n);
|
||||
}
|
||||
|
||||
SendMessage(GetHwnd(), CB_DELETESTRING, n, 0);
|
||||
}
|
||||
|
||||
void wxChoice::Clear()
|
||||
{
|
||||
if ( HasClientObjectData() )
|
||||
{
|
||||
size_t count = GetCount();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
delete GetClientObject(n);
|
||||
}
|
||||
}
|
||||
|
||||
SendMessage(GetHwnd(), CB_RESETCONTENT, 0, 0);
|
||||
}
|
||||
|
||||
@@ -157,10 +171,20 @@ int wxChoice::FindString(const wxString& s) const
|
||||
#endif // Watcom/!Watcom
|
||||
}
|
||||
|
||||
void wxChoice::SetString(int n, const wxString& s)
|
||||
{
|
||||
wxFAIL_MSG(wxT("not implemented"));
|
||||
|
||||
#if 0 // should do this, but no Insert() so far
|
||||
Delete(n);
|
||||
Insert(n + 1, s);
|
||||
#endif
|
||||
}
|
||||
|
||||
wxString wxChoice::GetString(int n) const
|
||||
{
|
||||
size_t len = (size_t)::SendMessage(GetHwnd(), CB_GETLBTEXTLEN, n, 0);
|
||||
wxString str = "";
|
||||
wxString str;
|
||||
if (len) {
|
||||
if ( ::SendMessage(GetHwnd(), CB_GETLBTEXT, n,
|
||||
(LPARAM)str.GetWriteBuf(len)) == CB_ERR ) {
|
||||
@@ -176,7 +200,7 @@ wxString wxChoice::GetString(int n) const
|
||||
// client data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxChoice::DoSetClientData( int n, void* clientData )
|
||||
void wxChoice::DoSetItemClientData( int n, void* clientData )
|
||||
{
|
||||
if ( SendMessage(GetHwnd(), CB_SETITEMDATA, n, (LPARAM)clientData) == CB_ERR )
|
||||
{
|
||||
@@ -184,7 +208,7 @@ void wxChoice::DoSetClientData( int n, void* clientData )
|
||||
}
|
||||
}
|
||||
|
||||
void* wxChoice::DoGetClientData( int n ) const
|
||||
void* wxChoice::DoGetItemClientData( int n ) const
|
||||
{
|
||||
LPARAM rc = SendMessage(GetHwnd(), CB_GETITEMDATA, n, 0);
|
||||
if ( rc == CB_ERR )
|
||||
@@ -198,14 +222,14 @@ void* wxChoice::DoGetClientData( int n ) const
|
||||
return (void *)rc;
|
||||
}
|
||||
|
||||
void wxChoice::DoSetClientObject( int n, wxClientData* clientData )
|
||||
void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
|
||||
{
|
||||
DoSetClientData(n, clientData);
|
||||
DoSetItemClientData(n, clientData);
|
||||
}
|
||||
|
||||
wxClientData* wxChoice::DoGetClientObject( int n ) const
|
||||
wxClientData* wxChoice::DoGetItemClientObject( int n ) const
|
||||
{
|
||||
return (wxClientData *)DoGetClientData(n);
|
||||
return (wxClientData *)DoGetItemClientData(n);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -261,6 +261,16 @@ void wxListBox::Delete(int N)
|
||||
wxCHECK_RET( N >= 0 && N < m_noItems,
|
||||
wxT("invalid index in wxListBox::Delete") );
|
||||
|
||||
#if wxUSE_OWNER_DRAWN
|
||||
delete m_aItems[N];
|
||||
m_aItems.Remove(N);
|
||||
#else // !wxUSE_OWNER_DRAWN
|
||||
if ( HasClientObjectData() )
|
||||
{
|
||||
delete GetClientObject(N);
|
||||
}
|
||||
#endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
|
||||
|
||||
SendMessage(GetHwnd(), LB_DELETESTRING, N, 0);
|
||||
m_noItems--;
|
||||
|
||||
@@ -343,8 +353,6 @@ int wxListBox::FindString(const wxString& s) const
|
||||
|
||||
void wxListBox::Clear()
|
||||
{
|
||||
ListBox_ResetContent(GetHwnd());
|
||||
|
||||
#if wxUSE_OWNER_DRAWN
|
||||
size_t uiCount = m_aItems.Count();
|
||||
while ( uiCount-- != 0 ) {
|
||||
@@ -352,7 +360,17 @@ void wxListBox::Clear()
|
||||
}
|
||||
|
||||
m_aItems.Clear();
|
||||
#endif // wxUSE_OWNER_DRAWN
|
||||
#else // !wxUSE_OWNER_DRAWN
|
||||
if ( HasClientObjectData() )
|
||||
{
|
||||
for ( size_t n = 0; n < (size_t)m_noItems; n++ )
|
||||
{
|
||||
delete GetClientObject(n);
|
||||
}
|
||||
}
|
||||
#endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
|
||||
|
||||
ListBox_ResetContent(GetHwnd());
|
||||
|
||||
m_noItems = 0;
|
||||
SetHorizontalExtent();
|
||||
@@ -381,12 +399,12 @@ bool wxListBox::IsSelected(int N) const
|
||||
return SendMessage(GetHwnd(), LB_GETSEL, N, 0) == 0 ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
wxClientData* wxListBox::DoGetClientObject(int n) const
|
||||
wxClientData* wxListBox::DoGetItemClientObject(int n) const
|
||||
{
|
||||
return (wxClientData *)DoGetClientData(n);
|
||||
return (wxClientData *)DoGetItemClientData(n);
|
||||
}
|
||||
|
||||
void *wxListBox::DoGetClientData(int n) const
|
||||
void *wxListBox::DoGetItemClientData(int n) const
|
||||
{
|
||||
wxCHECK_MSG( n >= 0 && n < m_noItems, NULL,
|
||||
wxT("invalid index in wxListBox::GetClientData") );
|
||||
@@ -394,12 +412,12 @@ void *wxListBox::DoGetClientData(int n) const
|
||||
return (void *)SendMessage(GetHwnd(), LB_GETITEMDATA, n, 0);
|
||||
}
|
||||
|
||||
void wxListBox::DoSetClientObject(int n, wxClientData* clientData)
|
||||
void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData)
|
||||
{
|
||||
DoSetClientData(n, clientData);
|
||||
DoSetItemClientData(n, clientData);
|
||||
}
|
||||
|
||||
void wxListBox::DoSetClientData(int n, void *clientData)
|
||||
void wxListBox::DoSetItemClientData(int n, void *clientData)
|
||||
{
|
||||
wxCHECK_RET( n >= 0 && n < m_noItems,
|
||||
wxT("invalid index in wxListBox::SetClientData") );
|
||||
|
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
# This file was automatically generated by tmake at 16:37, 1999/10/22
|
||||
# This file was automatically generated by tmake at 18:37, 1999/10/22
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE B32.T!
|
||||
|
||||
#
|
||||
@@ -115,6 +115,7 @@ COMMONOBJS = \
|
||||
$(MSWDIR)\cmndata.obj \
|
||||
$(MSWDIR)\config.obj \
|
||||
$(MSWDIR)\ctrlcmn.obj \
|
||||
$(MSWDIR)\ctrlsub.obj \
|
||||
$(MSWDIR)\date.obj \
|
||||
$(MSWDIR)\datstrm.obj \
|
||||
$(MSWDIR)\db.obj \
|
||||
@@ -541,6 +542,8 @@ $(MSWDIR)\config.obj: $(COMMDIR)\config.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\ctrlcmn.obj: $(COMMDIR)\ctrlcmn.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\ctrlsub.obj: $(COMMDIR)\ctrlsub.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\date.obj: $(COMMDIR)\date.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\datstrm.obj: $(COMMDIR)\datstrm.$(SRCSUFF)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
# This file was automatically generated by tmake at 16:37, 1999/10/22
|
||||
# This file was automatically generated by tmake at 18:37, 1999/10/22
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BCC.T!
|
||||
|
||||
#
|
||||
@@ -106,6 +106,7 @@ COMMONOBJS = \
|
||||
$(MSWDIR)\cmndata.obj \
|
||||
$(MSWDIR)\config.obj \
|
||||
$(MSWDIR)\ctrlcmn.obj \
|
||||
$(MSWDIR)\ctrlsub.obj \
|
||||
$(MSWDIR)\date.obj \
|
||||
$(MSWDIR)\datstrm.obj \
|
||||
$(MSWDIR)\db.obj \
|
||||
@@ -449,6 +450,8 @@ $(MSWDIR)\config.obj: $(COMMDIR)\config.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\ctrlcmn.obj: $(COMMDIR)\ctrlcmn.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\ctrlsub.obj: $(COMMDIR)\ctrlsub.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\date.obj: $(COMMDIR)\date.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\datstrm.obj: $(COMMDIR)\datstrm.$(SRCSUFF)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
# This file was automatically generated by tmake at 16:37, 1999/10/22
|
||||
# This file was automatically generated by tmake at 18:37, 1999/10/22
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE DOS.T!
|
||||
|
||||
#
|
||||
@@ -93,6 +93,7 @@ COMMONOBJS = \
|
||||
$(COMMDIR)\cmndata.obj \
|
||||
$(COMMDIR)\config.obj \
|
||||
$(COMMDIR)\ctrlcmn.obj \
|
||||
$(COMMDIR)\ctrlsub.obj \
|
||||
$(COMMDIR)\date.obj \
|
||||
$(COMMDIR)\datstrm.obj \
|
||||
$(COMMDIR)\db.obj \
|
||||
@@ -711,6 +712,11 @@ $(COMMDIR)/ctrlcmn.obj: $*.$(SRCSUFF)
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(COMMDIR)/ctrlsub.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(COMMDIR)/date.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# This file was automatically generated by tmake at 16:37, 1999/10/22
|
||||
# This file was automatically generated by tmake at 18:37, 1999/10/22
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE G95.T!
|
||||
|
||||
#
|
||||
@@ -65,6 +65,7 @@ COMMONOBJS = \
|
||||
$(COMMDIR)/cmndata.$(OBJSUFF) \
|
||||
$(COMMDIR)/config.$(OBJSUFF) \
|
||||
$(COMMDIR)/ctrlcmn.$(OBJSUFF) \
|
||||
$(COMMDIR)/ctrlsub.$(OBJSUFF) \
|
||||
$(COMMDIR)/date.$(OBJSUFF) \
|
||||
$(COMMDIR)/datstrm.$(OBJSUFF) \
|
||||
$(COMMDIR)/db.$(OBJSUFF) \
|
||||
@@ -258,6 +259,15 @@ MSWOBJS = \
|
||||
$(MSWDIR)/window.$(OBJSUFF) \
|
||||
$(MSWDIR)/xpmhand.$(OBJSUFF)
|
||||
|
||||
ADVANCEDOBJS = \
|
||||
$(COMMDIR)/odbc.$(OBJSUFF) \
|
||||
$(MSWDIR)/ole/automtn.$(OBJSUFF) \
|
||||
$(MSWDIR)/ole/dataobj.$(OBJSUFF) \
|
||||
$(MSWDIR)/ole/dropsrc.$(OBJSUFF) \
|
||||
$(MSWDIR)/ole/droptgt.$(OBJSUFF) \
|
||||
$(MSWDIR)/ole/oleutils.$(OBJSUFF) \
|
||||
$(MSWDIR)/ole/uuid.$(OBJSUFF)
|
||||
|
||||
ZLIBOBJS = \
|
||||
$(ZLIBDIR)/adler32.$(OBJSUFF) \
|
||||
$(ZLIBDIR)/compress.$(OBJSUFF) \
|
||||
@@ -353,7 +363,20 @@ XPMOBJECTS = $(XPMDIR)/crbuffri.o\
|
||||
$(XPMDIR)/wrffrp.o $(XPMDIR)/wrffri.o
|
||||
|
||||
OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) \
|
||||
$(JPEGOBJS) $(PNGOBJS) $(ZLIBOBJS) # $(ADVANCEDOBJS) # $(XPMOBJECTS)
|
||||
|
||||
ifeq ($(MINGW32),1)
|
||||
ifeq ($(MINGW32VERSION),2.95)
|
||||
OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) \
|
||||
$(JPEGOBJS) $(PNGOBJS) $(ZLIBOBJS) $(ADVANCEDOBJS) # $(XPMOBJECTS)
|
||||
else
|
||||
OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) \
|
||||
$(JPEGOBJS) $(PNGOBJS) $(ZLIBOBJS) # $(XPMOBJECTS)
|
||||
endif
|
||||
else
|
||||
OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) \
|
||||
$(JPEGOBJS) $(PNGOBJS) $(ZLIBOBJS) # $(XPMOBJECTS)
|
||||
endif
|
||||
|
||||
all: $(OBJECTS) $(WXLIB)
|
||||
|
||||
@@ -403,21 +426,21 @@ $(COMMDIR)/lex_yy.c: $(COMMDIR)/doslex.c
|
||||
# mv y.tab.c $(COMMDIR)/y_tab.c
|
||||
|
||||
clean:
|
||||
-erase *.o
|
||||
-erase *.bak
|
||||
-erase core
|
||||
-erase ..\common\y_tab.c
|
||||
-erase ..\common\lex_yy.c
|
||||
-erase ..\common\*.o
|
||||
-erase ..\common\*.bak
|
||||
-erase ..\generic\*.o
|
||||
-erase ..\generic\*.bak
|
||||
-erase ..\html\*.o
|
||||
-erase ..\png\*.o
|
||||
-erase ..\png\*.bak
|
||||
-erase ..\zlib\*.o
|
||||
-erase ..\zlib\*.bak
|
||||
-erase ..\jpeg\*.o
|
||||
-erase ..\..\lib\libwx.a
|
||||
rm -f *.o
|
||||
rm -f *.bak
|
||||
rm -f core
|
||||
rm -f ..\common\y_tab.c
|
||||
rm -f ..\common\lex_yy.c
|
||||
rm -f ..\common\*.o
|
||||
rm -f ..\common\*.bak
|
||||
rm -f ..\generic\*.o
|
||||
rm -f ..\generic\*.bak
|
||||
rm -f ..\html\*.o
|
||||
rm -f ..\png\*.o
|
||||
rm -f ..\png\*.bak
|
||||
rm -f ..\zlib\*.o
|
||||
rm -f ..\zlib\*.bak
|
||||
rm -f ..\jpeg\*.o
|
||||
rm -f ..\..\lib\libwx.a
|
||||
|
||||
cleanall: clean
|
||||
|
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
# This file was automatically generated by tmake at 16:37, 1999/10/22
|
||||
# This file was automatically generated by tmake at 18:37, 1999/10/22
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE SC.T!
|
||||
|
||||
# Symantec C++ makefile for the msw objects
|
||||
@@ -54,6 +54,7 @@ COMMONOBJS = \
|
||||
$(COMMDIR)\cmndata.obj \
|
||||
$(COMMDIR)\config.obj \
|
||||
$(COMMDIR)\ctrlcmn.obj \
|
||||
$(COMMDIR)\ctrlsub.obj \
|
||||
$(COMMDIR)\date.obj \
|
||||
$(COMMDIR)\datstrm.obj \
|
||||
$(COMMDIR)\db.obj \
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# This file was automatically generated by tmake at 16:37, 1999/10/22
|
||||
# This file was automatically generated by tmake at 18:37, 1999/10/22
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE VC.T!
|
||||
|
||||
# File: makefile.vc
|
||||
@@ -132,6 +132,7 @@ COMMONOBJS = \
|
||||
..\common\$D\cmndata.obj \
|
||||
..\common\$D\config.obj \
|
||||
..\common\$D\ctrlcmn.obj \
|
||||
..\common\$D\ctrlsub.obj \
|
||||
..\common\$D\date.obj \
|
||||
..\common\$D\datstrm.obj \
|
||||
..\common\$D\db.obj \
|
||||
|
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
# This file was automatically generated by tmake at 16:37, 1999/10/22
|
||||
# This file was automatically generated by tmake at 18:37, 1999/10/22
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE WAT.T!
|
||||
|
||||
#!/binb/wmake.exe
|
||||
@@ -81,6 +81,7 @@ COMMONOBJS = &
|
||||
cmndata.obj &
|
||||
config.obj &
|
||||
ctrlcmn.obj &
|
||||
ctrlsub.obj &
|
||||
date.obj &
|
||||
datstrm.obj &
|
||||
db.obj &
|
||||
@@ -579,6 +580,9 @@ config.obj: $(COMMDIR)\config.cpp
|
||||
ctrlcmn.obj: $(COMMDIR)\ctrlcmn.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
ctrlsub.obj: $(COMMDIR)\ctrlsub.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
date.obj: $(COMMDIR)\date.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
|
Reference in New Issue
Block a user