1. wxChoice and wxComboBox support client data under MSW
2. control creation streamlined under MSW git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3157 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -29,6 +29,10 @@
|
||||
#include "wx/colour.h"
|
||||
#include "wx/region.h"
|
||||
|
||||
#if wxUSE_VALIDATORS
|
||||
#include "wx/validate.h" // defines wxDefaultValidator
|
||||
#endif // wxUSE_VALIDATORS
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
#include "wx/accel.h"
|
||||
#endif // wxUSE_ACCEL
|
||||
@@ -48,7 +52,6 @@ class WXDLLEXPORT wxLayoutConstraints;
|
||||
class WXDLLEXPORT wxResourceTable;
|
||||
class WXDLLEXPORT wxSizer;
|
||||
class WXDLLEXPORT wxToolTip;
|
||||
class WXDLLEXPORT wxValidator;
|
||||
class WXDLLEXPORT wxWindowBase;
|
||||
class WXDLLEXPORT wxWindow;
|
||||
|
||||
@@ -117,6 +120,9 @@ public:
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
#if wxUSE_VALIDATORS
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
#endif // wxUSE_VALIDATORS
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
virtual ~wxWindowBase();
|
||||
@@ -371,18 +377,12 @@ public:
|
||||
// each window may have associated client data: either a pointer to
|
||||
// wxClientData object in which case it is managed by the window (i.e.
|
||||
// it will delete the data when it's destroyed) or an untyped pointer
|
||||
// which won't be deleted by the window
|
||||
virtual void SetClientObject( wxClientData *data )
|
||||
{
|
||||
if ( m_clientObject )
|
||||
delete m_clientObject;
|
||||
// which won't be deleted by the window - but not both of them
|
||||
void SetClientObject( wxClientData *data ) { DoSetClientObject(data); }
|
||||
wxClientData *GetClientObject() const { return DoGetClientObject(); }
|
||||
|
||||
m_clientObject = data;
|
||||
}
|
||||
virtual wxClientData *GetClientObject() const { return m_clientObject; }
|
||||
|
||||
virtual void SetClientData( void *data ) { m_clientData = data; }
|
||||
virtual void *GetClientData() const { return m_clientData; }
|
||||
void SetClientData( void *data ) { DoSetClientData(data); }
|
||||
void *GetClientData() const { return DoGetClientData(); }
|
||||
|
||||
// dialog oriented functions
|
||||
// -------------------------
|
||||
@@ -695,9 +695,14 @@ protected:
|
||||
|
||||
// user data associated with the window: either an object which will be
|
||||
// deleted by the window when it's deleted or some raw pointer which we do
|
||||
// nothing with
|
||||
wxClientData *m_clientObject;
|
||||
void *m_clientData;
|
||||
// nothing with - only one type of data can be used with the given window
|
||||
// (i.e. you cannot set the void data and then associate the window with
|
||||
// wxClientData or vice versa)
|
||||
union
|
||||
{
|
||||
wxClientData *m_clientObject;
|
||||
void *m_clientData;
|
||||
};
|
||||
|
||||
// the tooltip for this window (may be NULL)
|
||||
#if wxUSE_TOOLTIPS
|
||||
@@ -777,6 +782,21 @@ protected:
|
||||
|
||||
virtual bool DoPopupMenu( wxMenu *menu, int x, int y ) = 0;
|
||||
|
||||
// client data accessors
|
||||
virtual void DoSetClientObject( wxClientData *data );
|
||||
virtual wxClientData *DoGetClientObject() const;
|
||||
|
||||
virtual void DoSetClientData( void *data );
|
||||
virtual void *DoGetClientData() const;
|
||||
|
||||
// what kind of data do we have?
|
||||
enum wxClientDataType
|
||||
{
|
||||
ClientData_None, // we don't know yet because we don't have it at all
|
||||
ClientData_Object, // our client data is typed and we own it
|
||||
ClientData_Void // client data is untyped and we don't own it
|
||||
} m_clientDataType;
|
||||
|
||||
private:
|
||||
// contains the last id generated by NewControlId
|
||||
static int ms_lastControlId;
|
||||
|
Reference in New Issue
Block a user