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:
@@ -1,18 +1,127 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/choice.h
|
||||
// Purpose: wxChoice class interface
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 26.07.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CHOICE_H_BASE_
|
||||
#define _WX_CHOICE_H_BASE_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "choicebase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/control.h" // the base class
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// global data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxChoiceNameStr;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxChoice allows to select one of a non-modifiable list of strings
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxChoiceBase : public wxControl
|
||||
{
|
||||
public:
|
||||
// ctor
|
||||
wxChoiceBase() { m_clientDataItemsType = ClientData_None; }
|
||||
|
||||
// add a new item to the list
|
||||
// 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)
|
||||
{ DoAppend(item); SetClientData(GetCount() - 1, clientData); }
|
||||
// with client data which will be deleted by the control
|
||||
void Append(const wxString &item, wxClientData* clientData)
|
||||
{ DoAppend(item); SetClientObject(GetCount() - 1, 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;
|
||||
// set selection to the current item, returns TRUE if ok
|
||||
virtual bool SetStringSelection(const wxString& sel);
|
||||
|
||||
// accessors to the list of strings
|
||||
// get the number of items in the list of strings
|
||||
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
|
||||
// most platforms, they do nothing by default)
|
||||
virtual void SetColumns(int WXUNUSED(n) = 1 ) { }
|
||||
virtual int GetColumns() const { return 1 ; }
|
||||
|
||||
// client data
|
||||
// untyped (isn't deleted by the control)
|
||||
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(); }
|
||||
|
||||
private:
|
||||
// pure virtuals to implement in the derived classes
|
||||
virtual void 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 type of the client data for the items
|
||||
wxClientDataType m_clientDataItemsType;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include the platform-dependent class definition
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/choice.h"
|
||||
#include "wx/msw/choice.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/choice.h"
|
||||
#include "wx/motif/choice.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/choice.h"
|
||||
#include "wx/gtk/choice.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/choice.h"
|
||||
#include "wx/qt/choice.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/choice.h"
|
||||
#include "wx/mac/choice.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/choice.h"
|
||||
#include "wx/stubs/choice.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -1,21 +1,69 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/control.h
|
||||
// Purpose: wxControl common interface
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 26.07.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CONTROL_H_BASE_
|
||||
#define _WX_CONTROL_H_BASE_
|
||||
|
||||
// all classes derived from wxControl need the validators
|
||||
#include "wx/validate.h"
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "choicebase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/window.h" // base class
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxControl is the base class for all controls
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxControlBase : public wxWindow
|
||||
{
|
||||
public:
|
||||
// simulates the event of given type (i.e. wxButton::Command() is just as
|
||||
// if the button was clicked)
|
||||
virtual void Command(wxCommandEvent &event);
|
||||
|
||||
protected:
|
||||
// creates the controls (invokes wxWindowBase::CreateBase) and adds it to
|
||||
// the list of parents children
|
||||
bool CreateControl(wxWindowBase *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name);
|
||||
|
||||
// inherit colour and font settings from the parent window
|
||||
void InheritAttributes();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include platform-dependent wxControl declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/control.h"
|
||||
#include "wx/msw/control.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/control.h"
|
||||
#include "wx/motif/control.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/control.h"
|
||||
#include "wx/gtk/control.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/control.h"
|
||||
#include "wx/qt/control.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/control.h"
|
||||
#include "wx/mac/control.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/control.h"
|
||||
#include "wx/stubs/control.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -4,7 +4,7 @@
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __GTKCONTROLH__
|
||||
@@ -29,27 +29,27 @@ class wxControl;
|
||||
// wxControl
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxControl: public wxWindow
|
||||
class wxControl : public wxControlBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxControl)
|
||||
DECLARE_DYNAMIC_CLASS(wxControl)
|
||||
|
||||
public:
|
||||
wxControl();
|
||||
wxControl( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
||||
long style = 0, const wxString &name = wxPanelNameStr );
|
||||
|
||||
virtual void Command( wxCommandEvent &event );
|
||||
wxControl();
|
||||
wxControl( wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString &name = wxPanelNameStr );
|
||||
|
||||
// this function will filter out '&' characters and will put the accelerator
|
||||
// char (the one immediately after '&') into m_chAccel (@@ not yet)
|
||||
virtual void SetLabel( const wxString &label );
|
||||
virtual wxString GetLabel() const;
|
||||
|
||||
// char (the one immediately after '&') into m_chAccel (TODO not yet)
|
||||
virtual void SetLabel( const wxString &label );
|
||||
virtual wxString GetLabel() const;
|
||||
|
||||
protected:
|
||||
wxString m_label;
|
||||
char m_chAccel; // enabled to avoid breaking binary compatibility later on
|
||||
|
||||
wxString m_label;
|
||||
char m_chAccel; // enabled to avoid breaking binary compatibility later on
|
||||
};
|
||||
|
||||
#endif // __GTKCONTROLH__
|
||||
|
@@ -4,7 +4,7 @@
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __GTKCONTROLH__
|
||||
@@ -29,27 +29,27 @@ class wxControl;
|
||||
// wxControl
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxControl: public wxWindow
|
||||
class wxControl : public wxControlBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxControl)
|
||||
DECLARE_DYNAMIC_CLASS(wxControl)
|
||||
|
||||
public:
|
||||
wxControl();
|
||||
wxControl( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
||||
long style = 0, const wxString &name = wxPanelNameStr );
|
||||
|
||||
virtual void Command( wxCommandEvent &event );
|
||||
wxControl();
|
||||
wxControl( wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString &name = wxPanelNameStr );
|
||||
|
||||
// this function will filter out '&' characters and will put the accelerator
|
||||
// char (the one immediately after '&') into m_chAccel (@@ not yet)
|
||||
virtual void SetLabel( const wxString &label );
|
||||
virtual wxString GetLabel() const;
|
||||
|
||||
// char (the one immediately after '&') into m_chAccel (TODO not yet)
|
||||
virtual void SetLabel( const wxString &label );
|
||||
virtual wxString GetLabel() const;
|
||||
|
||||
protected:
|
||||
wxString m_label;
|
||||
char m_chAccel; // enabled to avoid breaking binary compatibility later on
|
||||
|
||||
wxString m_label;
|
||||
char m_chAccel; // enabled to avoid breaking binary compatibility later on
|
||||
};
|
||||
|
||||
#endif // __GTKCONTROLH__
|
||||
|
@@ -2,82 +2,80 @@
|
||||
// Name: choice.h
|
||||
// Purpose: wxChoice class
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Modified by: Vadim Zeitlin to derive from wxChoiceBase
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CHOICE_H_
|
||||
#define _WX_CHOICE_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "choice.h"
|
||||
#pragma interface "choice.h"
|
||||
#endif
|
||||
|
||||
#include "wx/control.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxChoiceNameStr;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Choice item
|
||||
class WXDLLEXPORT wxChoice: public wxControl
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxChoice : public wxChoiceBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxChoice)
|
||||
|
||||
public:
|
||||
wxChoice() { m_noStrings = 0; }
|
||||
// ctors
|
||||
wxChoice() { }
|
||||
|
||||
wxChoice(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxChoiceNameStr)
|
||||
wxChoice(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxChoiceNameStr)
|
||||
{
|
||||
Create(parent, id, pos, size, n, choices, style, validator, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxChoiceNameStr);
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
int n = 0, const wxString choices[] = NULL,
|
||||
long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxChoiceNameStr);
|
||||
|
||||
virtual void Append(const wxString& item);
|
||||
// implement base class pure virtuals
|
||||
virtual void DoAppend(const wxString& item);
|
||||
virtual void Delete(int n);
|
||||
virtual void Clear();
|
||||
virtual int GetSelection() const ;
|
||||
|
||||
virtual int GetCount() const;
|
||||
virtual int GetSelection() const;
|
||||
virtual void SetSelection(int n);
|
||||
|
||||
virtual int FindString(const wxString& s) const;
|
||||
virtual wxString GetString(int n) const ;
|
||||
virtual wxString GetStringSelection() const ;
|
||||
virtual bool SetStringSelection(const wxString& sel);
|
||||
|
||||
virtual int Number() const { return m_noStrings; }
|
||||
virtual void Command(wxCommandEvent& event);
|
||||
virtual wxString GetString(int n) const;
|
||||
|
||||
// MSW only
|
||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||
|
||||
virtual void SetColumns(int WXUNUSED(n) = 1 ) { /* No effect */ }
|
||||
virtual int GetColumns() const { return 1 ; }
|
||||
|
||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
protected:
|
||||
int m_noStrings;
|
||||
virtual void DoSetClientData( int n, void* clientData );
|
||||
virtual void* DoGetClientData( int n ) const;
|
||||
virtual void DoSetClientObject( int n, wxClientData* clientData );
|
||||
virtual wxClientData* DoGetClientObject( int n ) const;
|
||||
|
||||
// MSW implementation
|
||||
virtual wxSize DoGetBestSize();
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_CHOICE_H_
|
||||
#endif // _WX_CHOICE_H_
|
||||
|
@@ -16,11 +16,8 @@
|
||||
#pragma interface "control.h"
|
||||
#endif
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/list.h"
|
||||
|
||||
// General item class
|
||||
class WXDLLEXPORT wxControl : public wxWindow
|
||||
class WXDLLEXPORT wxControl : public wxControlBase
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxControl)
|
||||
|
||||
@@ -29,7 +26,10 @@ public:
|
||||
virtual ~wxControl();
|
||||
|
||||
// Simulates an event
|
||||
bool Command(wxCommandEvent& event) { return ProcessCommand(event); }
|
||||
virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
// Calls the callback and appropriate event handlers
|
||||
bool ProcessCommand(wxCommandEvent& event);
|
||||
@@ -67,9 +67,17 @@ protected:
|
||||
|
||||
protected:
|
||||
// For controls like radiobuttons which are really composite
|
||||
wxList m_subControls;
|
||||
wxList m_subControls;
|
||||
|
||||
virtual wxSize DoGetBestSize();
|
||||
virtual wxSize DoGetBestSize();
|
||||
|
||||
// create the control of the given class with the given style, returns FALSE
|
||||
// if creation failed
|
||||
bool MSWCreateControl(const wxChar *classname, WXDWORD style);
|
||||
|
||||
// determine the extended styles combination for this window (may slightly
|
||||
// modify styl parameter)
|
||||
WXDWORD GetExStyle(WXDWORD& style) const;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
@@ -78,8 +86,8 @@ private:
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
inline void wxControl::Callback(const wxFunction f) { m_callback = f; };
|
||||
inline wxFont& wxControl::GetLabelFont() const { return GetFont() ; }
|
||||
inline wxFont& wxControl::GetButtonFont() const { return GetFont() ; }
|
||||
inline wxFont& wxControl::GetLabelFont() const { return GetFont(); }
|
||||
inline wxFont& wxControl::GetButtonFont() const { return GetFont(); }
|
||||
inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); }
|
||||
inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); }
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
@@ -201,9 +201,10 @@ public:
|
||||
wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const;
|
||||
|
||||
// Make a Windows extended style from the given wxWindows window style
|
||||
virtual WXDWORD MakeExtendedStyle(long style, bool eliminateBorders = TRUE);
|
||||
static WXDWORD MakeExtendedStyle(long style,
|
||||
bool eliminateBorders = TRUE);
|
||||
// Determine whether 3D effects are wanted
|
||||
virtual WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D);
|
||||
WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D) const;
|
||||
|
||||
// MSW only: TRUE if this control is part of the main control
|
||||
virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; };
|
||||
|
@@ -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