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:
14
Makefile.in
14
Makefile.in
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# This file was automatically generated by tmake at 15:16, 1999/10/21
|
# This file was automatically generated by tmake at 18:37, 1999/10/22
|
||||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE UNX.T!
|
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE UNX.T!
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -691,6 +691,7 @@ GTK_COMMONOBJS = \
|
|||||||
cmndata.o \
|
cmndata.o \
|
||||||
config.o \
|
config.o \
|
||||||
ctrlcmn.o \
|
ctrlcmn.o \
|
||||||
|
ctrlsub.o \
|
||||||
date.o \
|
date.o \
|
||||||
datstrm.o \
|
datstrm.o \
|
||||||
db.o \
|
db.o \
|
||||||
@@ -730,6 +731,7 @@ GTK_COMMONOBJS = \
|
|||||||
intl.o \
|
intl.o \
|
||||||
ipcbase.o \
|
ipcbase.o \
|
||||||
layout.o \
|
layout.o \
|
||||||
|
lboxcmn.o \
|
||||||
list.o \
|
list.o \
|
||||||
log.o \
|
log.o \
|
||||||
memory.o \
|
memory.o \
|
||||||
@@ -783,6 +785,7 @@ GTK_COMMONDEPS = \
|
|||||||
cmndata.d \
|
cmndata.d \
|
||||||
config.d \
|
config.d \
|
||||||
ctrlcmn.d \
|
ctrlcmn.d \
|
||||||
|
ctrlsub.d \
|
||||||
date.d \
|
date.d \
|
||||||
datstrm.d \
|
datstrm.d \
|
||||||
db.d \
|
db.d \
|
||||||
@@ -822,6 +825,7 @@ GTK_COMMONDEPS = \
|
|||||||
intl.d \
|
intl.d \
|
||||||
ipcbase.d \
|
ipcbase.d \
|
||||||
layout.d \
|
layout.d \
|
||||||
|
lboxcmn.d \
|
||||||
list.d \
|
list.d \
|
||||||
log.d \
|
log.d \
|
||||||
memory.d \
|
memory.d \
|
||||||
@@ -1071,6 +1075,7 @@ MOTIF_COMMONOBJS = \
|
|||||||
cmndata.o \
|
cmndata.o \
|
||||||
config.o \
|
config.o \
|
||||||
ctrlcmn.o \
|
ctrlcmn.o \
|
||||||
|
ctrlsub.o \
|
||||||
date.o \
|
date.o \
|
||||||
datstrm.o \
|
datstrm.o \
|
||||||
db.o \
|
db.o \
|
||||||
@@ -1110,6 +1115,7 @@ MOTIF_COMMONOBJS = \
|
|||||||
intl.o \
|
intl.o \
|
||||||
ipcbase.o \
|
ipcbase.o \
|
||||||
layout.o \
|
layout.o \
|
||||||
|
lboxcmn.o \
|
||||||
list.o \
|
list.o \
|
||||||
log.o \
|
log.o \
|
||||||
memory.o \
|
memory.o \
|
||||||
@@ -1164,6 +1170,7 @@ MOTIF_COMMONDEPS = \
|
|||||||
cmndata.d \
|
cmndata.d \
|
||||||
config.d \
|
config.d \
|
||||||
ctrlcmn.d \
|
ctrlcmn.d \
|
||||||
|
ctrlsub.d \
|
||||||
date.d \
|
date.d \
|
||||||
datstrm.d \
|
datstrm.d \
|
||||||
db.d \
|
db.d \
|
||||||
@@ -1203,6 +1210,7 @@ MOTIF_COMMONDEPS = \
|
|||||||
intl.d \
|
intl.d \
|
||||||
ipcbase.d \
|
ipcbase.d \
|
||||||
layout.d \
|
layout.d \
|
||||||
|
lboxcmn.d \
|
||||||
list.d \
|
list.d \
|
||||||
log.d \
|
log.d \
|
||||||
memory.d \
|
memory.d \
|
||||||
@@ -1413,6 +1421,7 @@ MSW_COMMONOBJS = \
|
|||||||
cmndata.o \
|
cmndata.o \
|
||||||
config.o \
|
config.o \
|
||||||
ctrlcmn.o \
|
ctrlcmn.o \
|
||||||
|
ctrlsub.o \
|
||||||
date.o \
|
date.o \
|
||||||
datstrm.o \
|
datstrm.o \
|
||||||
db.o \
|
db.o \
|
||||||
@@ -1452,6 +1461,7 @@ MSW_COMMONOBJS = \
|
|||||||
intl.o \
|
intl.o \
|
||||||
ipcbase.o \
|
ipcbase.o \
|
||||||
layout.o \
|
layout.o \
|
||||||
|
lboxcmn.o \
|
||||||
list.o \
|
list.o \
|
||||||
log.o \
|
log.o \
|
||||||
memory.o \
|
memory.o \
|
||||||
@@ -1506,6 +1516,7 @@ MSW_COMMONDEPS = \
|
|||||||
cmndata.d \
|
cmndata.d \
|
||||||
config.d \
|
config.d \
|
||||||
ctrlcmn.d \
|
ctrlcmn.d \
|
||||||
|
ctrlsub.d \
|
||||||
date.d \
|
date.d \
|
||||||
datstrm.d \
|
datstrm.d \
|
||||||
db.d \
|
db.d \
|
||||||
@@ -1545,6 +1556,7 @@ MSW_COMMONDEPS = \
|
|||||||
intl.d \
|
intl.d \
|
||||||
ipcbase.d \
|
ipcbase.d \
|
||||||
layout.d \
|
layout.d \
|
||||||
|
lboxcmn.d \
|
||||||
list.d \
|
list.d \
|
||||||
log.d \
|
log.d \
|
||||||
memory.d \
|
memory.d \
|
||||||
|
@@ -98,6 +98,7 @@ cmndata.cpp C
|
|||||||
clipcmn.cpp C
|
clipcmn.cpp C
|
||||||
config.cpp C B
|
config.cpp C B
|
||||||
ctrlcmn.cpp C
|
ctrlcmn.cpp C
|
||||||
|
ctrlsub.cpp C
|
||||||
date.cpp C B
|
date.cpp C B
|
||||||
datstrm.cpp C
|
datstrm.cpp C
|
||||||
db.cpp C
|
db.cpp C
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
#pragma interface "choicebase.h"
|
#pragma interface "choicebase.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/control.h" // the base class
|
#include "wx/ctrlsub.h" // the base class
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// global data
|
// global data
|
||||||
@@ -32,88 +32,26 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxChoiceNameStr;
|
|||||||
// wxChoice allows to select one of a non-modifiable list of strings
|
// wxChoice allows to select one of a non-modifiable list of strings
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLEXPORT wxChoiceBase : public wxControl
|
class WXDLLEXPORT wxChoiceBase : public wxControlWithItems
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// ctor
|
// all generic methods are in wxControlWithItems
|
||||||
wxChoiceBase() { m_clientDataItemsType = ClientData_None; }
|
|
||||||
|
|
||||||
// add a new item to the list
|
// single selection logic
|
||||||
// no client data
|
|
||||||
void Append(const wxString& item) { DoAppend(item); }
|
|
||||||
// with client data which belongs to the caller
|
|
||||||
void Append(const wxString &item, void* clientData)
|
|
||||||
{ int n = DoAppend(item); SetClientData(n, clientData); }
|
|
||||||
// with client data which will be deleted by the control
|
|
||||||
void Append(const wxString &item, wxClientData* clientData)
|
|
||||||
{ int n = DoAppend(item); SetClientObject(n, clientData); }
|
|
||||||
|
|
||||||
// delete items from the list
|
|
||||||
// one item
|
|
||||||
virtual void Delete(int n) = 0;
|
|
||||||
// all of them
|
|
||||||
virtual void Clear() = 0;
|
|
||||||
|
|
||||||
// selection (at most one item may be selected in wxChoice)
|
|
||||||
// get the index of currently selected item or -1
|
|
||||||
virtual int GetSelection() const = 0;
|
|
||||||
// get the text of the currently selected item or empty string
|
|
||||||
virtual wxString GetStringSelection() const;
|
|
||||||
|
|
||||||
// set selectionto current item
|
|
||||||
virtual void SetSelection(int n) = 0;
|
virtual void SetSelection(int n) = 0;
|
||||||
// set selection to the current item, returns TRUE if ok
|
virtual bool SetStringSelection(const wxString& s);
|
||||||
virtual bool SetStringSelection(const wxString& sel);
|
|
||||||
|
|
||||||
// accessors to the list of strings
|
// don't override this
|
||||||
// get the number of items in the list of strings
|
virtual void Select(int n) { SetSelection(n); }
|
||||||
virtual int GetCount() const = 0;
|
|
||||||
|
|
||||||
// find string in the list, return wxNOT_FOUND if not found
|
|
||||||
virtual int FindString(const wxString& s) const = 0;
|
|
||||||
// get the string with the specified index
|
|
||||||
virtual wxString GetString(int n) const = 0;
|
|
||||||
|
|
||||||
// set/get the number of columns in the control (as they're not supporte on
|
// set/get the number of columns in the control (as they're not supporte on
|
||||||
// most platforms, they do nothing by default)
|
// most platforms, they do nothing by default)
|
||||||
virtual void SetColumns(int WXUNUSED(n) = 1 ) { }
|
virtual void SetColumns(int WXUNUSED(n) = 1 ) { }
|
||||||
virtual int GetColumns() const { return 1 ; }
|
virtual int GetColumns() const { return 1 ; }
|
||||||
|
|
||||||
// client data
|
// emulate selecting the item event.GetInt()
|
||||||
// untyped (isn't deleted by the control)
|
void Command(wxCommandEvent& event);
|
||||||
void SetClientData( int n, void* clientData );
|
|
||||||
void* GetClientData( int n ) const;
|
|
||||||
// typed (is owned and deleted by the control)
|
|
||||||
void SetClientObject( int n, wxClientData* clientData );
|
|
||||||
wxClientData* GetClientObject( int n ) const;
|
|
||||||
|
|
||||||
// emulate selecting the item event.GetInt() from the control
|
|
||||||
virtual void Command(wxCommandEvent &event);
|
|
||||||
|
|
||||||
// deprecated functions, heer for backwards compatibility only
|
|
||||||
int Number() const { return GetCount(); }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
// pure virtuals to implement in the derived classes
|
|
||||||
virtual int DoAppend(const wxString& item) = 0;
|
|
||||||
|
|
||||||
virtual void DoSetClientData( int n, void* clientData ) = 0;
|
|
||||||
virtual void* DoGetClientData( int n ) const = 0;
|
|
||||||
virtual void DoSetClientObject( int n, wxClientData* clientData ) = 0;
|
|
||||||
virtual wxClientData* DoGetClientObject( int n ) const = 0;
|
|
||||||
|
|
||||||
// the above pure virtuals hide these virtuals in wxWindowBase
|
|
||||||
virtual void DoSetClientData(void* clientData )
|
|
||||||
{ wxWindowBase::DoSetClientData(clientData); };
|
|
||||||
virtual void* DoGetClientData() const
|
|
||||||
{ return(wxWindowBase::DoGetClientData()); };
|
|
||||||
virtual void DoSetClientObject( wxClientData* clientData )
|
|
||||||
{ wxWindowBase::DoSetClientObject(clientData); };
|
|
||||||
virtual wxClientData* DoGetClientObject() const
|
|
||||||
{ return(wxWindowBase::DoGetClientObject()); };
|
|
||||||
|
|
||||||
// the type of the client data for the items
|
|
||||||
wxClientDataType m_clientDataItemsType;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
98
include/wx/ctrlsub.h
Normal file
98
include/wx/ctrlsub.h
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: wx/ctrlsub.h (read: "wxConTRoL with SUBitems")
|
||||||
|
// Purpose: wxControlWithItems interface
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Modified by:
|
||||||
|
// Created: 22.10.99
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) wxWindows team
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _WX_CTRLSUB_H_BASE_
|
||||||
|
#define _WX_CTRLSUB_H_BASE_
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "controlwithitems.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/control.h" // base class
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxControlWithItems defines an interface which is implemented by all controls
|
||||||
|
// which have string subitems each of which may be selected.
|
||||||
|
//
|
||||||
|
// Examples: wxListBox, wxCheckListBox, wxChoice and wxComboBox
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxControlWithItems : public wxControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxControlWithItems() { m_clientDataItemsType = ClientData_None; }
|
||||||
|
|
||||||
|
// adding items
|
||||||
|
// ------------
|
||||||
|
|
||||||
|
void Append(const wxString& item)
|
||||||
|
{ DoAppend(item); }
|
||||||
|
void Append(const wxString& item, void *clientData)
|
||||||
|
{ int n = DoAppend(item); SetClientData(n, clientData); }
|
||||||
|
void Append(const wxString& item, wxClientData *clientData)
|
||||||
|
{ int n = DoAppend(item); SetClientObject(n, clientData); }
|
||||||
|
|
||||||
|
// deleting items
|
||||||
|
// --------------
|
||||||
|
|
||||||
|
virtual void Clear() = 0;
|
||||||
|
virtual void Delete(int n) = 0;
|
||||||
|
|
||||||
|
// accessing strings
|
||||||
|
// -----------------
|
||||||
|
|
||||||
|
virtual int GetCount() const = 0;
|
||||||
|
virtual wxString GetString(int n) const = 0;
|
||||||
|
virtual void SetString(int n, const wxString& s) = 0;
|
||||||
|
virtual int FindString(const wxString& s) const = 0;
|
||||||
|
|
||||||
|
// selection
|
||||||
|
// ---------
|
||||||
|
|
||||||
|
virtual void Select(int n) = 0;
|
||||||
|
virtual int GetSelection() const = 0;
|
||||||
|
|
||||||
|
wxString GetStringSelection() const;
|
||||||
|
|
||||||
|
// misc
|
||||||
|
// ----
|
||||||
|
|
||||||
|
// client data stuff
|
||||||
|
void SetClientData(int n, void* clientData);
|
||||||
|
void* GetClientData(int n) const;
|
||||||
|
|
||||||
|
void SetClientObject(int n, wxClientData* clientData);
|
||||||
|
wxClientData* GetClientObject(int n) const;
|
||||||
|
|
||||||
|
bool HasClientObjectData() const
|
||||||
|
{ return m_clientDataItemsType == ClientData_Object; }
|
||||||
|
bool HasClientUntypedData() const
|
||||||
|
{ return m_clientDataItemsType == ClientData_Void; }
|
||||||
|
|
||||||
|
// compatibility - these functions are deprecated, use the new ones
|
||||||
|
// instead
|
||||||
|
int Number() const { return GetCount(); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual int DoAppend(const wxString& item) = 0;
|
||||||
|
|
||||||
|
virtual void DoSetItemClientData(int n, void* clientData) = 0;
|
||||||
|
virtual void* DoGetItemClientData(int n) const = 0;
|
||||||
|
virtual void DoSetItemClientObject(int n, wxClientData* clientData) = 0;
|
||||||
|
virtual wxClientData* DoGetItemClientObject(int n) const = 0;
|
||||||
|
|
||||||
|
// the type of the client data for the items
|
||||||
|
wxClientDataType m_clientDataItemsType;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _WX_CTRLSUB_H_BASE_
|
||||||
|
|
||||||
|
|
@@ -51,8 +51,9 @@ public:
|
|||||||
void SetSelection( int n );
|
void SetSelection( int n );
|
||||||
|
|
||||||
virtual int GetCount() const;
|
virtual int GetCount() const;
|
||||||
int FindString( const wxString &string ) const;
|
int FindString( const wxString& string ) const;
|
||||||
wxString GetString( int n ) const;
|
wxString GetString( int n ) const;
|
||||||
|
void SetString( int n, const wxString& string );
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
wxList m_clientList; // contains the client data for the items
|
wxList m_clientList; // contains the client data for the items
|
||||||
@@ -65,20 +66,10 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual int DoAppend(const wxString& item);
|
virtual int DoAppend(const wxString& item);
|
||||||
|
|
||||||
virtual void DoSetClientData( int n, void* clientData );
|
virtual void DoSetItemClientData( int n, void* clientData );
|
||||||
virtual void* DoGetClientData( int n ) const;
|
virtual void* DoGetItemClientData( int n ) const;
|
||||||
virtual void DoSetClientObject( int n, wxClientData* clientData );
|
virtual void DoSetItemClientObject( int n, wxClientData* clientData );
|
||||||
virtual wxClientData* DoGetClientObject( int n ) const;
|
virtual wxClientData* DoGetItemClientObject( int n ) const;
|
||||||
|
|
||||||
// the above virtuals hide these virtuals in wxChoiceBase
|
|
||||||
virtual void DoSetClientData(void* clientData )
|
|
||||||
{ wxWindowBase::DoSetClientData(clientData); };
|
|
||||||
virtual void* DoGetClientData() const
|
|
||||||
{ return(wxWindowBase::DoGetClientData()); };
|
|
||||||
virtual void DoSetClientObject( wxClientData* clientData )
|
|
||||||
{ wxWindowBase::DoSetClientObject(clientData); };
|
|
||||||
virtual wxClientData* DoGetClientObject() const
|
|
||||||
{ return(wxWindowBase::DoGetClientObject()); };
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// common part of Create() and DoAppend()
|
// common part of Create() and DoAppend()
|
||||||
|
@@ -69,10 +69,10 @@ public:
|
|||||||
|
|
||||||
virtual void DoSetFirstItem(int n);
|
virtual void DoSetFirstItem(int n);
|
||||||
|
|
||||||
virtual void DoSetClientData(int n, void* clientData);
|
virtual void DoSetItemClientData(int n, void* clientData);
|
||||||
virtual void* DoGetClientData(int n) const;
|
virtual void* DoGetItemClientData(int n) const;
|
||||||
virtual void DoSetClientObject(int n, wxClientData* clientData);
|
virtual void DoSetItemClientObject(int n, wxClientData* clientData);
|
||||||
virtual wxClientData* DoGetClientObject(int n) const;
|
virtual wxClientData* DoGetItemClientObject(int n) const;
|
||||||
|
|
||||||
// implementation from now on
|
// implementation from now on
|
||||||
|
|
||||||
|
@@ -51,8 +51,9 @@ public:
|
|||||||
void SetSelection( int n );
|
void SetSelection( int n );
|
||||||
|
|
||||||
virtual int GetCount() const;
|
virtual int GetCount() const;
|
||||||
int FindString( const wxString &string ) const;
|
int FindString( const wxString& string ) const;
|
||||||
wxString GetString( int n ) const;
|
wxString GetString( int n ) const;
|
||||||
|
void SetString( int n, const wxString& string );
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
wxList m_clientList; // contains the client data for the items
|
wxList m_clientList; // contains the client data for the items
|
||||||
@@ -65,20 +66,10 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual int DoAppend(const wxString& item);
|
virtual int DoAppend(const wxString& item);
|
||||||
|
|
||||||
virtual void DoSetClientData( int n, void* clientData );
|
virtual void DoSetItemClientData( int n, void* clientData );
|
||||||
virtual void* DoGetClientData( int n ) const;
|
virtual void* DoGetItemClientData( int n ) const;
|
||||||
virtual void DoSetClientObject( int n, wxClientData* clientData );
|
virtual void DoSetItemClientObject( int n, wxClientData* clientData );
|
||||||
virtual wxClientData* DoGetClientObject( int n ) const;
|
virtual wxClientData* DoGetItemClientObject( int n ) const;
|
||||||
|
|
||||||
// the above virtuals hide these virtuals in wxChoiceBase
|
|
||||||
virtual void DoSetClientData(void* clientData )
|
|
||||||
{ wxWindowBase::DoSetClientData(clientData); };
|
|
||||||
virtual void* DoGetClientData() const
|
|
||||||
{ return(wxWindowBase::DoGetClientData()); };
|
|
||||||
virtual void DoSetClientObject( wxClientData* clientData )
|
|
||||||
{ wxWindowBase::DoSetClientObject(clientData); };
|
|
||||||
virtual wxClientData* DoGetClientObject() const
|
|
||||||
{ return(wxWindowBase::DoGetClientObject()); };
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// common part of Create() and DoAppend()
|
// common part of Create() and DoAppend()
|
||||||
|
@@ -69,10 +69,10 @@ public:
|
|||||||
|
|
||||||
virtual void DoSetFirstItem(int n);
|
virtual void DoSetFirstItem(int n);
|
||||||
|
|
||||||
virtual void DoSetClientData(int n, void* clientData);
|
virtual void DoSetItemClientData(int n, void* clientData);
|
||||||
virtual void* DoGetClientData(int n) const;
|
virtual void* DoGetItemClientData(int n) const;
|
||||||
virtual void DoSetClientObject(int n, wxClientData* clientData);
|
virtual void DoSetItemClientObject(int n, wxClientData* clientData);
|
||||||
virtual wxClientData* DoGetClientObject(int n) const;
|
virtual wxClientData* DoGetItemClientObject(int n) const;
|
||||||
|
|
||||||
// implementation from now on
|
// implementation from now on
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 22.10.99
|
// Created: 22.10.99
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) wxWindows team
|
// Copyright: (c) wxWindows team
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_LISTBOX_H_BASE_
|
#ifndef _WX_LISTBOX_H_BASE_
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#if wxUSE_LISTBOX
|
#if wxUSE_LISTBOX
|
||||||
|
|
||||||
#include "wx/control.h" // base class
|
#include "wx/ctrlsub.h" // base class
|
||||||
|
|
||||||
// forward declarations are enough here
|
// forward declarations are enough here
|
||||||
class WXDLLEXPORT wxArrayInt;
|
class WXDLLEXPORT wxArrayInt;
|
||||||
@@ -40,21 +40,11 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxListBoxNameStr;
|
|||||||
// wxListBox interface is defined by the class wxListBoxBase
|
// wxListBox interface is defined by the class wxListBoxBase
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLEXPORT wxListBoxBase : public wxControl
|
class WXDLLEXPORT wxListBoxBase : public wxControlWithItems
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// ctor
|
// all generic methods are in wxControlWithItems, except for the following
|
||||||
wxListBoxBase() { m_clientDataItemsType = ClientData_None; }
|
// ones which are not yet implemented by wxChoice/wxCombobox
|
||||||
|
|
||||||
// adding items
|
|
||||||
// ------------
|
|
||||||
|
|
||||||
void Append(const wxString& item)
|
|
||||||
{ DoAppend(item); }
|
|
||||||
void Append(const wxString& item, void *clientData)
|
|
||||||
{ int n = DoAppend(item); SetClientData(n, clientData); }
|
|
||||||
void Append(const wxString& item, wxClientData *clientData)
|
|
||||||
{ int n = DoAppend(item); SetClientObject(n, clientData); }
|
|
||||||
|
|
||||||
void Insert(const wxString& item, int pos)
|
void Insert(const wxString& item, int pos)
|
||||||
{ DoInsert(item, pos); }
|
{ DoInsert(item, pos); }
|
||||||
@@ -71,57 +61,30 @@ public:
|
|||||||
void Set(const wxArrayString& items, void **clientData = NULL)
|
void Set(const wxArrayString& items, void **clientData = NULL)
|
||||||
{ DoSetItems(items, clientData); }
|
{ DoSetItems(items, clientData); }
|
||||||
|
|
||||||
// deleting items
|
// multiple selection logic
|
||||||
// --------------
|
|
||||||
|
|
||||||
virtual void Clear() = 0;
|
|
||||||
virtual void Delete(int n) = 0;
|
|
||||||
|
|
||||||
// accessing strings
|
|
||||||
// -----------------
|
|
||||||
|
|
||||||
virtual int GetCount() const = 0;
|
|
||||||
virtual wxString GetString(int n) const = 0;
|
|
||||||
virtual void SetString(int n, const wxString& s) = 0;
|
|
||||||
virtual int FindString(const wxString& s) const = 0;
|
|
||||||
|
|
||||||
// selection
|
|
||||||
// ---------
|
|
||||||
|
|
||||||
virtual bool IsSelected(int n) const = 0;
|
virtual bool IsSelected(int n) const = 0;
|
||||||
virtual void SetSelection(int n, bool select = TRUE) = 0;
|
virtual void SetSelection(int n, bool select = TRUE) = 0;
|
||||||
void Select(int n) { SetSelection(n, TRUE); }
|
virtual void Select(int n) { SetSelection(n, TRUE); }
|
||||||
void Deselect(int n) { SetSelection(n, FALSE); }
|
void Deselect(int n) { SetSelection(n, FALSE); }
|
||||||
|
|
||||||
virtual int GetSelection() const = 0;
|
virtual bool SetStringSelection(const wxString& s, bool select = TRUE);
|
||||||
|
|
||||||
|
// works for single as well as multiple selection listboxes (unlike
|
||||||
|
// GetSelection which only works for listboxes with single selection)
|
||||||
virtual int GetSelections(wxArrayInt& aSelections) const = 0;
|
virtual int GetSelections(wxArrayInt& aSelections) const = 0;
|
||||||
|
|
||||||
bool SetStringSelection(const wxString& s, bool select = TRUE);
|
|
||||||
wxString GetStringSelection() const;
|
|
||||||
|
|
||||||
// misc
|
|
||||||
// ----
|
|
||||||
|
|
||||||
// client data stuff
|
|
||||||
void SetClientData( int n, void* clientData );
|
|
||||||
void* GetClientData( int n ) const;
|
|
||||||
|
|
||||||
void SetClientObject( int n, wxClientData* clientData );
|
|
||||||
wxClientData* GetClientObject( int n ) const;
|
|
||||||
|
|
||||||
// Set the specified item at the first visible item or scroll to max
|
// Set the specified item at the first visible item or scroll to max
|
||||||
// range.
|
// range.
|
||||||
void SetFirstItem(int n) { DoSetFirstItem(n); }
|
void SetFirstItem(int n) { DoSetFirstItem(n); }
|
||||||
void SetFirstItem(const wxString& s);
|
void SetFirstItem(const wxString& s);
|
||||||
|
|
||||||
// emulate selecting or deselecting (depending on event.GetExtraLong())
|
// emulate selecting or deselecting the item event.GetInt() (depending on
|
||||||
// the item event.GetInt() from the control
|
// event.GetExtraLong())
|
||||||
virtual void Command(wxCommandEvent &event);
|
void Command(wxCommandEvent& event);
|
||||||
|
|
||||||
// compatibility - these functions are deprecated, use the new ones
|
// compatibility - these functions are deprecated, use the new ones
|
||||||
// instead
|
// instead
|
||||||
bool Selected(int n) const { return IsSelected(n); }
|
bool Selected(int n) const { return IsSelected(n); }
|
||||||
int Number() const { return GetCount(); }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// NB: due to wxGTK implementation details, DoInsert() is implemented
|
// NB: due to wxGTK implementation details, DoInsert() is implemented
|
||||||
@@ -130,29 +93,10 @@ protected:
|
|||||||
{ InsertItems(1, &item, pos); }
|
{ InsertItems(1, &item, pos); }
|
||||||
|
|
||||||
// to be implemented in derived classes
|
// to be implemented in derived classes
|
||||||
virtual int DoAppend(const wxString& item) = 0;
|
|
||||||
virtual void DoInsertItems(const wxArrayString& items, int pos) = 0;
|
virtual void DoInsertItems(const wxArrayString& items, int pos) = 0;
|
||||||
virtual void DoSetItems(const wxArrayString& items, void **clientData) = 0;
|
virtual void DoSetItems(const wxArrayString& items, void **clientData) = 0;
|
||||||
|
|
||||||
virtual void DoSetFirstItem(int n) = 0;
|
virtual void DoSetFirstItem(int n) = 0;
|
||||||
|
|
||||||
virtual void DoSetClientData(int n, void* clientData) = 0;
|
|
||||||
virtual void* DoGetClientData(int n) const = 0;
|
|
||||||
virtual void DoSetClientObject(int n, wxClientData* clientData) = 0;
|
|
||||||
virtual wxClientData* DoGetClientObject(int n) const = 0;
|
|
||||||
|
|
||||||
// the above pure virtuals hide these virtuals in wxWindowBase
|
|
||||||
virtual void DoSetClientData(void* clientData )
|
|
||||||
{ wxWindowBase::DoSetClientData(clientData); };
|
|
||||||
virtual void* DoGetClientData() const
|
|
||||||
{ return(wxWindowBase::DoGetClientData()); };
|
|
||||||
virtual void DoSetClientObject( wxClientData* clientData )
|
|
||||||
{ wxWindowBase::DoSetClientObject(clientData); };
|
|
||||||
virtual wxClientData* DoGetClientObject() const
|
|
||||||
{ return(wxWindowBase::DoGetClientObject()); };
|
|
||||||
|
|
||||||
// the type of the client data for the items
|
|
||||||
wxClientDataType m_clientDataItemsType;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -60,16 +60,17 @@ public:
|
|||||||
|
|
||||||
virtual int FindString(const wxString& s) const;
|
virtual int FindString(const wxString& s) const;
|
||||||
virtual wxString GetString(int n) const;
|
virtual wxString GetString(int n) const;
|
||||||
|
virtual void SetString(int n, const wxString& s);
|
||||||
|
|
||||||
// MSW only
|
// MSW only
|
||||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||||
long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DoSetClientData( int n, void* clientData );
|
virtual void DoSetItemClientData( int n, void* clientData );
|
||||||
virtual void* DoGetClientData( int n ) const;
|
virtual void* DoGetItemClientData( int n ) const;
|
||||||
virtual void DoSetClientObject( int n, wxClientData* clientData );
|
virtual void DoSetItemClientObject( int n, wxClientData* clientData );
|
||||||
virtual wxClientData* DoGetClientObject( int n ) const;
|
virtual wxClientData* DoGetItemClientObject( int n ) const;
|
||||||
|
|
||||||
// MSW implementation
|
// MSW implementation
|
||||||
virtual wxSize DoGetBestSize();
|
virtual wxSize DoGetBestSize();
|
||||||
|
@@ -82,10 +82,10 @@ public:
|
|||||||
|
|
||||||
virtual void DoSetFirstItem(int n);
|
virtual void DoSetFirstItem(int n);
|
||||||
|
|
||||||
virtual void DoSetClientData(int n, void* clientData);
|
virtual void DoSetItemClientData(int n, void* clientData);
|
||||||
virtual void* DoGetClientData(int n) const;
|
virtual void* DoGetItemClientData(int n) const;
|
||||||
virtual void DoSetClientObject(int n, wxClientData* clientData);
|
virtual void DoSetItemClientObject(int n, wxClientData* clientData);
|
||||||
virtual wxClientData* DoGetClientObject(int n) const;
|
virtual wxClientData* DoGetItemClientObject(int n) const;
|
||||||
|
|
||||||
// wxCheckListBox support
|
// wxCheckListBox support
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
|
@@ -104,7 +104,8 @@ public:
|
|||||||
void OnShowProgress( wxCommandEvent &event );
|
void OnShowProgress( wxCommandEvent &event );
|
||||||
#endif // wxUSE_SPINBUTTON
|
#endif // wxUSE_SPINBUTTON
|
||||||
|
|
||||||
wxListBox *m_listbox;
|
wxListBox *m_listbox,
|
||||||
|
*m_listboxSorted;
|
||||||
wxChoice *m_choice,
|
wxChoice *m_choice,
|
||||||
*m_choiceSorted;
|
*m_choiceSorted;
|
||||||
wxComboBox *m_combo;
|
wxComboBox *m_combo;
|
||||||
@@ -152,9 +153,12 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// main()
|
// other
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void SetControlClientData(const char *name,
|
||||||
|
wxControlWithItems *control);
|
||||||
|
|
||||||
IMPLEMENT_APP(MyApp)
|
IMPLEMENT_APP(MyApp)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@@ -226,6 +230,7 @@ const int ID_LISTBOX_APPEND = 134;
|
|||||||
const int ID_LISTBOX_DELETE = 135;
|
const int ID_LISTBOX_DELETE = 135;
|
||||||
const int ID_LISTBOX_FONT = 136;
|
const int ID_LISTBOX_FONT = 136;
|
||||||
const int ID_LISTBOX_ENABLE = 137;
|
const int ID_LISTBOX_ENABLE = 137;
|
||||||
|
const int ID_LISTBOX_SORTED = 138;
|
||||||
|
|
||||||
const int ID_CHOICE = 120;
|
const int ID_CHOICE = 120;
|
||||||
const int ID_CHOICE_SEL_NUM = 121;
|
const int ID_CHOICE_SEL_NUM = 121;
|
||||||
@@ -268,6 +273,7 @@ EVT_SIZE ( MyPanel::OnSize)
|
|||||||
EVT_NOTEBOOK_PAGE_CHANGING(ID_NOTEBOOK, MyPanel::OnPageChanging)
|
EVT_NOTEBOOK_PAGE_CHANGING(ID_NOTEBOOK, MyPanel::OnPageChanging)
|
||||||
EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, MyPanel::OnPageChanged)
|
EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, MyPanel::OnPageChanged)
|
||||||
EVT_LISTBOX (ID_LISTBOX, MyPanel::OnListBox)
|
EVT_LISTBOX (ID_LISTBOX, MyPanel::OnListBox)
|
||||||
|
EVT_LISTBOX (ID_LISTBOX_SORTED, MyPanel::OnListBox)
|
||||||
EVT_LISTBOX_DCLICK(ID_LISTBOX, MyPanel::OnListBoxDoubleClick)
|
EVT_LISTBOX_DCLICK(ID_LISTBOX, MyPanel::OnListBoxDoubleClick)
|
||||||
EVT_BUTTON (ID_LISTBOX_SEL_NUM, MyPanel::OnListBoxButtons)
|
EVT_BUTTON (ID_LISTBOX_SEL_NUM, MyPanel::OnListBoxButtons)
|
||||||
EVT_BUTTON (ID_LISTBOX_SEL_STR, MyPanel::OnListBoxButtons)
|
EVT_BUTTON (ID_LISTBOX_SEL_STR, MyPanel::OnListBoxButtons)
|
||||||
@@ -385,11 +391,17 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxButton *button = (wxButton*) NULL; /* who did this ? */
|
wxPanel *panel = new wxPanel(m_notebook);
|
||||||
wxPanel *panel = (wxPanel*) NULL;
|
m_listbox = new wxListBox( panel, ID_LISTBOX,
|
||||||
|
wxPoint(10,10), wxSize(120,70),
|
||||||
|
5, choices, wxLB_ALWAYS_SB );
|
||||||
|
m_listboxSorted = new wxListBox( panel, ID_LISTBOX_SORTED,
|
||||||
|
wxPoint(10,90), wxSize(120,70),
|
||||||
|
5, choices, wxLB_SORT );
|
||||||
|
|
||||||
|
SetControlClientData("listbox", m_listbox);
|
||||||
|
SetControlClientData("listbox", m_listboxSorted);
|
||||||
|
|
||||||
panel = new wxPanel(m_notebook);
|
|
||||||
m_listbox = new wxListBox( panel, ID_LISTBOX, wxPoint(10,10), wxSize(120,70), 5, choices, wxLB_ALWAYS_SB );
|
|
||||||
m_listbox->SetCursor(*wxCROSS_CURSOR);
|
m_listbox->SetCursor(*wxCROSS_CURSOR);
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
m_listbox->SetToolTip( "This is a list box" );
|
m_listbox->SetToolTip( "This is a list box" );
|
||||||
@@ -400,12 +412,12 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
|||||||
(void)new wxButton( panel, ID_LISTBOX_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) );
|
(void)new wxButton( panel, ID_LISTBOX_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) );
|
||||||
(void)new wxButton( panel, ID_LISTBOX_APPEND, "Append 'Hi!'", wxPoint(340,80), wxSize(140,30) );
|
(void)new wxButton( panel, ID_LISTBOX_APPEND, "Append 'Hi!'", wxPoint(340,80), wxSize(140,30) );
|
||||||
(void)new wxButton( panel, ID_LISTBOX_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) );
|
(void)new wxButton( panel, ID_LISTBOX_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) );
|
||||||
button = new wxButton( panel, ID_LISTBOX_FONT, "Set &Italic font", wxPoint(340,130), wxSize(140,30) );
|
wxButton *button = new wxButton( panel, ID_LISTBOX_FONT, "Set &Italic font", wxPoint(340,130), wxSize(140,30) );
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
button->SetToolTip( "Press here to set italic font" );
|
button->SetToolTip( "Press here to set italic font" );
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
m_checkbox = new wxCheckBox( panel, ID_LISTBOX_ENABLE, "&Disable", wxPoint(20,130) );
|
m_checkbox = new wxCheckBox( panel, ID_LISTBOX_ENABLE, "&Disable", wxPoint(20,170) );
|
||||||
m_checkbox->SetValue(FALSE);
|
m_checkbox->SetValue(FALSE);
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
m_checkbox->SetToolTip( "Click here to disable the listbox" );
|
m_checkbox->SetToolTip( "Click here to disable the listbox" );
|
||||||
@@ -416,6 +428,10 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
|||||||
m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 5, choices );
|
m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 5, choices );
|
||||||
m_choiceSorted = new wxChoice( panel, ID_CHOICE_SORTED, wxPoint(10,70), wxSize(120,-1),
|
m_choiceSorted = new wxChoice( panel, ID_CHOICE_SORTED, wxPoint(10,70), wxSize(120,-1),
|
||||||
5, choices, wxCB_SORT );
|
5, choices, wxCB_SORT );
|
||||||
|
|
||||||
|
SetControlClientData("choice", m_choice);
|
||||||
|
SetControlClientData("choice", m_choiceSorted);
|
||||||
|
|
||||||
m_choice->SetSelection(2);
|
m_choice->SetSelection(2);
|
||||||
m_choice->SetBackgroundColour( "red" );
|
m_choice->SetBackgroundColour( "red" );
|
||||||
(void)new wxButton( panel, ID_CHOICE_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
|
(void)new wxButton( panel, ID_CHOICE_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
|
||||||
@@ -603,12 +619,24 @@ void MyPanel::OnPageChanged( wxNotebookEvent &event )
|
|||||||
|
|
||||||
void MyPanel::OnListBox( wxCommandEvent &event )
|
void MyPanel::OnListBox( wxCommandEvent &event )
|
||||||
{
|
{
|
||||||
m_text->AppendText( "ListBox event selection string is: " );
|
wxListBox *listbox = event.GetId() == ID_LISTBOX ? m_listbox
|
||||||
|
: m_listboxSorted;
|
||||||
|
|
||||||
|
m_text->AppendText( "ListBox event selection string is: '" );
|
||||||
m_text->AppendText( event.GetString() );
|
m_text->AppendText( event.GetString() );
|
||||||
m_text->AppendText( "\n" );
|
m_text->AppendText( "'\n" );
|
||||||
m_text->AppendText( "ListBox control selection string is: " );
|
m_text->AppendText( "ListBox control selection string is: '" );
|
||||||
m_text->AppendText( m_listbox->GetStringSelection() );
|
m_text->AppendText( listbox->GetStringSelection() );
|
||||||
m_text->AppendText( "\n" );
|
m_text->AppendText( "'\n" );
|
||||||
|
|
||||||
|
wxStringClientData *obj = ((wxStringClientData *)event.GetClientObject());
|
||||||
|
m_text->AppendText( "ListBox event client data string is: '" );
|
||||||
|
m_text->AppendText( obj ? obj->GetData() : wxString("none"));
|
||||||
|
m_text->AppendText( "'\n" );
|
||||||
|
m_text->AppendText( "ListBox control client data string is: '" );
|
||||||
|
obj = (wxStringClientData *)listbox->GetClientObject(listbox->GetSelection());
|
||||||
|
m_text->AppendText( obj ? obj->GetData() : wxString("none"));
|
||||||
|
m_text->AppendText( "'\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyPanel::OnListBoxDoubleClick( wxCommandEvent &event )
|
void MyPanel::OnListBoxDoubleClick( wxCommandEvent &event )
|
||||||
@@ -633,39 +661,48 @@ void MyPanel::OnListBoxButtons( wxCommandEvent &event )
|
|||||||
cb->SetToolTip( "Click to disable listbox" );
|
cb->SetToolTip( "Click to disable listbox" );
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
m_listbox->Enable( event.GetInt() == 0 );
|
m_listbox->Enable( event.GetInt() == 0 );
|
||||||
|
m_listboxSorted->Enable( event.GetInt() == 0 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ID_LISTBOX_SEL_NUM:
|
case ID_LISTBOX_SEL_NUM:
|
||||||
{
|
{
|
||||||
m_listbox->SetSelection( 2 );
|
m_listbox->SetSelection( 2 );
|
||||||
|
m_listboxSorted->SetSelection( 2 );
|
||||||
m_lbSelectThis->WarpPointer( 40, 14 );
|
m_lbSelectThis->WarpPointer( 40, 14 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ID_LISTBOX_SEL_STR:
|
case ID_LISTBOX_SEL_STR:
|
||||||
{
|
{
|
||||||
m_listbox->SetStringSelection( "This" );
|
m_listbox->SetStringSelection( "This" );
|
||||||
|
m_listboxSorted->SetStringSelection( "This" );
|
||||||
m_lbSelectNum->WarpPointer( 40, 14 );
|
m_lbSelectNum->WarpPointer( 40, 14 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ID_LISTBOX_CLEAR:
|
case ID_LISTBOX_CLEAR:
|
||||||
{
|
{
|
||||||
m_listbox->Clear();
|
m_listbox->Clear();
|
||||||
|
m_listboxSorted->Clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ID_LISTBOX_APPEND:
|
case ID_LISTBOX_APPEND:
|
||||||
{
|
{
|
||||||
m_listbox->Append( "Hi!" );
|
m_listbox->Append( "Hi!" );
|
||||||
|
m_listboxSorted->Append( "Hi!" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ID_LISTBOX_DELETE:
|
case ID_LISTBOX_DELETE:
|
||||||
{
|
{
|
||||||
int idx = m_listbox->GetSelection();
|
int idx;
|
||||||
|
idx = m_listbox->GetSelection();
|
||||||
m_listbox->Delete( idx );
|
m_listbox->Delete( idx );
|
||||||
|
idx = m_listboxSorted->GetSelection();
|
||||||
|
m_listboxSorted->Delete( idx );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ID_LISTBOX_FONT:
|
case ID_LISTBOX_FONT:
|
||||||
{
|
{
|
||||||
m_listbox->SetFont( *wxITALIC_FONT );
|
m_listbox->SetFont( *wxITALIC_FONT );
|
||||||
|
m_listboxSorted->SetFont( *wxITALIC_FONT );
|
||||||
m_checkbox->SetFont( *wxITALIC_FONT );
|
m_checkbox->SetFont( *wxITALIC_FONT );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -674,14 +711,24 @@ void MyPanel::OnListBoxButtons( wxCommandEvent &event )
|
|||||||
|
|
||||||
void MyPanel::OnChoice( wxCommandEvent &event )
|
void MyPanel::OnChoice( wxCommandEvent &event )
|
||||||
{
|
{
|
||||||
m_text->AppendText( "Choice event selection string is: " );
|
wxChoice *choice = event.GetId() == ID_CHOICE ? m_choice
|
||||||
|
: m_choiceSorted;
|
||||||
|
|
||||||
|
m_text->AppendText( "Choice event selection string is: '" );
|
||||||
m_text->AppendText( event.GetString() );
|
m_text->AppendText( event.GetString() );
|
||||||
m_text->AppendText( "\n" );
|
m_text->AppendText( "'\n" );
|
||||||
m_text->AppendText( "Choice control selection string is: '" );
|
m_text->AppendText( "Choice control selection string is: '" );
|
||||||
m_text->AppendText( m_choice->GetStringSelection() );
|
m_text->AppendText( choice->GetStringSelection() );
|
||||||
m_text->AppendText( "' (for unsorted control)\nand '" );
|
m_text->AppendText( "'\n" );
|
||||||
m_text->AppendText( m_choiceSorted->GetStringSelection() );
|
|
||||||
m_text->AppendText( "' (for sorted control)\n" );
|
wxStringClientData *obj = ((wxStringClientData *)event.GetClientObject());
|
||||||
|
m_text->AppendText( "Choice event client data string is: '" );
|
||||||
|
m_text->AppendText( obj ? obj->GetData() : wxString("none"));
|
||||||
|
m_text->AppendText( "'\n" );
|
||||||
|
m_text->AppendText( "Choice control client data string is: '" );
|
||||||
|
obj = (wxStringClientData *)choice->GetClientObject(choice->GetSelection());
|
||||||
|
m_text->AppendText( obj ? obj->GetData() : wxString("none"));
|
||||||
|
m_text->AppendText( "'\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyPanel::OnChoiceButtons( wxCommandEvent &event )
|
void MyPanel::OnChoiceButtons( wxCommandEvent &event )
|
||||||
@@ -1039,3 +1086,17 @@ void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) )
|
|||||||
SetStatusText(msg);
|
SetStatusText(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void SetControlClientData(const char *name,
|
||||||
|
wxControlWithItems *control)
|
||||||
|
{
|
||||||
|
size_t count = control->GetCount();
|
||||||
|
for ( size_t n = 0; n < count; n++ )
|
||||||
|
{
|
||||||
|
wxString s;
|
||||||
|
s.Printf("%s client data for '%s'",
|
||||||
|
name, control->GetString(n).c_str());
|
||||||
|
|
||||||
|
control->SetClientObject(n, new wxStringClientData(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/choice.h"
|
#include "wx/choice.h"
|
||||||
#include "wx/log.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -38,80 +37,26 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// events
|
// selection
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxChoiceBase::Command(wxCommandEvent &event)
|
bool wxChoiceBase::SetStringSelection(const wxString& s)
|
||||||
{
|
{
|
||||||
SetSelection(event.GetInt());
|
int sel = FindString(s);
|
||||||
(void)ProcessEvent(event);
|
wxCHECK_MSG( sel != -1, FALSE,
|
||||||
}
|
wxT("invalid string in wxChoice::SetStringSelection") );
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
Select(sel);
|
||||||
// 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);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// client data
|
// misc
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxChoiceBase::SetClientObject(int n, wxClientData *data)
|
void wxChoiceBase::Command(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( m_clientDataItemsType != ClientData_Void,
|
SetSelection(event.m_commandInt);
|
||||||
wxT("can't have both object and void client data") );
|
(void)ProcessEvent(event);
|
||||||
|
|
||||||
wxClientData *clientDataOld = DoGetClientObject(n);
|
|
||||||
if ( clientDataOld )
|
|
||||||
delete clientDataOld;
|
|
||||||
|
|
||||||
DoSetClientObject(n, data);
|
|
||||||
m_clientDataItemsType = ClientData_Object;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
// Created: 22.10.99
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) wxWindows team
|
// 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
|
// 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)
|
bool wxListBoxBase::SetStringSelection(const wxString& s, bool select)
|
||||||
{
|
{
|
||||||
int sel = FindString(s);
|
int sel = FindString(s);
|
||||||
wxCHECK_MSG( sel != -1, FALSE,
|
wxCHECK_MSG( sel != -1, FALSE,
|
||||||
wxT("invalid string in wxListBox::SetStringSelection") );
|
wxT("invalid string in SetStringSelection") );
|
||||||
|
|
||||||
SetSelection(sel, select);
|
SetSelection(sel, select);
|
||||||
|
|
||||||
return TRUE;
|
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
|
// misc
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxListBoxBase::Command(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
SetSelection(event.m_commandInt, event.m_extraLong);
|
||||||
|
(void)ProcessEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
void wxListBoxBase::SetFirstItem(const wxString& s)
|
void wxListBoxBase::SetFirstItem(const wxString& s)
|
||||||
{
|
{
|
||||||
int n = FindString(s);
|
int n = FindString(s);
|
||||||
@@ -142,10 +96,3 @@ void wxListBoxBase::SetFirstItem(const wxString& s)
|
|||||||
|
|
||||||
DoSetFirstItem(n);
|
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;
|
if (g_blockEventsOnDrag) return;
|
||||||
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
|
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
|
||||||
event.SetInt( choice->GetSelection() );
|
int n = choice->GetSelection();
|
||||||
|
|
||||||
|
event.SetInt( n );
|
||||||
event.SetString( choice->GetStringSelection() );
|
event.SetString( choice->GetStringSelection() );
|
||||||
event.SetEventObject(choice);
|
event.SetEventObject(choice);
|
||||||
|
|
||||||
|
if ( choice->HasClientObjectData() )
|
||||||
|
event.SetClientObject( choice->GetClientObject(n) );
|
||||||
|
else if ( choice->HasClientUntypedData() )
|
||||||
|
event.SetClientData( choice->GetClientData(n) );
|
||||||
|
|
||||||
choice->GetEventHandler()->ProcessEvent(event);
|
choice->GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,32 +142,32 @@ int wxChoice::DoAppend( const wxString &item )
|
|||||||
return AppendHelper(menu, 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") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
|
||||||
|
|
||||||
wxNode *node = m_clientList.Nth( n );
|
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 );
|
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") );
|
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid choice control") );
|
||||||
|
|
||||||
wxNode *node = m_clientList.Nth( n );
|
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();
|
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") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
|
||||||
|
|
||||||
wxNode *node = m_clientList.Nth( n );
|
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();
|
wxClientData *cd = (wxClientData*) node->Data();
|
||||||
delete cd;
|
delete cd;
|
||||||
@@ -167,13 +175,13 @@ void wxChoice::DoSetClientObject( int n, wxClientData* clientData )
|
|||||||
node->SetData( (wxObject*) 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") );
|
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid choice control") );
|
||||||
|
|
||||||
wxNode *node = m_clientList.Nth( n );
|
wxNode *node = m_clientList.Nth( n );
|
||||||
wxCHECK_MSG( node, (wxClientData *)NULL,
|
wxCHECK_MSG( node, (wxClientData *)NULL,
|
||||||
wxT("invalid index in wxChoice::DoGetClientObject") );
|
wxT("invalid index in wxChoice::DoGetItemClientObject") );
|
||||||
|
|
||||||
return (wxClientData*) node->Data();
|
return (wxClientData*) node->Data();
|
||||||
}
|
}
|
||||||
@@ -186,8 +194,18 @@ void wxChoice::Clear()
|
|||||||
GtkWidget *menu = gtk_menu_new();
|
GtkWidget *menu = gtk_menu_new();
|
||||||
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
|
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
|
||||||
|
|
||||||
if ( m_clientDataItemsType == ClientData_Object )
|
if ( HasClientObjectData() )
|
||||||
m_clientList.DeleteContents(TRUE);
|
{
|
||||||
|
// 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();
|
m_clientList.Clear();
|
||||||
|
|
||||||
if ( m_strings )
|
if ( m_strings )
|
||||||
@@ -246,6 +264,13 @@ int wxChoice::GetSelection() const
|
|||||||
return -1;
|
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
|
wxString wxChoice::GetString( int n ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid choice") );
|
wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid choice") );
|
||||||
@@ -372,8 +397,7 @@ size_t wxChoice::AppendHelper(GtkWidget *menu, const wxString& item)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// can't use Insert() :-(
|
m_clientList.Insert( (wxObject*) NULL );
|
||||||
m_clientList.Append( (wxObject*) NULL );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -102,25 +102,28 @@ gtk_listbox_button_release_callback( GtkWidget * WXUNUSED(widget),
|
|||||||
|
|
||||||
if (!g_hasDoubleClicked) return FALSE;
|
if (!g_hasDoubleClicked) return FALSE;
|
||||||
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
|
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
|
||||||
event.SetEventObject( listbox );
|
event.SetEventObject( listbox );
|
||||||
|
|
||||||
wxArrayInt aSelections;
|
wxArrayInt aSelections;
|
||||||
int count = listbox->GetSelections(aSelections);
|
int n, count = listbox->GetSelections(aSelections);
|
||||||
if ( count > 0 )
|
if ( count > 0 )
|
||||||
{
|
{
|
||||||
event.m_commandInt = aSelections[0] ;
|
n = aSelections[0];
|
||||||
event.m_clientData = listbox->GetClientData( event.m_commandInt );
|
if ( listbox->HasClientObjectData() )
|
||||||
wxString str(listbox->GetString(event.m_commandInt));
|
event.SetClientObject( listbox->GetClientObject(n) );
|
||||||
if (!str.IsEmpty()) event.m_commandString = str;
|
else if ( listbox->HasClientUntypedData() )
|
||||||
}
|
event.SetClientData( listbox->GetClientData(n) );
|
||||||
else
|
event.SetString( listbox->GetString(n) );
|
||||||
{
|
}
|
||||||
event.m_commandInt = -1 ;
|
else
|
||||||
event.m_commandString.Empty();
|
{
|
||||||
}
|
n = -1;
|
||||||
|
}
|
||||||
|
|
||||||
listbox->GetEventHandler()->ProcessEvent( event );
|
event.m_commandInt = n;
|
||||||
|
|
||||||
|
listbox->GetEventHandler()->ProcessEvent( event );
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -213,14 +216,18 @@ static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox
|
|||||||
if (g_blockEventsOnDrag) return;
|
if (g_blockEventsOnDrag) return;
|
||||||
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
|
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
|
||||||
|
event.SetEventObject( listbox );
|
||||||
|
|
||||||
wxArrayInt aSelections;
|
wxArrayInt aSelections;
|
||||||
int n, count = listbox->GetSelections(aSelections);
|
int n, count = listbox->GetSelections(aSelections);
|
||||||
if ( count > 0 )
|
if ( count > 0 )
|
||||||
{
|
{
|
||||||
n = aSelections[0];
|
n = aSelections[0];
|
||||||
event.m_clientData = listbox->m_clientData.Item(n);
|
if ( listbox->HasClientObjectData() )
|
||||||
event.m_commandString = listbox->GetString(n);
|
event.SetClientObject( listbox->GetClientObject(n) );
|
||||||
|
else if ( listbox->HasClientUntypedData() )
|
||||||
|
event.SetClientData( listbox->GetClientData(n) );
|
||||||
|
event.SetString( listbox->GetString(n) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -229,8 +236,6 @@ static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox
|
|||||||
|
|
||||||
event.m_commandInt = n;
|
event.m_commandInt = n;
|
||||||
|
|
||||||
event.SetEventObject( listbox );
|
|
||||||
|
|
||||||
listbox->GetEventHandler()->ProcessEvent( event );
|
listbox->GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,8 +322,6 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
m_clientData.Append((wxObject *)NULL);
|
|
||||||
|
|
||||||
DoAppend(choices[i]);
|
DoAppend(choices[i]);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -431,7 +434,6 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
|||||||
|
|
||||||
// remove the old items
|
// remove the old items
|
||||||
wxArrayString deletedLabels;
|
wxArrayString deletedLabels;
|
||||||
wxArrayPtrVoid deletedData;
|
|
||||||
#if wxUSE_CHECKLISTBOX
|
#if wxUSE_CHECKLISTBOX
|
||||||
wxArrayInt deletedChecks;
|
wxArrayInt deletedChecks;
|
||||||
#endif
|
#endif
|
||||||
@@ -446,9 +448,6 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
|||||||
wxString str(GET_REAL_LABEL(label->label),*wxConvCurrent);
|
wxString str(GET_REAL_LABEL(label->label),*wxConvCurrent);
|
||||||
deletedLabels.Add(str);
|
deletedLabels.Add(str);
|
||||||
|
|
||||||
// save data
|
|
||||||
deletedData.Add(m_clientData.Item(n));
|
|
||||||
|
|
||||||
#if wxUSE_CHECKLISTBOX
|
#if wxUSE_CHECKLISTBOX
|
||||||
// save check state
|
// save check state
|
||||||
if ( m_hasCheckBoxes )
|
if ( m_hasCheckBoxes )
|
||||||
@@ -458,33 +457,28 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
|||||||
#endif // wxUSE_CHECKLISTBOX
|
#endif // wxUSE_CHECKLISTBOX
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't delete contents, the data will be reappended soon
|
|
||||||
m_clientData.Clear();
|
|
||||||
|
|
||||||
size_t nDeletedCount = n;
|
size_t nDeletedCount = n;
|
||||||
|
|
||||||
gtk_list_clear_items( m_list, pos, length );
|
gtk_list_clear_items( m_list, pos, length );
|
||||||
|
|
||||||
// now append the new items
|
// now append the new items
|
||||||
|
wxNode *node = m_clientData.Item(pos);
|
||||||
for ( n = 0; n < nItems; n++ )
|
for ( n = 0; n < nItems; n++ )
|
||||||
{
|
{
|
||||||
AppendWithoutSorting(items[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
|
// 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++ )
|
for ( n = 0; n < nDeletedCount; n++ )
|
||||||
{
|
{
|
||||||
AppendWithoutSorting(deletedLabels[n]);
|
AppendWithoutSorting(deletedLabels[n]);
|
||||||
|
|
||||||
m_clientData.Append((wxObject *)NULL);
|
// the data is already correct - the indices have been rearranged in
|
||||||
|
// such manner that we now correspond to the same node as before
|
||||||
if ( m_clientDataItemsType == ClientData_Object )
|
|
||||||
SetClientObject(n, (wxClientData *)deletedData[n]);
|
|
||||||
else if ( m_clientDataItemsType == ClientData_Void )
|
|
||||||
SetClientData(n, deletedData[n]);
|
|
||||||
|
|
||||||
#if wxUSE_CHECKLISTBOX
|
#if wxUSE_CHECKLISTBOX
|
||||||
if ( m_hasCheckBoxes )
|
if ( m_hasCheckBoxes )
|
||||||
@@ -617,32 +611,32 @@ void wxListBox::DoSetItems( const wxArrayString& items,
|
|||||||
// client data
|
// 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") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
|
||||||
|
|
||||||
wxNode *node = m_clientData.Nth( n );
|
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 );
|
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") );
|
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid listbox control") );
|
||||||
|
|
||||||
wxNode *node = m_clientData.Nth( n );
|
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();
|
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") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
|
||||||
|
|
||||||
wxNode *node = m_clientData.Nth( n );
|
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();
|
wxClientData *cd = (wxClientData*) node->Data();
|
||||||
delete cd;
|
delete cd;
|
||||||
@@ -650,13 +644,13 @@ void wxListBox::DoSetClientObject( int n, wxClientData* clientData )
|
|||||||
node->SetData( (wxObject*) 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") );
|
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid listbox control") );
|
||||||
|
|
||||||
wxNode *node = m_clientData.Nth( n );
|
wxNode *node = m_clientData.Nth( n );
|
||||||
wxCHECK_MSG( node, (wxClientData *)NULL,
|
wxCHECK_MSG( node, (wxClientData *)NULL,
|
||||||
wxT("invalid index in wxListBox::DoGetClientObject") );
|
wxT("invalid index in wxListBox::DoGetItemClientObject") );
|
||||||
|
|
||||||
return (wxClientData*) node->Data();
|
return (wxClientData*) node->Data();
|
||||||
}
|
}
|
||||||
@@ -667,8 +661,18 @@ void wxListBox::Clear()
|
|||||||
|
|
||||||
gtk_list_clear_items( m_list, 0, Number() );
|
gtk_list_clear_items( m_list, 0, Number() );
|
||||||
|
|
||||||
if ( m_clientDataItemsType == ClientData_Object )
|
if ( HasClientObjectData() )
|
||||||
m_clientData.DeleteContents(TRUE);
|
{
|
||||||
|
// 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();
|
m_clientData.Clear();
|
||||||
|
|
||||||
if ( m_strings )
|
if ( m_strings )
|
||||||
|
@@ -46,9 +46,17 @@ static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *
|
|||||||
if (g_blockEventsOnDrag) return;
|
if (g_blockEventsOnDrag) return;
|
||||||
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
|
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
|
||||||
event.SetInt( choice->GetSelection() );
|
int n = choice->GetSelection();
|
||||||
|
|
||||||
|
event.SetInt( n );
|
||||||
event.SetString( choice->GetStringSelection() );
|
event.SetString( choice->GetStringSelection() );
|
||||||
event.SetEventObject(choice);
|
event.SetEventObject(choice);
|
||||||
|
|
||||||
|
if ( choice->HasClientObjectData() )
|
||||||
|
event.SetClientObject( choice->GetClientObject(n) );
|
||||||
|
else if ( choice->HasClientUntypedData() )
|
||||||
|
event.SetClientData( choice->GetClientData(n) );
|
||||||
|
|
||||||
choice->GetEventHandler()->ProcessEvent(event);
|
choice->GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,32 +142,32 @@ int wxChoice::DoAppend( const wxString &item )
|
|||||||
return AppendHelper(menu, 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") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
|
||||||
|
|
||||||
wxNode *node = m_clientList.Nth( n );
|
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 );
|
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") );
|
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid choice control") );
|
||||||
|
|
||||||
wxNode *node = m_clientList.Nth( n );
|
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();
|
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") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
|
||||||
|
|
||||||
wxNode *node = m_clientList.Nth( n );
|
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();
|
wxClientData *cd = (wxClientData*) node->Data();
|
||||||
delete cd;
|
delete cd;
|
||||||
@@ -167,13 +175,13 @@ void wxChoice::DoSetClientObject( int n, wxClientData* clientData )
|
|||||||
node->SetData( (wxObject*) 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") );
|
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid choice control") );
|
||||||
|
|
||||||
wxNode *node = m_clientList.Nth( n );
|
wxNode *node = m_clientList.Nth( n );
|
||||||
wxCHECK_MSG( node, (wxClientData *)NULL,
|
wxCHECK_MSG( node, (wxClientData *)NULL,
|
||||||
wxT("invalid index in wxChoice::DoGetClientObject") );
|
wxT("invalid index in wxChoice::DoGetItemClientObject") );
|
||||||
|
|
||||||
return (wxClientData*) node->Data();
|
return (wxClientData*) node->Data();
|
||||||
}
|
}
|
||||||
@@ -186,8 +194,18 @@ void wxChoice::Clear()
|
|||||||
GtkWidget *menu = gtk_menu_new();
|
GtkWidget *menu = gtk_menu_new();
|
||||||
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
|
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
|
||||||
|
|
||||||
if ( m_clientDataItemsType == ClientData_Object )
|
if ( HasClientObjectData() )
|
||||||
m_clientList.DeleteContents(TRUE);
|
{
|
||||||
|
// 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();
|
m_clientList.Clear();
|
||||||
|
|
||||||
if ( m_strings )
|
if ( m_strings )
|
||||||
@@ -246,6 +264,13 @@ int wxChoice::GetSelection() const
|
|||||||
return -1;
|
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
|
wxString wxChoice::GetString( int n ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid choice") );
|
wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid choice") );
|
||||||
@@ -372,8 +397,7 @@ size_t wxChoice::AppendHelper(GtkWidget *menu, const wxString& item)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// can't use Insert() :-(
|
m_clientList.Insert( (wxObject*) NULL );
|
||||||
m_clientList.Append( (wxObject*) NULL );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -102,25 +102,28 @@ gtk_listbox_button_release_callback( GtkWidget * WXUNUSED(widget),
|
|||||||
|
|
||||||
if (!g_hasDoubleClicked) return FALSE;
|
if (!g_hasDoubleClicked) return FALSE;
|
||||||
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
|
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
|
||||||
event.SetEventObject( listbox );
|
event.SetEventObject( listbox );
|
||||||
|
|
||||||
wxArrayInt aSelections;
|
wxArrayInt aSelections;
|
||||||
int count = listbox->GetSelections(aSelections);
|
int n, count = listbox->GetSelections(aSelections);
|
||||||
if ( count > 0 )
|
if ( count > 0 )
|
||||||
{
|
{
|
||||||
event.m_commandInt = aSelections[0] ;
|
n = aSelections[0];
|
||||||
event.m_clientData = listbox->GetClientData( event.m_commandInt );
|
if ( listbox->HasClientObjectData() )
|
||||||
wxString str(listbox->GetString(event.m_commandInt));
|
event.SetClientObject( listbox->GetClientObject(n) );
|
||||||
if (!str.IsEmpty()) event.m_commandString = str;
|
else if ( listbox->HasClientUntypedData() )
|
||||||
}
|
event.SetClientData( listbox->GetClientData(n) );
|
||||||
else
|
event.SetString( listbox->GetString(n) );
|
||||||
{
|
}
|
||||||
event.m_commandInt = -1 ;
|
else
|
||||||
event.m_commandString.Empty();
|
{
|
||||||
}
|
n = -1;
|
||||||
|
}
|
||||||
|
|
||||||
listbox->GetEventHandler()->ProcessEvent( event );
|
event.m_commandInt = n;
|
||||||
|
|
||||||
|
listbox->GetEventHandler()->ProcessEvent( event );
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -213,14 +216,18 @@ static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox
|
|||||||
if (g_blockEventsOnDrag) return;
|
if (g_blockEventsOnDrag) return;
|
||||||
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
|
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
|
||||||
|
event.SetEventObject( listbox );
|
||||||
|
|
||||||
wxArrayInt aSelections;
|
wxArrayInt aSelections;
|
||||||
int n, count = listbox->GetSelections(aSelections);
|
int n, count = listbox->GetSelections(aSelections);
|
||||||
if ( count > 0 )
|
if ( count > 0 )
|
||||||
{
|
{
|
||||||
n = aSelections[0];
|
n = aSelections[0];
|
||||||
event.m_clientData = listbox->m_clientData.Item(n);
|
if ( listbox->HasClientObjectData() )
|
||||||
event.m_commandString = listbox->GetString(n);
|
event.SetClientObject( listbox->GetClientObject(n) );
|
||||||
|
else if ( listbox->HasClientUntypedData() )
|
||||||
|
event.SetClientData( listbox->GetClientData(n) );
|
||||||
|
event.SetString( listbox->GetString(n) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -229,8 +236,6 @@ static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox
|
|||||||
|
|
||||||
event.m_commandInt = n;
|
event.m_commandInt = n;
|
||||||
|
|
||||||
event.SetEventObject( listbox );
|
|
||||||
|
|
||||||
listbox->GetEventHandler()->ProcessEvent( event );
|
listbox->GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,8 +322,6 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
m_clientData.Append((wxObject *)NULL);
|
|
||||||
|
|
||||||
DoAppend(choices[i]);
|
DoAppend(choices[i]);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -431,7 +434,6 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
|||||||
|
|
||||||
// remove the old items
|
// remove the old items
|
||||||
wxArrayString deletedLabels;
|
wxArrayString deletedLabels;
|
||||||
wxArrayPtrVoid deletedData;
|
|
||||||
#if wxUSE_CHECKLISTBOX
|
#if wxUSE_CHECKLISTBOX
|
||||||
wxArrayInt deletedChecks;
|
wxArrayInt deletedChecks;
|
||||||
#endif
|
#endif
|
||||||
@@ -446,9 +448,6 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
|||||||
wxString str(GET_REAL_LABEL(label->label),*wxConvCurrent);
|
wxString str(GET_REAL_LABEL(label->label),*wxConvCurrent);
|
||||||
deletedLabels.Add(str);
|
deletedLabels.Add(str);
|
||||||
|
|
||||||
// save data
|
|
||||||
deletedData.Add(m_clientData.Item(n));
|
|
||||||
|
|
||||||
#if wxUSE_CHECKLISTBOX
|
#if wxUSE_CHECKLISTBOX
|
||||||
// save check state
|
// save check state
|
||||||
if ( m_hasCheckBoxes )
|
if ( m_hasCheckBoxes )
|
||||||
@@ -458,33 +457,28 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
|||||||
#endif // wxUSE_CHECKLISTBOX
|
#endif // wxUSE_CHECKLISTBOX
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't delete contents, the data will be reappended soon
|
|
||||||
m_clientData.Clear();
|
|
||||||
|
|
||||||
size_t nDeletedCount = n;
|
size_t nDeletedCount = n;
|
||||||
|
|
||||||
gtk_list_clear_items( m_list, pos, length );
|
gtk_list_clear_items( m_list, pos, length );
|
||||||
|
|
||||||
// now append the new items
|
// now append the new items
|
||||||
|
wxNode *node = m_clientData.Item(pos);
|
||||||
for ( n = 0; n < nItems; n++ )
|
for ( n = 0; n < nItems; n++ )
|
||||||
{
|
{
|
||||||
AppendWithoutSorting(items[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
|
// 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++ )
|
for ( n = 0; n < nDeletedCount; n++ )
|
||||||
{
|
{
|
||||||
AppendWithoutSorting(deletedLabels[n]);
|
AppendWithoutSorting(deletedLabels[n]);
|
||||||
|
|
||||||
m_clientData.Append((wxObject *)NULL);
|
// the data is already correct - the indices have been rearranged in
|
||||||
|
// such manner that we now correspond to the same node as before
|
||||||
if ( m_clientDataItemsType == ClientData_Object )
|
|
||||||
SetClientObject(n, (wxClientData *)deletedData[n]);
|
|
||||||
else if ( m_clientDataItemsType == ClientData_Void )
|
|
||||||
SetClientData(n, deletedData[n]);
|
|
||||||
|
|
||||||
#if wxUSE_CHECKLISTBOX
|
#if wxUSE_CHECKLISTBOX
|
||||||
if ( m_hasCheckBoxes )
|
if ( m_hasCheckBoxes )
|
||||||
@@ -617,32 +611,32 @@ void wxListBox::DoSetItems( const wxArrayString& items,
|
|||||||
// client data
|
// 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") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
|
||||||
|
|
||||||
wxNode *node = m_clientData.Nth( n );
|
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 );
|
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") );
|
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid listbox control") );
|
||||||
|
|
||||||
wxNode *node = m_clientData.Nth( n );
|
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();
|
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") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
|
||||||
|
|
||||||
wxNode *node = m_clientData.Nth( n );
|
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();
|
wxClientData *cd = (wxClientData*) node->Data();
|
||||||
delete cd;
|
delete cd;
|
||||||
@@ -650,13 +644,13 @@ void wxListBox::DoSetClientObject( int n, wxClientData* clientData )
|
|||||||
node->SetData( (wxObject*) 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") );
|
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid listbox control") );
|
||||||
|
|
||||||
wxNode *node = m_clientData.Nth( n );
|
wxNode *node = m_clientData.Nth( n );
|
||||||
wxCHECK_MSG( node, (wxClientData *)NULL,
|
wxCHECK_MSG( node, (wxClientData *)NULL,
|
||||||
wxT("invalid index in wxListBox::DoGetClientObject") );
|
wxT("invalid index in wxListBox::DoGetItemClientObject") );
|
||||||
|
|
||||||
return (wxClientData*) node->Data();
|
return (wxClientData*) node->Data();
|
||||||
}
|
}
|
||||||
@@ -667,8 +661,18 @@ void wxListBox::Clear()
|
|||||||
|
|
||||||
gtk_list_clear_items( m_list, 0, Number() );
|
gtk_list_clear_items( m_list, 0, Number() );
|
||||||
|
|
||||||
if ( m_clientDataItemsType == ClientData_Object )
|
if ( HasClientObjectData() )
|
||||||
m_clientData.DeleteContents(TRUE);
|
{
|
||||||
|
// 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();
|
m_clientData.Clear();
|
||||||
|
|
||||||
if ( m_strings )
|
if ( m_strings )
|
||||||
|
@@ -104,11 +104,25 @@ void wxChoice::Delete(int n)
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( n < GetCount(), wxT("invalid item index in wxChoice::Delete") );
|
wxCHECK_RET( n < GetCount(), wxT("invalid item index in wxChoice::Delete") );
|
||||||
|
|
||||||
|
if ( HasClientObjectData() )
|
||||||
|
{
|
||||||
|
delete GetClientObject(n);
|
||||||
|
}
|
||||||
|
|
||||||
SendMessage(GetHwnd(), CB_DELETESTRING, n, 0);
|
SendMessage(GetHwnd(), CB_DELETESTRING, n, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::Clear()
|
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);
|
SendMessage(GetHwnd(), CB_RESETCONTENT, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,10 +171,20 @@ int wxChoice::FindString(const wxString& s) const
|
|||||||
#endif // Watcom/!Watcom
|
#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
|
wxString wxChoice::GetString(int n) const
|
||||||
{
|
{
|
||||||
size_t len = (size_t)::SendMessage(GetHwnd(), CB_GETLBTEXTLEN, n, 0);
|
size_t len = (size_t)::SendMessage(GetHwnd(), CB_GETLBTEXTLEN, n, 0);
|
||||||
wxString str = "";
|
wxString str;
|
||||||
if (len) {
|
if (len) {
|
||||||
if ( ::SendMessage(GetHwnd(), CB_GETLBTEXT, n,
|
if ( ::SendMessage(GetHwnd(), CB_GETLBTEXT, n,
|
||||||
(LPARAM)str.GetWriteBuf(len)) == CB_ERR ) {
|
(LPARAM)str.GetWriteBuf(len)) == CB_ERR ) {
|
||||||
@@ -176,7 +200,7 @@ wxString wxChoice::GetString(int n) const
|
|||||||
// client data
|
// 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 )
|
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);
|
LPARAM rc = SendMessage(GetHwnd(), CB_GETITEMDATA, n, 0);
|
||||||
if ( rc == CB_ERR )
|
if ( rc == CB_ERR )
|
||||||
@@ -198,14 +222,14 @@ void* wxChoice::DoGetClientData( int n ) const
|
|||||||
return (void *)rc;
|
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,
|
wxCHECK_RET( N >= 0 && N < m_noItems,
|
||||||
wxT("invalid index in wxListBox::Delete") );
|
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);
|
SendMessage(GetHwnd(), LB_DELETESTRING, N, 0);
|
||||||
m_noItems--;
|
m_noItems--;
|
||||||
|
|
||||||
@@ -343,8 +353,6 @@ int wxListBox::FindString(const wxString& s) const
|
|||||||
|
|
||||||
void wxListBox::Clear()
|
void wxListBox::Clear()
|
||||||
{
|
{
|
||||||
ListBox_ResetContent(GetHwnd());
|
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
size_t uiCount = m_aItems.Count();
|
size_t uiCount = m_aItems.Count();
|
||||||
while ( uiCount-- != 0 ) {
|
while ( uiCount-- != 0 ) {
|
||||||
@@ -352,7 +360,17 @@ void wxListBox::Clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_aItems.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;
|
m_noItems = 0;
|
||||||
SetHorizontalExtent();
|
SetHorizontalExtent();
|
||||||
@@ -381,12 +399,12 @@ bool wxListBox::IsSelected(int N) const
|
|||||||
return SendMessage(GetHwnd(), LB_GETSEL, N, 0) == 0 ? FALSE : TRUE;
|
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,
|
wxCHECK_MSG( n >= 0 && n < m_noItems, NULL,
|
||||||
wxT("invalid index in wxListBox::GetClientData") );
|
wxT("invalid index in wxListBox::GetClientData") );
|
||||||
@@ -394,12 +412,12 @@ void *wxListBox::DoGetClientData(int n) const
|
|||||||
return (void *)SendMessage(GetHwnd(), LB_GETITEMDATA, n, 0);
|
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,
|
wxCHECK_RET( n >= 0 && n < m_noItems,
|
||||||
wxT("invalid index in wxListBox::SetClientData") );
|
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!
|
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE B32.T!
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -115,6 +115,7 @@ COMMONOBJS = \
|
|||||||
$(MSWDIR)\cmndata.obj \
|
$(MSWDIR)\cmndata.obj \
|
||||||
$(MSWDIR)\config.obj \
|
$(MSWDIR)\config.obj \
|
||||||
$(MSWDIR)\ctrlcmn.obj \
|
$(MSWDIR)\ctrlcmn.obj \
|
||||||
|
$(MSWDIR)\ctrlsub.obj \
|
||||||
$(MSWDIR)\date.obj \
|
$(MSWDIR)\date.obj \
|
||||||
$(MSWDIR)\datstrm.obj \
|
$(MSWDIR)\datstrm.obj \
|
||||||
$(MSWDIR)\db.obj \
|
$(MSWDIR)\db.obj \
|
||||||
@@ -541,6 +542,8 @@ $(MSWDIR)\config.obj: $(COMMDIR)\config.$(SRCSUFF)
|
|||||||
|
|
||||||
$(MSWDIR)\ctrlcmn.obj: $(COMMDIR)\ctrlcmn.$(SRCSUFF)
|
$(MSWDIR)\ctrlcmn.obj: $(COMMDIR)\ctrlcmn.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(MSWDIR)\ctrlsub.obj: $(COMMDIR)\ctrlsub.$(SRCSUFF)
|
||||||
|
|
||||||
$(MSWDIR)\date.obj: $(COMMDIR)\date.$(SRCSUFF)
|
$(MSWDIR)\date.obj: $(COMMDIR)\date.$(SRCSUFF)
|
||||||
|
|
||||||
$(MSWDIR)\datstrm.obj: $(COMMDIR)\datstrm.$(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!
|
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BCC.T!
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -106,6 +106,7 @@ COMMONOBJS = \
|
|||||||
$(MSWDIR)\cmndata.obj \
|
$(MSWDIR)\cmndata.obj \
|
||||||
$(MSWDIR)\config.obj \
|
$(MSWDIR)\config.obj \
|
||||||
$(MSWDIR)\ctrlcmn.obj \
|
$(MSWDIR)\ctrlcmn.obj \
|
||||||
|
$(MSWDIR)\ctrlsub.obj \
|
||||||
$(MSWDIR)\date.obj \
|
$(MSWDIR)\date.obj \
|
||||||
$(MSWDIR)\datstrm.obj \
|
$(MSWDIR)\datstrm.obj \
|
||||||
$(MSWDIR)\db.obj \
|
$(MSWDIR)\db.obj \
|
||||||
@@ -449,6 +450,8 @@ $(MSWDIR)\config.obj: $(COMMDIR)\config.$(SRCSUFF)
|
|||||||
|
|
||||||
$(MSWDIR)\ctrlcmn.obj: $(COMMDIR)\ctrlcmn.$(SRCSUFF)
|
$(MSWDIR)\ctrlcmn.obj: $(COMMDIR)\ctrlcmn.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(MSWDIR)\ctrlsub.obj: $(COMMDIR)\ctrlsub.$(SRCSUFF)
|
||||||
|
|
||||||
$(MSWDIR)\date.obj: $(COMMDIR)\date.$(SRCSUFF)
|
$(MSWDIR)\date.obj: $(COMMDIR)\date.$(SRCSUFF)
|
||||||
|
|
||||||
$(MSWDIR)\datstrm.obj: $(COMMDIR)\datstrm.$(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!
|
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE DOS.T!
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -93,6 +93,7 @@ COMMONOBJS = \
|
|||||||
$(COMMDIR)\cmndata.obj \
|
$(COMMDIR)\cmndata.obj \
|
||||||
$(COMMDIR)\config.obj \
|
$(COMMDIR)\config.obj \
|
||||||
$(COMMDIR)\ctrlcmn.obj \
|
$(COMMDIR)\ctrlcmn.obj \
|
||||||
|
$(COMMDIR)\ctrlsub.obj \
|
||||||
$(COMMDIR)\date.obj \
|
$(COMMDIR)\date.obj \
|
||||||
$(COMMDIR)\datstrm.obj \
|
$(COMMDIR)\datstrm.obj \
|
||||||
$(COMMDIR)\db.obj \
|
$(COMMDIR)\db.obj \
|
||||||
@@ -711,6 +712,11 @@ $(COMMDIR)/ctrlcmn.obj: $*.$(SRCSUFF)
|
|||||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||||
<<
|
<<
|
||||||
|
|
||||||
|
$(COMMDIR)/ctrlsub.obj: $*.$(SRCSUFF)
|
||||||
|
cl @<<
|
||||||
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
$(COMMDIR)/date.obj: $*.$(SRCSUFF)
|
$(COMMDIR)/date.obj: $*.$(SRCSUFF)
|
||||||
cl @<<
|
cl @<<
|
||||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
$(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!
|
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE G95.T!
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -65,6 +65,7 @@ COMMONOBJS = \
|
|||||||
$(COMMDIR)/cmndata.$(OBJSUFF) \
|
$(COMMDIR)/cmndata.$(OBJSUFF) \
|
||||||
$(COMMDIR)/config.$(OBJSUFF) \
|
$(COMMDIR)/config.$(OBJSUFF) \
|
||||||
$(COMMDIR)/ctrlcmn.$(OBJSUFF) \
|
$(COMMDIR)/ctrlcmn.$(OBJSUFF) \
|
||||||
|
$(COMMDIR)/ctrlsub.$(OBJSUFF) \
|
||||||
$(COMMDIR)/date.$(OBJSUFF) \
|
$(COMMDIR)/date.$(OBJSUFF) \
|
||||||
$(COMMDIR)/datstrm.$(OBJSUFF) \
|
$(COMMDIR)/datstrm.$(OBJSUFF) \
|
||||||
$(COMMDIR)/db.$(OBJSUFF) \
|
$(COMMDIR)/db.$(OBJSUFF) \
|
||||||
@@ -258,6 +259,15 @@ MSWOBJS = \
|
|||||||
$(MSWDIR)/window.$(OBJSUFF) \
|
$(MSWDIR)/window.$(OBJSUFF) \
|
||||||
$(MSWDIR)/xpmhand.$(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 = \
|
ZLIBOBJS = \
|
||||||
$(ZLIBDIR)/adler32.$(OBJSUFF) \
|
$(ZLIBDIR)/adler32.$(OBJSUFF) \
|
||||||
$(ZLIBDIR)/compress.$(OBJSUFF) \
|
$(ZLIBDIR)/compress.$(OBJSUFF) \
|
||||||
@@ -353,7 +363,20 @@ XPMOBJECTS = $(XPMDIR)/crbuffri.o\
|
|||||||
$(XPMDIR)/wrffrp.o $(XPMDIR)/wrffri.o
|
$(XPMDIR)/wrffrp.o $(XPMDIR)/wrffri.o
|
||||||
|
|
||||||
OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) \
|
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)
|
$(JPEGOBJS) $(PNGOBJS) $(ZLIBOBJS) # $(XPMOBJECTS)
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) \
|
||||||
|
$(JPEGOBJS) $(PNGOBJS) $(ZLIBOBJS) # $(XPMOBJECTS)
|
||||||
|
endif
|
||||||
|
|
||||||
all: $(OBJECTS) $(WXLIB)
|
all: $(OBJECTS) $(WXLIB)
|
||||||
|
|
||||||
@@ -403,21 +426,21 @@ $(COMMDIR)/lex_yy.c: $(COMMDIR)/doslex.c
|
|||||||
# mv y.tab.c $(COMMDIR)/y_tab.c
|
# mv y.tab.c $(COMMDIR)/y_tab.c
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-erase *.o
|
rm -f *.o
|
||||||
-erase *.bak
|
rm -f *.bak
|
||||||
-erase core
|
rm -f core
|
||||||
-erase ..\common\y_tab.c
|
rm -f ..\common\y_tab.c
|
||||||
-erase ..\common\lex_yy.c
|
rm -f ..\common\lex_yy.c
|
||||||
-erase ..\common\*.o
|
rm -f ..\common\*.o
|
||||||
-erase ..\common\*.bak
|
rm -f ..\common\*.bak
|
||||||
-erase ..\generic\*.o
|
rm -f ..\generic\*.o
|
||||||
-erase ..\generic\*.bak
|
rm -f ..\generic\*.bak
|
||||||
-erase ..\html\*.o
|
rm -f ..\html\*.o
|
||||||
-erase ..\png\*.o
|
rm -f ..\png\*.o
|
||||||
-erase ..\png\*.bak
|
rm -f ..\png\*.bak
|
||||||
-erase ..\zlib\*.o
|
rm -f ..\zlib\*.o
|
||||||
-erase ..\zlib\*.bak
|
rm -f ..\zlib\*.bak
|
||||||
-erase ..\jpeg\*.o
|
rm -f ..\jpeg\*.o
|
||||||
-erase ..\..\lib\libwx.a
|
rm -f ..\..\lib\libwx.a
|
||||||
|
|
||||||
cleanall: clean
|
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!
|
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE SC.T!
|
||||||
|
|
||||||
# Symantec C++ makefile for the msw objects
|
# Symantec C++ makefile for the msw objects
|
||||||
@@ -54,6 +54,7 @@ COMMONOBJS = \
|
|||||||
$(COMMDIR)\cmndata.obj \
|
$(COMMDIR)\cmndata.obj \
|
||||||
$(COMMDIR)\config.obj \
|
$(COMMDIR)\config.obj \
|
||||||
$(COMMDIR)\ctrlcmn.obj \
|
$(COMMDIR)\ctrlcmn.obj \
|
||||||
|
$(COMMDIR)\ctrlsub.obj \
|
||||||
$(COMMDIR)\date.obj \
|
$(COMMDIR)\date.obj \
|
||||||
$(COMMDIR)\datstrm.obj \
|
$(COMMDIR)\datstrm.obj \
|
||||||
$(COMMDIR)\db.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!
|
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE VC.T!
|
||||||
|
|
||||||
# File: makefile.vc
|
# File: makefile.vc
|
||||||
@@ -132,6 +132,7 @@ COMMONOBJS = \
|
|||||||
..\common\$D\cmndata.obj \
|
..\common\$D\cmndata.obj \
|
||||||
..\common\$D\config.obj \
|
..\common\$D\config.obj \
|
||||||
..\common\$D\ctrlcmn.obj \
|
..\common\$D\ctrlcmn.obj \
|
||||||
|
..\common\$D\ctrlsub.obj \
|
||||||
..\common\$D\date.obj \
|
..\common\$D\date.obj \
|
||||||
..\common\$D\datstrm.obj \
|
..\common\$D\datstrm.obj \
|
||||||
..\common\$D\db.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!
|
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE WAT.T!
|
||||||
|
|
||||||
#!/binb/wmake.exe
|
#!/binb/wmake.exe
|
||||||
@@ -81,6 +81,7 @@ COMMONOBJS = &
|
|||||||
cmndata.obj &
|
cmndata.obj &
|
||||||
config.obj &
|
config.obj &
|
||||||
ctrlcmn.obj &
|
ctrlcmn.obj &
|
||||||
|
ctrlsub.obj &
|
||||||
date.obj &
|
date.obj &
|
||||||
datstrm.obj &
|
datstrm.obj &
|
||||||
db.obj &
|
db.obj &
|
||||||
@@ -579,6 +580,9 @@ config.obj: $(COMMDIR)\config.cpp
|
|||||||
ctrlcmn.obj: $(COMMDIR)\ctrlcmn.cpp
|
ctrlcmn.obj: $(COMMDIR)\ctrlcmn.cpp
|
||||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||||
|
|
||||||
|
ctrlsub.obj: $(COMMDIR)\ctrlsub.cpp
|
||||||
|
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||||
|
|
||||||
date.obj: $(COMMDIR)\date.cpp
|
date.obj: $(COMMDIR)\date.cpp
|
||||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user