1. new wxList code
2. fixes to allow compilation at -W4 with VisualC++ 6.0 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1035 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -41,9 +41,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Eliminate double/float warnings
|
// suppress some Visual C++ warnings
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# pragma warning(disable:4244)
|
# pragma warning(disable:4244) // cobversion from double to float
|
||||||
|
# pragma warning(disable:4100) // unreferenced formal parameter
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@@ -368,7 +368,7 @@ private: \
|
|||||||
|
|
||||||
@memo declare list class 'name' containing elements of type 'T'
|
@memo declare list class 'name' containing elements of type 'T'
|
||||||
*/
|
*/
|
||||||
#define WX_DECLARE_LIST(T, name) typedef T _L##name; \
|
#define WX_DECLARE_OBJARRAY(T, name) typedef T _L##name; \
|
||||||
_WX_DECLARE_LIST(_L##name, name)
|
_WX_DECLARE_LIST(_L##name, name)
|
||||||
/**
|
/**
|
||||||
To use a list class you must
|
To use a list class you must
|
||||||
@@ -387,7 +387,7 @@ private: \
|
|||||||
|
|
||||||
@memo define (must include listimpl.cpp!) list class 'name'
|
@memo define (must include listimpl.cpp!) list class 'name'
|
||||||
*/
|
*/
|
||||||
#define WX_DEFINE_LIST(name) "don't forget to include listimpl.cpp!"
|
#define WX_DEFINE_OBJARRAY(name) "don't forget to include listimpl.cpp!"
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -345,6 +345,26 @@ class WXDLLEXPORT wxCommandEvent: public wxEvent
|
|||||||
wxClientData* m_clientObject; // Arbitrary client object
|
wxClientData* m_clientObject; // Arbitrary client object
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// this class adds a possibility to react (from the user) code to a control
|
||||||
|
// notification: allow or veto the operation being reported.
|
||||||
|
class WXDLLEXPORT wxNotifyEvent : public wxCommandEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
|
||||||
|
: wxCommandEvent(commandType, id) { m_bAllow = TRUE; }
|
||||||
|
|
||||||
|
// veto the operation (by default it's allowed)
|
||||||
|
void Veto() { m_bAllow = FALSE; }
|
||||||
|
|
||||||
|
// for implementation code only: is the operation allowed?
|
||||||
|
bool IsAllowed() const { return m_bAllow; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_bAllow;
|
||||||
|
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxCommandEvent)
|
||||||
|
};
|
||||||
|
|
||||||
// Scroll event class
|
// Scroll event class
|
||||||
/*
|
/*
|
||||||
wxEVT_SCROLL_TOP
|
wxEVT_SCROLL_TOP
|
||||||
|
@@ -169,6 +169,10 @@ public:
|
|||||||
~wxTempFile();
|
~wxTempFile();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// no copy ctor/assignment operator
|
||||||
|
wxTempFile(const wxTempFile&);
|
||||||
|
wxTempFile& operator=(const wxTempFile&);
|
||||||
|
|
||||||
wxString m_strName, // name of the file to replace in Commit()
|
wxString m_strName, // name of the file to replace in Commit()
|
||||||
m_strTemp; // temporary file name
|
m_strTemp; // temporary file name
|
||||||
wxFile m_file; // the temporary file
|
wxFile m_file; // the temporary file
|
||||||
|
@@ -353,11 +353,13 @@ extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor);
|
|||||||
|
|
||||||
class WXDLLEXPORT wxResourceCache: public wxList
|
class WXDLLEXPORT wxResourceCache: public wxList
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxResourceCache)
|
|
||||||
public:
|
public:
|
||||||
wxResourceCache();
|
wxResourceCache() { }
|
||||||
wxResourceCache(const unsigned int the_key_type);
|
wxResourceCache(const unsigned int keyType) : wxList(keyType) { }
|
||||||
~wxResourceCache();
|
~wxResourceCache();
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxResourceCache)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -37,13 +37,27 @@ class wxNotebookEvent : public wxCommandEvent
|
|||||||
public:
|
public:
|
||||||
wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
|
wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
|
||||||
int nSel = -1, int nOldSel = -1)
|
int nSel = -1, int nOldSel = -1)
|
||||||
: wxCommandEvent(commandType, id) { m_nSel = nSel; m_nOldSel = nOldSel; }
|
: wxCommandEvent(commandType, id)
|
||||||
|
{
|
||||||
|
m_bAllow = TRUE;
|
||||||
|
m_nSel = nSel;
|
||||||
|
m_nOldSel = nOldSel;
|
||||||
|
}
|
||||||
|
|
||||||
// accessors
|
// accessors
|
||||||
int GetSelection() const { return m_nSel; }
|
int GetSelection() const { return m_nSel; }
|
||||||
int GetOldSelection() const { return m_nOldSel; }
|
int GetOldSelection() const { return m_nOldSel; }
|
||||||
|
|
||||||
|
// for wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING event this method may be called
|
||||||
|
// to disallow the page change
|
||||||
|
void Veto() { m_bAllow = FALSE; }
|
||||||
|
|
||||||
|
// implementation: for wxNotebook usage only
|
||||||
|
bool Allowed() const { return m_bAllow; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool m_bAllow;
|
||||||
|
|
||||||
int m_nSel, // currently selected page
|
int m_nSel, // currently selected page
|
||||||
m_nOldSel; // previously selected page
|
m_nOldSel; // previously selected page
|
||||||
|
|
||||||
|
@@ -37,13 +37,27 @@ class wxNotebookEvent : public wxCommandEvent
|
|||||||
public:
|
public:
|
||||||
wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
|
wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
|
||||||
int nSel = -1, int nOldSel = -1)
|
int nSel = -1, int nOldSel = -1)
|
||||||
: wxCommandEvent(commandType, id) { m_nSel = nSel; m_nOldSel = nOldSel; }
|
: wxCommandEvent(commandType, id)
|
||||||
|
{
|
||||||
|
m_bAllow = TRUE;
|
||||||
|
m_nSel = nSel;
|
||||||
|
m_nOldSel = nOldSel;
|
||||||
|
}
|
||||||
|
|
||||||
// accessors
|
// accessors
|
||||||
int GetSelection() const { return m_nSel; }
|
int GetSelection() const { return m_nSel; }
|
||||||
int GetOldSelection() const { return m_nOldSel; }
|
int GetOldSelection() const { return m_nOldSel; }
|
||||||
|
|
||||||
|
// for wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING event this method may be called
|
||||||
|
// to disallow the page change
|
||||||
|
void Veto() { m_bAllow = FALSE; }
|
||||||
|
|
||||||
|
// implementation: for wxNotebook usage only
|
||||||
|
bool Allowed() const { return m_bAllow; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool m_bAllow;
|
||||||
|
|
||||||
int m_nSel, // currently selected page
|
int m_nSel, // currently selected page
|
||||||
m_nOldSel; // previously selected page
|
m_nOldSel; // previously selected page
|
||||||
|
|
||||||
|
@@ -2,13 +2,26 @@
|
|||||||
// Name: list.h
|
// Name: list.h
|
||||||
// Purpose: wxList, wxStringList classes
|
// Purpose: wxList, wxStringList classes
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by: VZ at 16/11/98: WX_DECLARE_LIST() and typesafe lists added
|
||||||
// Created: 29/01/98
|
// Created: 29/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 1998 Julian Smart
|
// Copyright: (c) 1998 Julian Smart
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/*
|
||||||
|
All this is quite ugly but serves two purposes:
|
||||||
|
1. Be almost 100% compatible with old, untyped, wxList class
|
||||||
|
2. Ensure compile-time type checking for the linked lists
|
||||||
|
|
||||||
|
The idea is to have one base class (wxListBase) working with "void *" data,
|
||||||
|
but to hide these untyped functions - i.e. make them protected, so they
|
||||||
|
can only be used from derived classes which have inline member functions
|
||||||
|
working with right types. This achieves the 2nd goal. As for the first one,
|
||||||
|
we provide a special derivation of wxListBase called wxList which looks just
|
||||||
|
like the old class.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _WX_LISTH__
|
#ifndef _WX_LISTH__
|
||||||
#define _WX_LISTH__
|
#define _WX_LISTH__
|
||||||
|
|
||||||
@@ -16,133 +29,445 @@
|
|||||||
#pragma interface "list.h"
|
#pragma interface "list.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
#include "wx/debug.h"
|
||||||
#include "wx/object.h"
|
#include "wx/object.h"
|
||||||
|
|
||||||
class WXDLLEXPORT wxList;
|
// due to circular header dependencies this function has to be declared here
|
||||||
|
// (normally it's found in utils.h which includes itself list.h...)
|
||||||
|
extern char* WXDLLEXPORT copystring(const char *s);
|
||||||
|
|
||||||
#define wxKEY_NONE 0
|
class WXDLLEXPORT wxObjectListNode;
|
||||||
#define wxKEY_INTEGER 1
|
typedef wxObjectListNode wxNode;
|
||||||
#define wxKEY_STRING 2
|
|
||||||
class WXDLLEXPORT wxNode: public wxObject
|
// undef it to get rid of old, deprecated functions
|
||||||
|
#define wxLIST_COMPATIBILITY
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// constants
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
enum wxKeyType
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxNode)
|
wxKEY_NONE,
|
||||||
private:
|
wxKEY_INTEGER,
|
||||||
|
wxKEY_STRING
|
||||||
|
};
|
||||||
|
|
||||||
wxObject *data;
|
// -----------------------------------------------------------------------------
|
||||||
wxNode *next;
|
// types
|
||||||
wxNode *previous;
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
public:
|
// type of compare function for list sort operation (as in 'qsort'): it should
|
||||||
wxList *list;
|
// return a negative value, 0 or positive value if the first element is less
|
||||||
|
// than, equal or greater than the second
|
||||||
|
typedef int (*wxSortCompareFunction)(const void *elem1, const void *elem2);
|
||||||
|
|
||||||
// Optional key stuff
|
//
|
||||||
union
|
typedef int (*wxListIterateFunction)(void *current);
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// key stuff: a list may be optionally keyed on integer or string key
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
union wxListKeyValue
|
||||||
{
|
{
|
||||||
long integer;
|
long integer;
|
||||||
char *string;
|
char *string;
|
||||||
} key;
|
|
||||||
|
|
||||||
wxNode(wxList *the_list = (wxList *) NULL, wxNode *last_one = (wxNode *) NULL, wxNode *next_one = (wxNode *) NULL, wxObject *object = (wxObject *) NULL);
|
|
||||||
wxNode(wxList *the_list, wxNode *last_one, wxNode *next_one,
|
|
||||||
wxObject *object, long the_key);
|
|
||||||
wxNode(wxList *the_list, wxNode *last_one, wxNode *next_one,
|
|
||||||
wxObject *object, const char *the_key);
|
|
||||||
~wxNode(void);
|
|
||||||
|
|
||||||
inline wxNode *Next(void) const { return next; }
|
|
||||||
inline wxNode *Previous(void) const { return previous; }
|
|
||||||
inline wxObject *Data(void) const { return (wxObject *)data; }
|
|
||||||
inline void SetData(wxObject *the_data) { data = the_data; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// type of compare function for list sort operation (as in 'qsort')
|
// a struct which may contain both types of keys
|
||||||
typedef int (*wxSortCompareFunction)(const void *elem1, const void *elem2);
|
//
|
||||||
typedef int (*wxListIterateFunction)(wxObject *o);
|
// implementation note: on one hand, this class allows to have only one function
|
||||||
|
// for any keyed operation instead of 2 almost equivalent. OTOH, it's needed to
|
||||||
class WXDLLEXPORT wxList: public wxObject
|
// resolve ambiguity which we would otherwise have with wxStringList::Find() and
|
||||||
|
// wxList::Find(const char *).
|
||||||
|
class WXDLLEXPORT wxListKey
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxList)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int n;
|
// implicit ctors
|
||||||
int destroy_data;
|
wxListKey()
|
||||||
wxNode *first_node;
|
{ m_keyType = wxKEY_NONE; }
|
||||||
wxNode *last_node;
|
wxListKey(long i)
|
||||||
unsigned int key_type;
|
{ m_keyType = wxKEY_INTEGER; m_key.integer = i; }
|
||||||
|
wxListKey(const char *s)
|
||||||
|
{ m_keyType = wxKEY_STRING; m_key.string = strdup(s); }
|
||||||
|
wxListKey(const wxString& s)
|
||||||
|
{ m_keyType = wxKEY_STRING; m_key.string = strdup(s.c_str()); }
|
||||||
|
|
||||||
wxList(void);
|
// accessors
|
||||||
wxList(const unsigned int the_key_type);
|
wxKeyType GetKeyType() const { return m_keyType; }
|
||||||
wxList(int N, wxObject *Objects[]);
|
const char *GetString() const
|
||||||
wxList(wxObject *object, ...);
|
{ wxASSERT( m_keyType == wxKEY_STRING ); return m_key.string; }
|
||||||
|
long GetNumber() const
|
||||||
|
{ wxASSERT( m_keyType == wxKEY_INTEGER ); return m_key.integer; }
|
||||||
|
|
||||||
~wxList(void);
|
// comparaison
|
||||||
|
bool operator==(wxListKeyValue value) const
|
||||||
|
{
|
||||||
|
switch ( m_keyType )
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
wxFAIL_MSG("bad key type.");
|
||||||
|
// let compiler optimize the line above away in release build
|
||||||
|
// by not putting return here...
|
||||||
|
|
||||||
inline int Number(void) const { return n; }
|
case wxKEY_STRING:
|
||||||
inline int GetCount(void) const { return n; }
|
return strcmp(m_key.string, value.string) == 0;
|
||||||
|
|
||||||
// Append to end of list
|
case wxKEY_INTEGER:
|
||||||
wxNode *Append(wxObject *object);
|
return m_key.integer == value.integer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Insert at front of list
|
// dtor
|
||||||
wxNode *Insert(wxObject *object);
|
~wxListKey()
|
||||||
|
{
|
||||||
|
if ( m_keyType == wxKEY_STRING )
|
||||||
|
free(m_key.string);
|
||||||
|
}
|
||||||
|
|
||||||
// Insert before given node
|
private:
|
||||||
wxNode *Insert(wxNode *position, wxObject *object);
|
wxKeyType m_keyType;
|
||||||
|
wxListKeyValue m_key;
|
||||||
|
};
|
||||||
|
|
||||||
// Keyed append
|
// -----------------------------------------------------------------------------
|
||||||
wxNode *Append(long key, wxObject *object);
|
// wxNodeBase class is a (base for) node in a double linked list
|
||||||
wxNode *Append(const char *key, wxObject *object);
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool DeleteNode(wxNode *node);
|
class WXDLLEXPORT wxNodeBase
|
||||||
bool DeleteObject(wxObject *object); // Finds object pointer and
|
{
|
||||||
// deletes node (and object if
|
friend class wxListBase;
|
||||||
// DeleteContents is on)
|
public:
|
||||||
virtual void Clear(void); // Delete all nodes
|
// ctor
|
||||||
|
wxNodeBase(wxListBase *list = (wxListBase *)NULL,
|
||||||
|
wxNodeBase *previous = (wxNodeBase *)NULL,
|
||||||
|
wxNodeBase *next = (wxNodeBase *)NULL,
|
||||||
|
void *data = NULL,
|
||||||
|
const wxListKey& key = wxListKey());
|
||||||
|
|
||||||
inline wxNode *First(void) const { return first_node; }
|
virtual ~wxNodeBase();
|
||||||
inline wxNode *Last(void) const { return last_node; }
|
|
||||||
wxNode *Nth(int i) const; // nth node counting from 0
|
|
||||||
|
|
||||||
// Keyed search
|
// @@ no check is done that the list is really keyed on strings
|
||||||
virtual wxNode *Find(long key) const;
|
const char *GetKeyString() const { return m_key.string; }
|
||||||
virtual wxNode *Find(const char *key) const;
|
|
||||||
|
|
||||||
virtual wxNode *Member(wxObject *object) const;
|
#ifdef wxLIST_COMPATIBILITY
|
||||||
|
// compatibility methods
|
||||||
|
wxNode *Next() const { return (wxNode *)GetNext(); }
|
||||||
|
wxNode *Previous() const { return (wxNode *)GetPrevious(); }
|
||||||
|
wxObject *Data() const { return (wxObject *)GetData(); }
|
||||||
|
#endif // wxLIST_COMPATIBILITY
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// all these are going to be "overloaded" in the derived classes
|
||||||
|
wxNodeBase *GetNext() const { return m_next; }
|
||||||
|
wxNodeBase *GetPrevious() const { return m_previous; }
|
||||||
|
|
||||||
|
void *GetData() const { return m_data; }
|
||||||
|
void SetData(void *data) { m_data = data; }
|
||||||
|
|
||||||
|
virtual void DeleteData() { }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// optional key stuff
|
||||||
|
wxListKeyValue m_key;
|
||||||
|
|
||||||
|
void *m_data; // user data
|
||||||
|
wxNodeBase *m_next, // next and previous nodes in the list
|
||||||
|
*m_previous;
|
||||||
|
|
||||||
|
wxListBase *m_list; // list we belong to
|
||||||
|
};
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// a double-linked list class
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
class WXDLLEXPORT wxListBase : public wxObject
|
||||||
|
{
|
||||||
|
friend class wxNodeBase; // should be able to call DetachNode()
|
||||||
|
public:
|
||||||
|
// default ctor & dtor
|
||||||
|
wxListBase(wxKeyType keyType = wxKEY_NONE) { Init(keyType); }
|
||||||
|
virtual ~wxListBase();
|
||||||
|
|
||||||
|
// accessors
|
||||||
|
// count of items in the list
|
||||||
|
size_t GetCount() const { return m_count; }
|
||||||
|
|
||||||
|
// operations
|
||||||
|
// delete all nodes
|
||||||
|
virtual void Clear();
|
||||||
|
// instruct it to destroy user data when deleting nodes
|
||||||
|
void DeleteContents(bool destroy) { m_destroy = destroy; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// all methods here are "overloaded" in derived classes to provide compile
|
||||||
|
// time type checking
|
||||||
|
|
||||||
|
// create a node for the list of this type
|
||||||
|
virtual wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next,
|
||||||
|
void *data,
|
||||||
|
const wxListKey& key = wxListKey()) = 0;
|
||||||
|
|
||||||
|
// ctors
|
||||||
|
// from an array
|
||||||
|
wxListBase(size_t count, void *elements[]);
|
||||||
|
// from a sequence of objects
|
||||||
|
wxListBase(void *object, ... /* terminate with NULL */);
|
||||||
|
|
||||||
|
// copy ctor and assignment operator
|
||||||
|
wxListBase(const wxListBase& list)
|
||||||
|
{ DoCopy(list); }
|
||||||
|
wxListBase& operator=(const wxListBase& list)
|
||||||
|
{ Clear(); DoCopy(list); return *this; }
|
||||||
|
|
||||||
|
// get list head/tail
|
||||||
|
wxNodeBase *GetFirst() const { return m_nodeFirst; }
|
||||||
|
wxNodeBase *GetLast() const { return m_nodeLast; }
|
||||||
|
|
||||||
|
// by (0-based) index
|
||||||
|
wxNodeBase *Item(size_t index) const;
|
||||||
|
|
||||||
|
// get the list item's data
|
||||||
|
void *operator[](size_t index) const
|
||||||
|
{ wxNodeBase *node = Item(index); return node ? node->GetData() : NULL; }
|
||||||
|
|
||||||
|
// operations
|
||||||
|
// append to end of list
|
||||||
|
wxNodeBase *Append(void *object);
|
||||||
|
// insert a new item at the beginning of the list
|
||||||
|
wxNodeBase *Insert(void *object) { return Insert(NULL, object); }
|
||||||
|
// insert before given node or at front of list if prev == NULL
|
||||||
|
wxNodeBase *Insert(wxNodeBase *prev, void *object);
|
||||||
|
|
||||||
|
// keyed append
|
||||||
|
wxNodeBase *Append(long key, void *object);
|
||||||
|
wxNodeBase *Append(const char *key, void *object);
|
||||||
|
|
||||||
|
// removes node from the list but doesn't delete it (returns pointer
|
||||||
|
// to the node or NULL if it wasn't found in the list)
|
||||||
|
wxNodeBase *DetachNode(wxNodeBase *node);
|
||||||
|
// delete element from list, returns FALSE if node not found
|
||||||
|
bool DeleteNode(wxNodeBase *node);
|
||||||
|
// finds object pointer and deletes node (and object if DeleteContents
|
||||||
|
// is on), returns FALSE if object not found
|
||||||
|
bool DeleteObject(void *object);
|
||||||
|
|
||||||
|
// search (all return NULL if item not found)
|
||||||
|
// by data
|
||||||
|
wxNodeBase *Find(void *object) const;
|
||||||
|
|
||||||
|
// by key
|
||||||
|
wxNodeBase *Find(const wxListKey& key) const;
|
||||||
|
|
||||||
inline void DeleteContents(int destroy) { destroy_data = destroy; }
|
|
||||||
// Instruct it to destroy user data
|
|
||||||
// when deleting nodes
|
|
||||||
// this function allows the sorting of arbitrary lists by giving
|
// this function allows the sorting of arbitrary lists by giving
|
||||||
// a function to compare two list elements.
|
// a function to compare two list elements. The list is sorted in place.
|
||||||
void Sort(const wxSortCompareFunction compfunc);
|
void Sort(wxSortCompareFunction compfunc);
|
||||||
|
|
||||||
wxObject *FirstThat(wxListIterateFunction func);
|
// functions for iterating over the list
|
||||||
|
void *FirstThat(wxListIterateFunction func);
|
||||||
void ForEach(wxListIterateFunction func);
|
void ForEach(wxListIterateFunction func);
|
||||||
wxObject *LastThat(wxListIterateFunction func);
|
void *LastThat(wxListIterateFunction func);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// helpers
|
||||||
|
// common part of all ctors
|
||||||
|
void Init(wxKeyType keyType);
|
||||||
|
// common part of copy ctor and assignment operator
|
||||||
|
void DoCopy(const wxListBase& list);
|
||||||
|
// common part of all Append()s
|
||||||
|
wxNodeBase *AppendCommon(wxNodeBase *node);
|
||||||
|
// free node's data and node itself
|
||||||
|
void DoDeleteNode(wxNodeBase *node);
|
||||||
|
|
||||||
|
size_t m_count; // number of elements in the list
|
||||||
|
bool m_destroy; // destroy user data when deleting list items?
|
||||||
|
wxNodeBase *m_nodeFirst, // pointers to the head and tail of the list
|
||||||
|
*m_nodeLast;
|
||||||
|
|
||||||
|
wxKeyType m_keyType; // type of our keys (may be wxKEY_NONE)
|
||||||
};
|
};
|
||||||
|
|
||||||
// String list class. N.B. this always copies strings
|
// -----------------------------------------------------------------------------
|
||||||
// with Add and deletes them itself.
|
// macros for definition of "template" list type
|
||||||
class WXDLLEXPORT wxStringList: public wxList
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// and now some heavy magic...
|
||||||
|
|
||||||
|
// declare a list type named 'name' and containing elements of type 'T *'
|
||||||
|
// (as a by product of macro expansion you also get wx##name##Node
|
||||||
|
// wxNode-dervied type)
|
||||||
|
//
|
||||||
|
// implementation details:
|
||||||
|
// 1. we define _WX_LIST_ITEM_TYPE_##name typedef to save in it the item type
|
||||||
|
// for the list of given type - this allows us to pass only the list name
|
||||||
|
// to WX_DEFINE_LIST() even if it needs both the name and the type
|
||||||
|
//
|
||||||
|
// 2. We redefine all not type-safe wxList functions withtype-safe versions
|
||||||
|
// which don't take any place (everything is inline), but bring compile
|
||||||
|
// time error checking.
|
||||||
|
|
||||||
|
#define WX_DECLARE_LIST_2(T, name, nodetype) \
|
||||||
|
typedef int (*wxSortFuncFor_##name)(const T *, const T *); \
|
||||||
|
\
|
||||||
|
class WXDLLEXPORT nodetype : public wxNodeBase \
|
||||||
|
{ \
|
||||||
|
public: \
|
||||||
|
nodetype(wxListBase *list = (wxListBase *)NULL, \
|
||||||
|
nodetype *previous = (nodetype *)NULL, \
|
||||||
|
nodetype *next = (nodetype *)NULL, \
|
||||||
|
T *data = NULL, \
|
||||||
|
const wxListKey& key = wxListKey()) \
|
||||||
|
: wxNodeBase(list, previous, next, data, key) { } \
|
||||||
|
\
|
||||||
|
nodetype *GetNext() const \
|
||||||
|
{ return (nodetype *)wxNodeBase::GetNext(); } \
|
||||||
|
nodetype *GetPrevious() const \
|
||||||
|
{ return (nodetype *)wxNodeBase::GetPrevious(); } \
|
||||||
|
\
|
||||||
|
T *GetData() const \
|
||||||
|
{ return (T *)wxNodeBase::GetData(); } \
|
||||||
|
void SetData(T *data) \
|
||||||
|
{ wxNodeBase::SetData(data); } \
|
||||||
|
\
|
||||||
|
virtual void DeleteData(); \
|
||||||
|
}; \
|
||||||
|
\
|
||||||
|
class name : public wxListBase \
|
||||||
|
{ \
|
||||||
|
public: \
|
||||||
|
name(wxKeyType keyType = wxKEY_NONE) : wxListBase(keyType) \
|
||||||
|
{ } \
|
||||||
|
name(size_t count, T *elements[]) \
|
||||||
|
: wxListBase(count, (void **)elements) { } \
|
||||||
|
\
|
||||||
|
nodetype *GetFirst() const \
|
||||||
|
{ return (nodetype *)wxListBase::GetFirst(); } \
|
||||||
|
nodetype *GetLast() const \
|
||||||
|
{ return (nodetype *)wxListBase::GetLast(); } \
|
||||||
|
\
|
||||||
|
nodetype *Item(size_t index) const \
|
||||||
|
{ return (nodetype *)wxListBase::Item(index); } \
|
||||||
|
\
|
||||||
|
T *operator[](size_t index) const \
|
||||||
|
{ \
|
||||||
|
nodetype *node = Item(index); \
|
||||||
|
return node ? node->GetData() : NULL; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
nodetype *Append(T *object) \
|
||||||
|
{ return (nodetype *)wxListBase::Append(object); } \
|
||||||
|
nodetype *Insert(T *object) \
|
||||||
|
{ return (nodetype *)Insert(NULL, object); } \
|
||||||
|
nodetype *Insert(nodetype *prev, T *object) \
|
||||||
|
{ return (nodetype *)wxListBase::Insert(prev, object); } \
|
||||||
|
\
|
||||||
|
nodetype *Append(long key, void *object) \
|
||||||
|
{ return (nodetype *)wxListBase::Append(key, object); } \
|
||||||
|
nodetype *Append(const char *key, void *object) \
|
||||||
|
{ return (nodetype *)wxListBase::Append(key, object); } \
|
||||||
|
\
|
||||||
|
nodetype *DetachNode(nodetype *node) \
|
||||||
|
{ return (nodetype *)wxListBase::DetachNode(node); } \
|
||||||
|
bool DeleteNode(nodetype *node) \
|
||||||
|
{ return wxListBase::DeleteNode(node); } \
|
||||||
|
bool DeleteObject(T *object) \
|
||||||
|
{ return wxListBase::DeleteObject(object); } \
|
||||||
|
\
|
||||||
|
nodetype *Find(T *object) const \
|
||||||
|
{ return (nodetype *)wxListBase::Find(object); } \
|
||||||
|
\
|
||||||
|
virtual nodetype *Find(const wxListKey& key) const \
|
||||||
|
{ return (nodetype *)wxListBase::Find(key); } \
|
||||||
|
\
|
||||||
|
void Sort(wxSortFuncFor_##name func) \
|
||||||
|
{ wxListBase::Sort((wxSortCompareFunction)func); } \
|
||||||
|
\
|
||||||
|
protected: \
|
||||||
|
wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next, \
|
||||||
|
void *data, \
|
||||||
|
const wxListKey& key = wxListKey()) \
|
||||||
|
{ \
|
||||||
|
return new nodetype(this, \
|
||||||
|
(nodetype *)prev, (nodetype *)next, \
|
||||||
|
(T *)data, key); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define WX_DECLARE_LIST(elementtype, listname) \
|
||||||
|
typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
|
||||||
|
WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node)
|
||||||
|
|
||||||
|
// this macro must be inserted in your program after
|
||||||
|
// #include <wx/listimpl.cpp>
|
||||||
|
#define WX_DEFINE_LIST(name) "don't forget to include listimpl.cpp!"
|
||||||
|
|
||||||
|
|
||||||
|
// =============================================================================
|
||||||
|
// now we can define classes 100% compatible with the old ones
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
|
#ifdef wxLIST_COMPATIBILITY
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// wxList compatibility class: in fact, it's a list of wxObjects
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
WX_DECLARE_LIST_2(wxObject, wxObjectList, wxObjectListNode);
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxList : public wxObjectList
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxStringList)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxStringList(void);
|
wxList(int key_type = wxKEY_NONE) : wxObjectList((wxKeyType)key_type) { }
|
||||||
wxStringList(const wxStringList& list);
|
|
||||||
wxStringList(const char *first ...);
|
|
||||||
~wxStringList(void);
|
|
||||||
|
|
||||||
virtual wxNode *Add(const char *s);
|
// compatibility methods
|
||||||
virtual void Delete(const char *s);
|
int Number() const { return GetCount(); }
|
||||||
virtual char **ListToArray(bool new_copies = FALSE) const;
|
wxNode *First() const { return (wxNode *)GetFirst(); }
|
||||||
virtual void Sort(void);
|
wxNode *Last() const { return (wxNode *)GetLast(); }
|
||||||
virtual bool Member(const char *s) const;
|
wxNode *Nth(size_t index) const { return (wxNode *)Item(index); }
|
||||||
virtual void Clear(void);
|
wxNode *Member(wxObject *object) const { return (wxNode *)Find(object); }
|
||||||
void operator= (const wxStringList& list);
|
|
||||||
char* operator[] (int i) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// wxStringList class for compatibility with the old code
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
WX_DECLARE_LIST_2(char, wxStringListBase, wxStringListNode);
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxStringList : public wxStringListBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// ctors and such
|
||||||
|
// default
|
||||||
|
wxStringList() { DeleteContents(TRUE); }
|
||||||
|
wxStringList(const char *first ...);
|
||||||
|
|
||||||
|
// operations
|
||||||
|
// makes a copy of the string
|
||||||
|
wxNode *Add(const char *s)
|
||||||
|
{ return (wxNode *)wxStringListBase::Append(copystring(s)); }
|
||||||
|
|
||||||
|
void Delete(const char *s)
|
||||||
|
{ wxStringListBase::DeleteObject((char *)s); }
|
||||||
|
|
||||||
|
char **ListToArray(bool new_copies = FALSE) const;
|
||||||
|
bool Member(const char *s) const;
|
||||||
|
|
||||||
|
// alphabetic sort
|
||||||
|
void Sort();
|
||||||
|
|
||||||
|
// compatibility methods
|
||||||
|
int Number() const { return GetCount(); }
|
||||||
|
wxNode *First() const { return (wxNode *)GetFirst(); }
|
||||||
|
wxNode *Last() const { return (wxNode *)GetLast(); }
|
||||||
|
wxNode *Nth(size_t index) const { return (wxNode *)Item(index); }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // wxLIST_COMPATIBILITY
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_LISTH__
|
// _WX_LISTH__
|
||||||
|
@@ -1,111 +1,24 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: listimpl.cpp
|
// Name: listimpl.cpp
|
||||||
// Purpose: helper file for implementation of dynamic lists
|
// Purpose: second-part of macro based implementation of template lists
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 16.10.97
|
// Created: 16/11/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 1997 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
// Copyright: (c) 1998 Vadim Zeitlin
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* Purpose: implements methods of "template" class declared in DECLARE_LIST *
|
|
||||||
* macro and which couldn't be implemented inline (because they *
|
|
||||||
* need the full definition of type T in scope) *
|
|
||||||
* *
|
|
||||||
* Usage: 1) #include dynarray.h *
|
|
||||||
* 2) WX_DECLARE_LIST *
|
|
||||||
* 3) #include listimpl.cpp *
|
|
||||||
* 4) WX_DEFINE_LIST *
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
// macro implements remaining (not inline) methods of template list
|
|
||||||
// (it's private to this file)
|
|
||||||
#define _DEFINE_LIST(T, name) \
|
#define _DEFINE_LIST(T, name) \
|
||||||
name::~name() \
|
void wx##name##Node::DeleteData() \
|
||||||
{ \
|
{ \
|
||||||
Empty(); \
|
delete (T *)GetData(); \
|
||||||
} \
|
|
||||||
\
|
|
||||||
void name::DoCopy(const name& src) \
|
|
||||||
{ \
|
|
||||||
for ( uint ui = 0; ui < src.Count(); ui++ ) \
|
|
||||||
Add(src[ui]); \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
name& name::operator=(const name& src) \
|
|
||||||
{ \
|
|
||||||
Empty(); \
|
|
||||||
DoCopy(src); \
|
|
||||||
\
|
|
||||||
return *this; \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
name::name(const name& src) \
|
|
||||||
{ \
|
|
||||||
DoCopy(src); \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
void name::Empty() \
|
|
||||||
{ \
|
|
||||||
for ( uint ui = 0; ui < Count(); ui++ ) \
|
|
||||||
delete (T*)BaseArray::Item(ui); \
|
|
||||||
\
|
|
||||||
BaseArray::Clear(); \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
void name::Remove(uint uiIndex) \
|
|
||||||
{ \
|
|
||||||
wxCHECK( uiIndex < Count() ); \
|
|
||||||
\
|
|
||||||
delete (T*)BaseArray::Item(uiIndex); \
|
|
||||||
\
|
|
||||||
BaseArray::Remove(uiIndex); \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
void name::Add(const T& item) \
|
|
||||||
{ \
|
|
||||||
T* pItem = new T(item); \
|
|
||||||
if ( pItem != NULL ) \
|
|
||||||
Add(pItem); \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
void name::Insert(const T& item, uint uiIndex) \
|
|
||||||
{ \
|
|
||||||
T* pItem = new T(item); \
|
|
||||||
if ( pItem != NULL ) \
|
|
||||||
Insert(pItem, uiIndex); \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
int name::Index(const T& Item, Bool bFromEnd) const \
|
|
||||||
{ \
|
|
||||||
if ( bFromEnd ) { \
|
|
||||||
if ( Count() > 0 ) { \
|
|
||||||
uint ui = Count() - 1; \
|
|
||||||
do { \
|
|
||||||
if ( (T*)BaseArray::Item(ui) == &Item ) \
|
|
||||||
return ui; \
|
|
||||||
ui--; \
|
|
||||||
} \
|
|
||||||
while ( ui != 0 ); \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
else { \
|
|
||||||
for( uint ui = 0; ui < Count(); ui++ ) { \
|
|
||||||
if( (T*)BaseArray::Item(ui) == &Item ) \
|
|
||||||
return ui; \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
return NOT_FOUND; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// redefine the macro so that now it will generate the class implementation
|
// redefine the macro so that now it will generate the class implementation
|
||||||
// old value would provoke a compile-time error if this file is not included
|
// old value would provoke a compile-time error if this file is not included
|
||||||
#undef WX_DEFINE_LIST
|
#undef WX_DEFINE_LIST
|
||||||
#define WX_DEFINE_LIST(name) _DEFINE_LIST(_L##name, name)
|
#define WX_DEFINE_LIST(name) _DEFINE_LIST(_WX_LIST_ITEM_TYPE_##name, name)
|
||||||
|
|
||||||
// don't pollute preprocessor's name space
|
// don't pollute preprocessor's name space
|
||||||
#undef _DEFINE_LIST
|
//#undef _DEFINE_LIST
|
||||||
|
|
||||||
|
@@ -54,7 +54,7 @@ public:
|
|||||||
// Window procedure
|
// Window procedure
|
||||||
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
virtual void MSWOnMouseMove(int x, int y, WXUINT flags);
|
virtual void MSWOnMouseMove(int x, int y, WXUINT flags);
|
||||||
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam);
|
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||||
|
|
||||||
void OnEraseBackground(wxEraseEvent& event);
|
void OnEraseBackground(wxEraseEvent& event);
|
||||||
|
|
||||||
|
@@ -418,8 +418,8 @@ class WXDLLEXPORT wxListCtrl: public wxControl
|
|||||||
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
||||||
|
|
||||||
// IMPLEMENTATION
|
// IMPLEMENTATION
|
||||||
bool MSWCommand(WXUINT param, WXWORD id);
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||||
bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam);
|
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||||
|
|
||||||
// Recreate window - seems to be necessary when changing a style.
|
// Recreate window - seems to be necessary when changing a style.
|
||||||
void RecreateWindow(void);
|
void RecreateWindow(void);
|
||||||
@@ -442,10 +442,8 @@ protected:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLEXPORT wxListEvent: public wxCommandEvent
|
class WXDLLEXPORT wxListEvent : public wxNotifyEvent
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxListEvent)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
|
wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
|
||||||
|
|
||||||
@@ -457,6 +455,8 @@ class WXDLLEXPORT wxListEvent: public wxCommandEvent
|
|||||||
wxPoint m_pointDrag;
|
wxPoint m_pointDrag;
|
||||||
|
|
||||||
wxListItem m_item;
|
wxListItem m_item;
|
||||||
|
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxListEvent)
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&);
|
typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&);
|
||||||
|
@@ -44,12 +44,16 @@ WX_DEFINE_ARRAY(wxNotebookPage *, wxArrayPages);
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// notebook events
|
// notebook events
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
class WXDLLEXPORT wxNotebookEvent : public wxCommandEvent
|
class WXDLLEXPORT wxNotebookEvent : public wxNotifyEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
|
wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
|
||||||
int nSel = -1, int nOldSel = -1)
|
int nSel = -1, int nOldSel = -1)
|
||||||
: wxCommandEvent(commandType, id) { m_nSel = nSel; m_nOldSel = nOldSel; }
|
: wxNotifyEvent(commandType, id)
|
||||||
|
{
|
||||||
|
m_nSel = nSel;
|
||||||
|
m_nOldSel = nOldSel;
|
||||||
|
}
|
||||||
|
|
||||||
// accessors
|
// accessors
|
||||||
// the currently selected page (-1 if none)
|
// the currently selected page (-1 if none)
|
||||||
@@ -173,7 +177,7 @@ public:
|
|||||||
// base class virtuals
|
// base class virtuals
|
||||||
// -------------------
|
// -------------------
|
||||||
virtual void Command(wxCommandEvent& event);
|
virtual void Command(wxCommandEvent& event);
|
||||||
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam);
|
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||||
virtual void SetConstraintSizes(bool recurse = TRUE);
|
virtual void SetConstraintSizes(bool recurse = TRUE);
|
||||||
virtual bool DoPhase(int nPhase);
|
virtual bool DoPhase(int nPhase);
|
||||||
|
|
||||||
|
@@ -91,6 +91,10 @@ public:
|
|||||||
virtual bool DeleteAll();
|
virtual bool DeleteAll();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// no copy ctor/assignment operator
|
||||||
|
wxRegConfig(const wxRegConfig&);
|
||||||
|
wxRegConfig& operator=(const wxRegConfig&);
|
||||||
|
|
||||||
// these keys are opened during all lifetime of wxRegConfig object
|
// these keys are opened during all lifetime of wxRegConfig object
|
||||||
wxRegKey m_keyLocalRoot, m_keyLocal,
|
wxRegKey m_keyLocalRoot, m_keyLocal,
|
||||||
m_keyGlobalRoot, m_keyGlobal;
|
m_keyGlobalRoot, m_keyGlobal;
|
||||||
|
@@ -79,7 +79,7 @@
|
|||||||
#define wxUSE_SCROLLBAR 1
|
#define wxUSE_SCROLLBAR 1
|
||||||
// Define 1 to compile contributed wxScrollBar class
|
// Define 1 to compile contributed wxScrollBar class
|
||||||
#define wxUSE_XPM_IN_X 1
|
#define wxUSE_XPM_IN_X 1
|
||||||
#define wxUSE_XPM_IN_MSW 0
|
#define wxUSE_XPM_IN_MSW 1
|
||||||
// Define 1 to support the XPM package in wxBitmap,
|
// Define 1 to support the XPM package in wxBitmap,
|
||||||
// separated by platform. If 1, you must link in
|
// separated by platform. If 1, you must link in
|
||||||
// the XPM library to your applications.
|
// the XPM library to your applications.
|
||||||
@@ -114,12 +114,12 @@
|
|||||||
#define wxUSE_DYNAMIC_CLASSES 1
|
#define wxUSE_DYNAMIC_CLASSES 1
|
||||||
// If 1, enables provision of run-time type information.
|
// If 1, enables provision of run-time type information.
|
||||||
// NOW MANDATORY: don't change.
|
// NOW MANDATORY: don't change.
|
||||||
#define wxUSE_MEMORY_TRACING 1
|
#define wxUSE_MEMORY_TRACING 0
|
||||||
// If 1, enables debugging versions of wxObject::new and
|
// If 1, enables debugging versions of wxObject::new and
|
||||||
// wxObject::delete *IF* __WXDEBUG__ is also defined.
|
// wxObject::delete *IF* __WXDEBUG__ is also defined.
|
||||||
// WARNING: this code may not work with all architectures, especially
|
// WARNING: this code may not work with all architectures, especially
|
||||||
// if alignment is an issue.
|
// if alignment is an issue.
|
||||||
#define wxUSE_DEBUG_CONTEXT 1
|
#define wxUSE_DEBUG_CONTEXT 0
|
||||||
// If 1, enables wxDebugContext, for
|
// If 1, enables wxDebugContext, for
|
||||||
// writing error messages to file, etc.
|
// writing error messages to file, etc.
|
||||||
// If __WXDEBUG__ is not defined, will still use
|
// If __WXDEBUG__ is not defined, will still use
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
// since you may well need to output
|
// since you may well need to output
|
||||||
// an error log in a production
|
// an error log in a production
|
||||||
// version (or non-debugging beta)
|
// version (or non-debugging beta)
|
||||||
#define wxUSE_GLOBAL_MEMORY_OPERATORS 1
|
#define wxUSE_GLOBAL_MEMORY_OPERATORS 0
|
||||||
// In debug mode, cause new and delete to be redefined globally.
|
// In debug mode, cause new and delete to be redefined globally.
|
||||||
// If this causes problems (e.g. link errors), set this to 0.
|
// If this causes problems (e.g. link errors), set this to 0.
|
||||||
|
|
||||||
|
@@ -67,10 +67,10 @@ class WXDLLEXPORT wxSpinButton: public wxControl
|
|||||||
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
||||||
|
|
||||||
// IMPLEMENTATION
|
// IMPLEMENTATION
|
||||||
bool MSWCommand(WXUINT param, WXWORD id);
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||||
bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam);
|
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||||
void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
virtual void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
||||||
void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
virtual void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_min;
|
int m_min;
|
||||||
|
@@ -122,8 +122,9 @@ class WXDLLEXPORT wxTabCtrl: public wxControl
|
|||||||
void OnKillFocus(wxFocusEvent& event) { Default() ; }
|
void OnKillFocus(wxFocusEvent& event) { Default() ; }
|
||||||
|
|
||||||
void Command(wxCommandEvent& event);
|
void Command(wxCommandEvent& event);
|
||||||
bool MSWCommand(WXUINT param, WXWORD id);
|
|
||||||
bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam);
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||||
|
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||||
|
|
||||||
// Responds to colour changes
|
// Responds to colour changes
|
||||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||||
|
@@ -81,8 +81,8 @@ class WXDLLEXPORT wxToolBar95: public wxToolBarBase
|
|||||||
bool Realize() { return CreateTools(); };
|
bool Realize() { return CreateTools(); };
|
||||||
|
|
||||||
// IMPLEMENTATION
|
// IMPLEMENTATION
|
||||||
bool MSWCommand(WXUINT param, WXWORD id);
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||||
bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam);
|
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||||
|
|
||||||
// Responds to colour changes
|
// Responds to colour changes
|
||||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||||
|
@@ -410,8 +410,8 @@ public:
|
|||||||
// implementation
|
// implementation
|
||||||
// --------------
|
// --------------
|
||||||
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
||||||
bool MSWCommand(WXUINT param, WXWORD id);
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||||
bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam);
|
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// SetImageList helper
|
// SetImageList helper
|
||||||
@@ -448,7 +448,7 @@ private:
|
|||||||
// NB: note that not all accessors make sense for all events, see the event
|
// NB: note that not all accessors make sense for all events, see the event
|
||||||
// descriptions below
|
// descriptions below
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
class WXDLLEXPORT wxTreeEvent : public wxCommandEvent
|
class WXDLLEXPORT wxTreeEvent : public wxNotifyEvent
|
||||||
{
|
{
|
||||||
friend wxTreeCtrl;
|
friend wxTreeCtrl;
|
||||||
public:
|
public:
|
||||||
@@ -470,10 +470,6 @@ public:
|
|||||||
// keyboard code (for wxEVT_COMMAND_TREE_KEY_DOWN only)
|
// keyboard code (for wxEVT_COMMAND_TREE_KEY_DOWN only)
|
||||||
int GetCode() const { return m_code; }
|
int GetCode() const { return m_code; }
|
||||||
|
|
||||||
// set return code for wxEVT_COMMAND_TREE_ITEM_{EXPAND|COLLAPS}ING events
|
|
||||||
// call this to forbid the change in item status
|
|
||||||
void Veto() { m_code = TRUE; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// @@ we could save some space by using union here
|
// @@ we could save some space by using union here
|
||||||
int m_code;
|
int m_code;
|
||||||
|
@@ -89,18 +89,17 @@ class WXDLLEXPORT wxWindow: public wxEvtHandler
|
|||||||
friend class wxPaintDC;
|
friend class wxPaintDC;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxWindow(void);
|
wxWindow();
|
||||||
inline wxWindow(wxWindow *parent, wxWindowID id,
|
wxWindow(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = 0,
|
long style = 0,
|
||||||
const wxString& name = wxPanelNameStr)
|
const wxString& name = wxPanelNameStr)
|
||||||
{
|
{
|
||||||
m_children = new wxList;
|
|
||||||
Create(parent, id, pos, size, style, name);
|
Create(parent, id, pos, size, style, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~wxWindow(void);
|
virtual ~wxWindow();
|
||||||
|
|
||||||
bool Create(wxWindow *parent, wxWindowID id,
|
bool Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
@@ -109,25 +108,25 @@ public:
|
|||||||
const wxString& name = wxPanelNameStr);
|
const wxString& name = wxPanelNameStr);
|
||||||
|
|
||||||
// Fit the window around the items
|
// Fit the window around the items
|
||||||
virtual void Fit(void);
|
virtual void Fit();
|
||||||
|
|
||||||
// Show or hide the window
|
// Show or hide the window
|
||||||
virtual bool Show(bool show);
|
virtual bool Show(bool show);
|
||||||
|
|
||||||
// Is the window shown?
|
// Is the window shown?
|
||||||
virtual bool IsShown(void) const;
|
virtual bool IsShown() const;
|
||||||
|
|
||||||
// Raise the window to the top of the Z order
|
// Raise the window to the top of the Z order
|
||||||
virtual void Raise(void);
|
virtual void Raise();
|
||||||
|
|
||||||
// Lower the window to the bottom of the Z order
|
// Lower the window to the bottom of the Z order
|
||||||
virtual void Lower(void);
|
virtual void Lower();
|
||||||
|
|
||||||
// Is the window enabled?
|
// Is the window enabled?
|
||||||
virtual bool IsEnabled(void) const;
|
virtual bool IsEnabled() const;
|
||||||
|
|
||||||
// For compatibility
|
// For compatibility
|
||||||
inline bool Enabled(void) const { return IsEnabled(); }
|
inline bool Enabled() const { return IsEnabled(); }
|
||||||
|
|
||||||
// Dialog support: override these and call
|
// Dialog support: override these and call
|
||||||
// base class members to add functionality
|
// base class members to add functionality
|
||||||
@@ -135,30 +134,30 @@ public:
|
|||||||
|
|
||||||
// Transfer values to controls. If returns FALSE,
|
// Transfer values to controls. If returns FALSE,
|
||||||
// it's an application error (pops up a dialog)
|
// it's an application error (pops up a dialog)
|
||||||
virtual bool TransferDataToWindow(void);
|
virtual bool TransferDataToWindow();
|
||||||
|
|
||||||
// Transfer values from controls. If returns FALSE,
|
// Transfer values from controls. If returns FALSE,
|
||||||
// transfer failed: don't quit
|
// transfer failed: don't quit
|
||||||
virtual bool TransferDataFromWindow(void);
|
virtual bool TransferDataFromWindow();
|
||||||
|
|
||||||
// Validate controls. If returns FALSE,
|
// Validate controls. If returns FALSE,
|
||||||
// validation failed: don't quit
|
// validation failed: don't quit
|
||||||
virtual bool Validate(void);
|
virtual bool Validate();
|
||||||
|
|
||||||
// Return code for dialogs
|
// Return code for dialogs
|
||||||
inline void SetReturnCode(int retCode);
|
inline void SetReturnCode(int retCode);
|
||||||
inline int GetReturnCode(void);
|
inline int GetReturnCode();
|
||||||
|
|
||||||
// Set the cursor
|
// Set the cursor
|
||||||
virtual void SetCursor(const wxCursor& cursor);
|
virtual void SetCursor(const wxCursor& cursor);
|
||||||
inline virtual wxCursor *GetCursor(void) const { return (wxCursor *)& m_windowCursor; };
|
inline virtual wxCursor *GetCursor() const { return (wxCursor *)& m_windowCursor; };
|
||||||
|
|
||||||
// Get the window with the focus
|
// Get the window with the focus
|
||||||
static wxWindow *FindFocus(void);
|
static wxWindow *FindFocus();
|
||||||
|
|
||||||
// Get character size
|
// Get character size
|
||||||
virtual int GetCharHeight(void) const;
|
virtual int GetCharHeight() const;
|
||||||
virtual int GetCharWidth(void) const;
|
virtual int GetCharWidth() const;
|
||||||
|
|
||||||
// Get overall window size
|
// Get overall window size
|
||||||
virtual void GetSize(int *width, int *height) const;
|
virtual void GetSize(int *width, int *height) const;
|
||||||
@@ -184,11 +183,11 @@ public:
|
|||||||
virtual void ScreenToClient(int *x, int *y) const;
|
virtual void ScreenToClient(int *x, int *y) const;
|
||||||
|
|
||||||
// Set the focus to this window
|
// Set the focus to this window
|
||||||
virtual void SetFocus(void);
|
virtual void SetFocus();
|
||||||
|
|
||||||
// Capture/release mouse
|
// Capture/release mouse
|
||||||
virtual void CaptureMouse(void);
|
virtual void CaptureMouse();
|
||||||
virtual void ReleaseMouse(void);
|
virtual void ReleaseMouse();
|
||||||
|
|
||||||
// Enable or disable the window
|
// Enable or disable the window
|
||||||
virtual void Enable(bool enable);
|
virtual void Enable(bool enable);
|
||||||
@@ -211,13 +210,13 @@ public:
|
|||||||
|
|
||||||
// Set/get the window title
|
// Set/get the window title
|
||||||
virtual inline void SetTitle(const wxString& WXUNUSED(title)) {};
|
virtual inline void SetTitle(const wxString& WXUNUSED(title)) {};
|
||||||
inline virtual wxString GetTitle(void) const { return wxString(""); };
|
inline virtual wxString GetTitle() const { return wxString(""); };
|
||||||
// Most windows have the concept of a label; for frames, this is the
|
// Most windows have the concept of a label; for frames, this is the
|
||||||
// title; for items, this is the label or button text.
|
// title; for items, this is the label or button text.
|
||||||
inline virtual wxString GetLabel(void) const { return GetTitle(); }
|
inline virtual wxString GetLabel() const { return GetTitle(); }
|
||||||
|
|
||||||
// Set/get the window name (used for resource setting in X)
|
// Set/get the window name (used for resource setting in X)
|
||||||
inline virtual wxString GetName(void) const;
|
inline virtual wxString GetName() const;
|
||||||
inline virtual void SetName(const wxString& name);
|
inline virtual void SetName(const wxString& name);
|
||||||
|
|
||||||
// Centre the window
|
// Centre the window
|
||||||
@@ -252,7 +251,7 @@ public:
|
|||||||
// Caret manipulation
|
// Caret manipulation
|
||||||
virtual void CreateCaret(int w, int h);
|
virtual void CreateCaret(int w, int h);
|
||||||
virtual void CreateCaret(const wxBitmap *bitmap);
|
virtual void CreateCaret(const wxBitmap *bitmap);
|
||||||
virtual void DestroyCaret(void);
|
virtual void DestroyCaret();
|
||||||
virtual void ShowCaret(bool show);
|
virtual void ShowCaret(bool show);
|
||||||
virtual void SetCaretPos(int x, int y);
|
virtual void SetCaretPos(int x, int y);
|
||||||
virtual void GetCaretPos(int *x, int *y) const;
|
virtual void GetCaretPos(int *x, int *y) const;
|
||||||
@@ -268,31 +267,31 @@ public:
|
|||||||
virtual void MakeModal(bool modal);
|
virtual void MakeModal(bool modal);
|
||||||
|
|
||||||
// Get the private handle (platform-dependent)
|
// Get the private handle (platform-dependent)
|
||||||
inline void *GetHandle(void) const;
|
inline void *GetHandle() const;
|
||||||
|
|
||||||
// Set/get the window's relatives
|
// Set/get the window's relatives
|
||||||
inline wxWindow *GetParent(void) const;
|
inline wxWindow *GetParent() const;
|
||||||
inline void SetParent(wxWindow *p) ;
|
inline void SetParent(wxWindow *p) ;
|
||||||
inline wxWindow *GetGrandParent(void) const;
|
inline wxWindow *GetGrandParent() const;
|
||||||
inline wxList *GetChildren() const;
|
inline wxList *GetChildren() const;
|
||||||
|
|
||||||
// Set/get the window's font
|
// Set/get the window's font
|
||||||
virtual void SetFont(const wxFont& f);
|
virtual void SetFont(const wxFont& f);
|
||||||
inline virtual wxFont *GetFont(void) const;
|
inline virtual wxFont *GetFont() const;
|
||||||
|
|
||||||
// Set/get the window's validator
|
// Set/get the window's validator
|
||||||
void SetValidator(const wxValidator& validator);
|
void SetValidator(const wxValidator& validator);
|
||||||
inline wxValidator *GetValidator(void) const;
|
inline wxValidator *GetValidator() const;
|
||||||
|
|
||||||
// Set/get the window's style
|
// Set/get the window's style
|
||||||
inline void SetWindowStyleFlag(long flag);
|
inline void SetWindowStyleFlag(long flag);
|
||||||
inline long GetWindowStyleFlag(void) const;
|
inline long GetWindowStyleFlag() const;
|
||||||
|
|
||||||
// Set/get double-clickability
|
// Set/get double-clickability
|
||||||
// TODO: we probably wish to get rid of this, and
|
// TODO: we probably wish to get rid of this, and
|
||||||
// always allow double clicks.
|
// always allow double clicks.
|
||||||
inline void SetDoubleClick(bool flag);
|
inline void SetDoubleClick(bool flag);
|
||||||
inline bool GetDoubleClick(void) const;
|
inline bool GetDoubleClick() const;
|
||||||
inline void AllowDoubleClick(bool value) { SetDoubleClick(value); }
|
inline void AllowDoubleClick(bool value) { SetDoubleClick(value); }
|
||||||
|
|
||||||
// Handle a control command
|
// Handle a control command
|
||||||
@@ -300,7 +299,7 @@ public:
|
|||||||
|
|
||||||
// Set/get event handler
|
// Set/get event handler
|
||||||
inline void SetEventHandler(wxEvtHandler *handler);
|
inline void SetEventHandler(wxEvtHandler *handler);
|
||||||
inline wxEvtHandler *GetEventHandler(void) const;
|
inline wxEvtHandler *GetEventHandler() const;
|
||||||
|
|
||||||
// Push/pop event handler (i.e. allow a chain of event handlers
|
// Push/pop event handler (i.e. allow a chain of event handlers
|
||||||
// be searched)
|
// be searched)
|
||||||
@@ -311,33 +310,33 @@ public:
|
|||||||
virtual bool Close(bool force = FALSE);
|
virtual bool Close(bool force = FALSE);
|
||||||
|
|
||||||
// Destroy the window (delayed, if a managed window)
|
// Destroy the window (delayed, if a managed window)
|
||||||
virtual bool Destroy(void) ;
|
virtual bool Destroy() ;
|
||||||
|
|
||||||
// Mode for telling default OnSize members to
|
// Mode for telling default OnSize members to
|
||||||
// call Layout(), if not using Sizers, just top-down constraints
|
// call Layout(), if not using Sizers, just top-down constraints
|
||||||
inline void SetAutoLayout(bool a);
|
inline void SetAutoLayout(bool a);
|
||||||
inline bool GetAutoLayout(void) const;
|
inline bool GetAutoLayout() const;
|
||||||
|
|
||||||
// Set/get constraints
|
// Set/get constraints
|
||||||
inline wxLayoutConstraints *GetConstraints(void) const;
|
inline wxLayoutConstraints *GetConstraints() const;
|
||||||
void SetConstraints(wxLayoutConstraints *c);
|
void SetConstraints(wxLayoutConstraints *c);
|
||||||
|
|
||||||
// Set/get window background colour
|
// Set/get window background colour
|
||||||
inline virtual void SetBackgroundColour(const wxColour& col);
|
inline virtual void SetBackgroundColour(const wxColour& col);
|
||||||
inline virtual wxColour GetBackgroundColour(void) const;
|
inline virtual wxColour GetBackgroundColour() const;
|
||||||
|
|
||||||
// Set/get window foreground colour
|
// Set/get window foreground colour
|
||||||
inline virtual void SetForegroundColour(const wxColour& col);
|
inline virtual void SetForegroundColour(const wxColour& col);
|
||||||
inline virtual wxColour GetForegroundColour(void) const;
|
inline virtual wxColour GetForegroundColour() const;
|
||||||
|
|
||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); }
|
inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); }
|
||||||
inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); }
|
inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); }
|
||||||
inline virtual wxFont *GetLabelFont(void) const { return GetFont(); };
|
inline virtual wxFont *GetLabelFont() const { return GetFont(); };
|
||||||
inline virtual wxFont *GetButtonFont(void) const { return GetFont(); };
|
inline virtual wxFont *GetButtonFont() const { return GetFont(); };
|
||||||
|
|
||||||
// Get the default button, if there is one
|
// Get the default button, if there is one
|
||||||
inline virtual wxButton *GetDefaultItem(void) const;
|
inline virtual wxButton *GetDefaultItem() const;
|
||||||
inline virtual void SetDefaultItem(wxButton *but);
|
inline virtual void SetDefaultItem(wxButton *but);
|
||||||
|
|
||||||
virtual void SetAcceleratorTable(const wxAcceleratorTable& accel);
|
virtual void SetAcceleratorTable(const wxAcceleratorTable& accel);
|
||||||
@@ -365,27 +364,27 @@ public:
|
|||||||
const wxFont *theFont = NULL, bool use16 = FALSE) const;
|
const wxFont *theFont = NULL, bool use16 = FALSE) const;
|
||||||
|
|
||||||
// Is the window retained?
|
// Is the window retained?
|
||||||
inline bool IsRetained(void) const;
|
inline bool IsRetained() const;
|
||||||
|
|
||||||
// Warp the pointer the given position
|
// Warp the pointer the given position
|
||||||
virtual void WarpPointer(int x_pos, int y_pos) ;
|
virtual void WarpPointer(int x_pos, int y_pos) ;
|
||||||
|
|
||||||
// Clear the window
|
// Clear the window
|
||||||
virtual void Clear(void);
|
virtual void Clear();
|
||||||
|
|
||||||
// Find a window by id or name
|
// Find a window by id or name
|
||||||
virtual wxWindow *FindWindow(long id);
|
virtual wxWindow *FindWindow(long id);
|
||||||
virtual wxWindow *FindWindow(const wxString& name);
|
virtual wxWindow *FindWindow(const wxString& name);
|
||||||
|
|
||||||
// Constraint operations
|
// Constraint operations
|
||||||
bool Layout(void);
|
bool Layout();
|
||||||
void SetSizer(wxSizer *sizer); // Adds sizer child to this window
|
void SetSizer(wxSizer *sizer); // Adds sizer child to this window
|
||||||
inline wxSizer *GetSizer(void) const ;
|
inline wxSizer *GetSizer() const ;
|
||||||
inline wxWindow *GetSizerParent(void) const ;
|
inline wxWindow *GetSizerParent() const ;
|
||||||
inline void SetSizerParent(wxWindow *win);
|
inline void SetSizerParent(wxWindow *win);
|
||||||
|
|
||||||
// Do Update UI processing for controls
|
// Do Update UI processing for controls
|
||||||
void UpdateWindowUI(void);
|
void UpdateWindowUI();
|
||||||
|
|
||||||
void OnEraseBackground(wxEraseEvent& event);
|
void OnEraseBackground(wxEraseEvent& event);
|
||||||
void OnChar(wxKeyEvent& event);
|
void OnChar(wxKeyEvent& event);
|
||||||
@@ -410,15 +409,18 @@ public:
|
|||||||
|
|
||||||
// Windows subclassing
|
// Windows subclassing
|
||||||
void SubclassWin(WXHWND hWnd);
|
void SubclassWin(WXHWND hWnd);
|
||||||
void UnsubclassWin(void);
|
void UnsubclassWin();
|
||||||
virtual long Default(void);
|
virtual long Default();
|
||||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||||
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam);
|
|
||||||
|
// returns TRUE if the event was processed
|
||||||
|
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||||
|
|
||||||
virtual wxWindow *FindItem(int id) const;
|
virtual wxWindow *FindItem(int id) const;
|
||||||
virtual wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const ;
|
virtual wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const ;
|
||||||
virtual void PreDelete(WXHDC dc); // Allows system cleanup
|
virtual void PreDelete(WXHDC dc); // Allows system cleanup
|
||||||
// TO DO: how many of these need to be virtual?
|
// TO DO: how many of these need to be virtual?
|
||||||
virtual WXHWND GetHWND(void) const ;
|
virtual WXHWND GetHWND() const ;
|
||||||
virtual void SetHWND(WXHWND hWnd);
|
virtual void SetHWND(WXHWND hWnd);
|
||||||
|
|
||||||
// Make a Windows extended style from the given wxWindows window style
|
// Make a Windows extended style from the given wxWindows window style
|
||||||
@@ -429,23 +431,23 @@ public:
|
|||||||
virtual void AddChild(wxWindow *child); // Adds reference to the child object
|
virtual void AddChild(wxWindow *child); // Adds reference to the child object
|
||||||
virtual void RemoveChild(wxWindow *child); // Removes reference to child
|
virtual void RemoveChild(wxWindow *child); // Removes reference to child
|
||||||
// (but doesn't delete the child object)
|
// (but doesn't delete the child object)
|
||||||
virtual void DestroyChildren(void); // Removes and destroys all children
|
virtual void DestroyChildren(); // Removes and destroys all children
|
||||||
|
|
||||||
inline bool IsBeingDeleted(void);
|
inline bool IsBeingDeleted();
|
||||||
|
|
||||||
// MSW only: TRUE if this control is part of the main control
|
// MSW only: TRUE if this control is part of the main control
|
||||||
virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; };
|
virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; };
|
||||||
|
|
||||||
// Constraint implementation
|
// Constraint implementation
|
||||||
void UnsetConstraints(wxLayoutConstraints *c);
|
void UnsetConstraints(wxLayoutConstraints *c);
|
||||||
inline wxList *GetConstraintsInvolvedIn(void) const ;
|
inline wxList *GetConstraintsInvolvedIn() const ;
|
||||||
// Back-pointer to other windows we're involved with, so if we delete
|
// Back-pointer to other windows we're involved with, so if we delete
|
||||||
// this window, we must delete any constraints we're involved with.
|
// this window, we must delete any constraints we're involved with.
|
||||||
void AddConstraintReference(wxWindow *otherWin);
|
void AddConstraintReference(wxWindow *otherWin);
|
||||||
void RemoveConstraintReference(wxWindow *otherWin);
|
void RemoveConstraintReference(wxWindow *otherWin);
|
||||||
void DeleteRelatedConstraints(void);
|
void DeleteRelatedConstraints();
|
||||||
|
|
||||||
virtual void ResetConstraints(void);
|
virtual void ResetConstraints();
|
||||||
virtual void SetConstraintSizes(bool recurse = TRUE);
|
virtual void SetConstraintSizes(bool recurse = TRUE);
|
||||||
virtual bool LayoutPhase1(int *noChanges);
|
virtual bool LayoutPhase1(int *noChanges);
|
||||||
virtual bool LayoutPhase2(int *noChanges);
|
virtual bool LayoutPhase2(int *noChanges);
|
||||||
@@ -487,25 +489,25 @@ public:
|
|||||||
virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd);
|
virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd);
|
||||||
|
|
||||||
// Make sure the window style reflects the HWND style (roughly)
|
// Make sure the window style reflects the HWND style (roughly)
|
||||||
virtual void AdoptAttributesFromHWND(void);
|
virtual void AdoptAttributesFromHWND();
|
||||||
|
|
||||||
// Setup background and foreground colours correctly
|
// Setup background and foreground colours correctly
|
||||||
virtual void SetupColours(void);
|
virtual void SetupColours();
|
||||||
|
|
||||||
// Saves the last message information before calling base version
|
// Saves the last message information before calling base version
|
||||||
virtual bool ProcessEvent(wxEvent& event);
|
virtual bool ProcessEvent(wxEvent& event);
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
virtual void MSWOnCreate(WXLPCREATESTRUCT cs);
|
virtual void MSWOnCreate(WXLPCREATESTRUCT cs);
|
||||||
virtual bool MSWOnPaint(void);
|
virtual bool MSWOnPaint();
|
||||||
virtual WXHICON MSWOnQueryDragIcon(void) { return 0; }
|
virtual WXHICON MSWOnQueryDragIcon() { return 0; }
|
||||||
virtual void MSWOnSize(int x, int y, WXUINT flag);
|
virtual void MSWOnSize(int x, int y, WXUINT flag);
|
||||||
virtual void MSWOnWindowPosChanging(void *lpPos);
|
virtual void MSWOnWindowPosChanging(void *lpPos);
|
||||||
virtual void MSWOnHScroll(WXWORD nSBCode, WXWORD pos, WXHWND control);
|
virtual void MSWOnHScroll(WXWORD nSBCode, WXWORD pos, WXHWND control);
|
||||||
virtual void MSWOnVScroll(WXWORD nSBCode, WXWORD pos, WXHWND control);
|
virtual void MSWOnVScroll(WXWORD nSBCode, WXWORD pos, WXHWND control);
|
||||||
virtual bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
virtual bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
||||||
virtual long MSWOnSysCommand(WXWPARAM wParam, WXLPARAM lParam);
|
virtual long MSWOnSysCommand(WXWPARAM wParam, WXLPARAM lParam);
|
||||||
virtual bool MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam);
|
virtual long MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam);
|
||||||
virtual WXHBRUSH MSWOnCtlColor(WXHDC dc, WXHWND pWnd, WXUINT nCtlColor,
|
virtual WXHBRUSH MSWOnCtlColor(WXHDC dc, WXHWND pWnd, WXUINT nCtlColor,
|
||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
virtual bool MSWOnColorChange(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
virtual bool MSWOnColorChange(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
@@ -514,11 +516,11 @@ public:
|
|||||||
virtual bool MSWOnEraseBkgnd(WXHDC pDC);
|
virtual bool MSWOnEraseBkgnd(WXHDC pDC);
|
||||||
virtual void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
|
virtual void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
|
||||||
virtual void MSWOnInitMenuPopup(WXHMENU menu, int pos, bool isSystem);
|
virtual void MSWOnInitMenuPopup(WXHMENU menu, int pos, bool isSystem);
|
||||||
virtual bool MSWOnClose(void);
|
virtual bool MSWOnClose();
|
||||||
// Return TRUE to end session, FALSE to veto end session.
|
// Return TRUE to end session, FALSE to veto end session.
|
||||||
virtual bool MSWOnQueryEndSession(long logOff);
|
virtual bool MSWOnQueryEndSession(long logOff);
|
||||||
virtual bool MSWOnEndSession(bool endSession, long logOff);
|
virtual bool MSWOnEndSession(bool endSession, long logOff);
|
||||||
virtual bool MSWOnDestroy(void);
|
virtual bool MSWOnDestroy();
|
||||||
virtual bool MSWOnSetFocus(WXHWND wnd);
|
virtual bool MSWOnSetFocus(WXHWND wnd);
|
||||||
virtual bool MSWOnKillFocus(WXHWND wnd);
|
virtual bool MSWOnKillFocus(WXHWND wnd);
|
||||||
virtual void MSWOnDropFiles(WXWPARAM wParam);
|
virtual void MSWOnDropFiles(WXWPARAM wParam);
|
||||||
@@ -565,10 +567,10 @@ public:
|
|||||||
virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
virtual bool MSWProcessMessage(WXMSG* pMsg);
|
virtual bool MSWProcessMessage(WXMSG* pMsg);
|
||||||
virtual bool MSWTranslateMessage(WXMSG* pMsg);
|
virtual bool MSWTranslateMessage(WXMSG* pMsg);
|
||||||
virtual void MSWDestroyWindow(void);
|
virtual void MSWDestroyWindow();
|
||||||
|
|
||||||
// Detach "Window" menu from menu bar so it doesn't get deleted
|
// Detach "Window" menu from menu bar so it doesn't get deleted
|
||||||
void MSWDetachWindowMenu(void);
|
void MSWDetachWindowMenu();
|
||||||
|
|
||||||
inline WXFARPROC MSWGetOldWndProc() const;
|
inline WXFARPROC MSWGetOldWndProc() const;
|
||||||
inline void MSWSetOldWndProc(WXFARPROC proc);
|
inline void MSWSetOldWndProc(WXFARPROC proc);
|
||||||
@@ -578,9 +580,9 @@ public:
|
|||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
|
|
||||||
inline void SetShowing(bool show);
|
inline void SetShowing(bool show);
|
||||||
inline bool IsUserEnabled(void) const;
|
inline bool IsUserEnabled() const;
|
||||||
inline bool GetUseCtl3D(void) const ;
|
inline bool GetUseCtl3D() const ;
|
||||||
inline bool GetTransparentBackground(void) const ;
|
inline bool GetTransparentBackground() const ;
|
||||||
|
|
||||||
// Responds to colour changes: passes event on to children.
|
// Responds to colour changes: passes event on to children.
|
||||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||||
@@ -590,7 +592,7 @@ public:
|
|||||||
|
|
||||||
// Sends an OnInitDialog event, which in turns transfers data to
|
// Sends an OnInitDialog event, which in turns transfers data to
|
||||||
// to the window via validators.
|
// to the window via validators.
|
||||||
virtual void InitDialog(void);
|
virtual void InitDialog();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
//// PROTECTED DATA
|
//// PROTECTED DATA
|
||||||
@@ -678,57 +680,61 @@ public:
|
|||||||
bool m_isBeingDeleted; // Fudge because can't access parent
|
bool m_isBeingDeleted; // Fudge because can't access parent
|
||||||
// when being deleted
|
// when being deleted
|
||||||
|
|
||||||
|
private:
|
||||||
|
// common part of all ctors
|
||||||
|
void Init();
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
//// INLINES
|
//// INLINES
|
||||||
|
|
||||||
inline void *wxWindow::GetHandle(void) const { return (void *)GetHWND(); }
|
inline void *wxWindow::GetHandle() const { return (void *)GetHWND(); }
|
||||||
inline int wxWindow::GetId() const { return m_windowId; }
|
inline int wxWindow::GetId() const { return m_windowId; }
|
||||||
inline void wxWindow::SetId(int id) { m_windowId = id; }
|
inline void wxWindow::SetId(int id) { m_windowId = id; }
|
||||||
inline wxWindow *wxWindow::GetParent(void) const { return m_windowParent; }
|
inline wxWindow *wxWindow::GetParent() const { return m_windowParent; }
|
||||||
inline void wxWindow::SetParent(wxWindow *p) { m_windowParent = p; }
|
inline void wxWindow::SetParent(wxWindow *p) { m_windowParent = p; }
|
||||||
inline wxWindow *wxWindow::GetGrandParent(void) const { return (m_windowParent ? m_windowParent->m_windowParent : NULL); }
|
inline wxWindow *wxWindow::GetGrandParent() const { return (m_windowParent ? m_windowParent->m_windowParent : NULL); }
|
||||||
inline wxList *wxWindow::GetChildren() const { return m_children; }
|
inline wxList *wxWindow::GetChildren() const { return m_children; }
|
||||||
inline wxFont *wxWindow::GetFont(void) const { return (wxFont *) & m_windowFont; }
|
inline wxFont *wxWindow::GetFont() const { return (wxFont *) & m_windowFont; }
|
||||||
inline wxString wxWindow::GetName(void) const { return m_windowName; }
|
inline wxString wxWindow::GetName() const { return m_windowName; }
|
||||||
inline void wxWindow::SetName(const wxString& name) { m_windowName = name; }
|
inline void wxWindow::SetName(const wxString& name) { m_windowName = name; }
|
||||||
inline long wxWindow::GetWindowStyleFlag(void) const { return m_windowStyle; }
|
inline long wxWindow::GetWindowStyleFlag() const { return m_windowStyle; }
|
||||||
inline void wxWindow::SetWindowStyleFlag(long flag) { m_windowStyle = flag; }
|
inline void wxWindow::SetWindowStyleFlag(long flag) { m_windowStyle = flag; }
|
||||||
inline void wxWindow::SetDoubleClick(bool flag) { m_doubleClickAllowed = flag; }
|
inline void wxWindow::SetDoubleClick(bool flag) { m_doubleClickAllowed = flag; }
|
||||||
inline bool wxWindow::GetDoubleClick(void) const { return m_doubleClickAllowed; }
|
inline bool wxWindow::GetDoubleClick() const { return m_doubleClickAllowed; }
|
||||||
inline void wxWindow::SetEventHandler(wxEvtHandler *handler) { m_windowEventHandler = handler; }
|
inline void wxWindow::SetEventHandler(wxEvtHandler *handler) { m_windowEventHandler = handler; }
|
||||||
inline wxEvtHandler *wxWindow::GetEventHandler(void) const { return m_windowEventHandler; }
|
inline wxEvtHandler *wxWindow::GetEventHandler() const { return m_windowEventHandler; }
|
||||||
inline void wxWindow::SetAutoLayout(bool a) { m_autoLayout = a; }
|
inline void wxWindow::SetAutoLayout(bool a) { m_autoLayout = a; }
|
||||||
inline bool wxWindow::GetAutoLayout(void) const { return m_autoLayout; }
|
inline bool wxWindow::GetAutoLayout() const { return m_autoLayout; }
|
||||||
inline wxLayoutConstraints *wxWindow::GetConstraints(void) const { return m_constraints; }
|
inline wxLayoutConstraints *wxWindow::GetConstraints() const { return m_constraints; }
|
||||||
inline void wxWindow::SetBackgroundColour(const wxColour& col) { m_backgroundColour = col; };
|
inline void wxWindow::SetBackgroundColour(const wxColour& col) { m_backgroundColour = col; };
|
||||||
inline wxColour wxWindow::GetBackgroundColour(void) const { return m_backgroundColour; };
|
inline wxColour wxWindow::GetBackgroundColour() const { return m_backgroundColour; };
|
||||||
inline void wxWindow::SetForegroundColour(const wxColour& col) { m_foregroundColour = col; };
|
inline void wxWindow::SetForegroundColour(const wxColour& col) { m_foregroundColour = col; };
|
||||||
inline wxColour wxWindow::GetForegroundColour(void) const { return m_foregroundColour; };
|
inline wxColour wxWindow::GetForegroundColour() const { return m_foregroundColour; };
|
||||||
|
|
||||||
inline wxButton *wxWindow::GetDefaultItem(void) const { return m_defaultItem; }
|
inline wxButton *wxWindow::GetDefaultItem() const { return m_defaultItem; }
|
||||||
inline void wxWindow::SetDefaultItem(wxButton *but) { m_defaultItem = but; }
|
inline void wxWindow::SetDefaultItem(wxButton *but) { m_defaultItem = but; }
|
||||||
inline bool wxWindow::IsRetained(void) const { return ((m_windowStyle & wxRETAINED) == wxRETAINED); }
|
inline bool wxWindow::IsRetained() const { return ((m_windowStyle & wxRETAINED) == wxRETAINED); }
|
||||||
|
|
||||||
inline void wxWindow::SetShowing(bool show) { m_isShown = show; }
|
inline void wxWindow::SetShowing(bool show) { m_isShown = show; }
|
||||||
inline wxList *wxWindow::GetConstraintsInvolvedIn(void) const { return m_constraintsInvolvedIn; }
|
inline wxList *wxWindow::GetConstraintsInvolvedIn() const { return m_constraintsInvolvedIn; }
|
||||||
inline wxSizer *wxWindow::GetSizer(void) const { return m_windowSizer; }
|
inline wxSizer *wxWindow::GetSizer() const { return m_windowSizer; }
|
||||||
inline wxWindow *wxWindow::GetSizerParent(void) const { return m_sizerParent; }
|
inline wxWindow *wxWindow::GetSizerParent() const { return m_sizerParent; }
|
||||||
inline void wxWindow::SetSizerParent(wxWindow *win) { m_sizerParent = win; }
|
inline void wxWindow::SetSizerParent(wxWindow *win) { m_sizerParent = win; }
|
||||||
inline WXFARPROC wxWindow::MSWGetOldWndProc() const { return m_oldWndProc; }
|
inline WXFARPROC wxWindow::MSWGetOldWndProc() const { return m_oldWndProc; }
|
||||||
inline void wxWindow::MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; }
|
inline void wxWindow::MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; }
|
||||||
inline wxValidator *wxWindow::GetValidator(void) const { return m_windowValidator; }
|
inline wxValidator *wxWindow::GetValidator() const { return m_windowValidator; }
|
||||||
inline bool wxWindow::IsUserEnabled(void) const { return m_winEnabled; }
|
inline bool wxWindow::IsUserEnabled() const { return m_winEnabled; }
|
||||||
inline bool wxWindow::GetUseCtl3D(void) const { return m_useCtl3D; }
|
inline bool wxWindow::GetUseCtl3D() const { return m_useCtl3D; }
|
||||||
inline bool wxWindow::GetTransparentBackground(void) const { return m_backgroundTransparent; }
|
inline bool wxWindow::GetTransparentBackground() const { return m_backgroundTransparent; }
|
||||||
inline void wxWindow::SetReturnCode(int retCode) { m_returnCode = retCode; }
|
inline void wxWindow::SetReturnCode(int retCode) { m_returnCode = retCode; }
|
||||||
inline int wxWindow::GetReturnCode(void) { return m_returnCode; }
|
inline int wxWindow::GetReturnCode() { return m_returnCode; }
|
||||||
inline bool wxWindow::IsBeingDeleted(void) { return m_isBeingDeleted; }
|
inline bool wxWindow::IsBeingDeleted() { return m_isBeingDeleted; }
|
||||||
|
|
||||||
// Window specific (so far)
|
// Window specific (so far)
|
||||||
WXDLLEXPORT wxWindow* wxGetActiveWindow(void);
|
WXDLLEXPORT wxWindow* wxGetActiveWindow();
|
||||||
|
|
||||||
WXDLLEXPORT_DATA(extern wxList) wxTopLevelWindows;
|
WXDLLEXPORT_DATA(extern wxList) wxTopLevelWindows;
|
||||||
|
|
||||||
@@ -736,7 +742,7 @@ WXDLLEXPORT int wxCharCodeMSWToWX(int keySym);
|
|||||||
WXDLLEXPORT int wxCharCodeWXToMSW(int id, bool *IsVirtual);
|
WXDLLEXPORT int wxCharCodeWXToMSW(int id, bool *IsVirtual);
|
||||||
|
|
||||||
// Allocates control ids
|
// Allocates control ids
|
||||||
WXDLLEXPORT int NewControlId(void);
|
WXDLLEXPORT int NewControlId();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_WINDOW_H_
|
// _WX_WINDOW_H_
|
||||||
|
@@ -28,6 +28,11 @@
|
|||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
|
|
||||||
|
// there are just too many of those...
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(disable:4706) // assignment within conditional expression
|
||||||
|
#endif // VC++
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -1545,5 +1550,9 @@ bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
|
|||||||
pattern++;
|
pattern++;
|
||||||
return ((*str == '\0') && (*pattern == '\0'));
|
return ((*str == '\0') && (*pattern == '\0'));
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(default:4706) // assignment within conditional expression
|
||||||
|
#endif // VC++
|
@@ -328,7 +328,7 @@ wxString wxColourDatabase::FindName (const wxColour& colour) const
|
|||||||
|
|
||||||
if (col->Red () == red && col->Green () == green && col->Blue () == blue)
|
if (col->Red () == red && col->Green () == green && col->Blue () == blue)
|
||||||
{
|
{
|
||||||
char *found = node->key.string;
|
const char *found = node->GetKeyString();
|
||||||
if (found)
|
if (found)
|
||||||
return wxString(found);
|
return wxString(found);
|
||||||
}
|
}
|
||||||
@@ -621,12 +621,6 @@ wxSize wxGetDisplaySize()
|
|||||||
return wxSize(x, y);
|
return wxSize(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxResourceCache::wxResourceCache () : wxList() {
|
|
||||||
}
|
|
||||||
|
|
||||||
wxResourceCache::wxResourceCache (const unsigned int the_key_type) : wxList(the_key_type) {
|
|
||||||
}
|
|
||||||
|
|
||||||
wxResourceCache::~wxResourceCache () {
|
wxResourceCache::~wxResourceCache () {
|
||||||
wxNode *node = First ();
|
wxNode *node = First ();
|
||||||
while (node) {
|
while (node) {
|
||||||
|
@@ -275,10 +275,8 @@ bool wxMsgCatalog::Load(const char *szDirPrefix, const char *szName)
|
|||||||
// examine header
|
// examine header
|
||||||
bool bValid = (size_t)nSize > sizeof(wxMsgCatalogHeader);
|
bool bValid = (size_t)nSize > sizeof(wxMsgCatalogHeader);
|
||||||
|
|
||||||
wxMsgCatalogHeader *pHeader;
|
wxMsgCatalogHeader *pHeader = (wxMsgCatalogHeader *)m_pData;
|
||||||
if ( bValid ) {
|
if ( bValid ) {
|
||||||
pHeader = (wxMsgCatalogHeader *)m_pData;
|
|
||||||
|
|
||||||
// we'll have to swap all the integers if it's true
|
// we'll have to swap all the integers if it's true
|
||||||
m_bSwapped = pHeader->magic == MSGCATALOG_MAGIC_SW;
|
m_bSwapped = pHeader->magic == MSGCATALOG_MAGIC_SW;
|
||||||
|
|
||||||
|
@@ -1,14 +1,21 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: list.cpp
|
// Name: list.cpp
|
||||||
// Purpose: wxList implementation
|
// Purpose: wxList implementation
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by: VZ at 16/11/98: WX_DECLARE_LIST() and typesafe lists added
|
||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// =============================================================================
|
||||||
|
// declarations
|
||||||
|
// =============================================================================
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "list.h"
|
#pragma implementation "list.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -20,11 +27,14 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
#include "wx/list.h"
|
#include "wx/list.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h" // for copystring() (beurk...)
|
||||||
#include <wx/intl.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Sun CC compatibility (interference with xview/pkg.h, apparently...)
|
// Sun CC compatibility (interference with xview/pkg.h, apparently...)
|
||||||
@@ -35,371 +45,343 @@
|
|||||||
#undef va_list
|
#undef va_list
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdarg.h>
|
// =============================================================================
|
||||||
#include <stdlib.h>
|
// implementation
|
||||||
#include <string.h>
|
// =============================================================================
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
// -----------------------------------------------------------------------------
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxNode, wxObject)
|
// wxNodeBase
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxList, wxObject)
|
// -----------------------------------------------------------------------------
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxStringList, wxList)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
wxNode::wxNode (wxList * the_list, wxNode * last_one, wxNode * next_one,
|
wxNodeBase::wxNodeBase(wxListBase *list,
|
||||||
wxObject * object)
|
wxNodeBase *previous, wxNodeBase *next,
|
||||||
|
void *data, const wxListKey& key)
|
||||||
{
|
{
|
||||||
data = object;
|
m_list = list;
|
||||||
previous = last_one;
|
m_data = data;
|
||||||
next = next_one;
|
m_previous = previous;
|
||||||
list = the_list;
|
m_next = next;
|
||||||
key.string = (char *) NULL;
|
|
||||||
|
|
||||||
if (previous)
|
switch ( key.GetKeyType() )
|
||||||
previous->next = this;
|
|
||||||
|
|
||||||
if (next)
|
|
||||||
next->previous = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keyed constructor
|
|
||||||
wxNode::wxNode (wxList * the_list, wxNode * last_one, wxNode * next_one,
|
|
||||||
wxObject * object, long the_key)
|
|
||||||
{
|
{
|
||||||
data = object;
|
case wxKEY_NONE:
|
||||||
previous = last_one;
|
|
||||||
next = next_one;
|
|
||||||
list = the_list;
|
|
||||||
key.integer = the_key;
|
|
||||||
|
|
||||||
if (previous)
|
|
||||||
previous->next = this;
|
|
||||||
|
|
||||||
if (next)
|
|
||||||
next->previous = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxNode::wxNode (wxList * the_list, wxNode * last_one, wxNode * next_one,
|
|
||||||
wxObject * object, const char *the_key)
|
|
||||||
{
|
|
||||||
data = object;
|
|
||||||
previous = last_one;
|
|
||||||
next = next_one;
|
|
||||||
list = the_list;
|
|
||||||
key.string = copystring (the_key);
|
|
||||||
|
|
||||||
if (previous)
|
|
||||||
previous->next = this;
|
|
||||||
|
|
||||||
if (next)
|
|
||||||
next->previous = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxNode::~wxNode (void)
|
|
||||||
{
|
|
||||||
if (list)
|
|
||||||
list->n--;
|
|
||||||
|
|
||||||
if (list && list->destroy_data)
|
|
||||||
delete data;
|
|
||||||
|
|
||||||
if (list && list->key_type == wxKEY_STRING && key.string)
|
|
||||||
delete[]key.string;
|
|
||||||
|
|
||||||
// Make next node point back to the previous node from here
|
|
||||||
if (next)
|
|
||||||
next->previous = previous;
|
|
||||||
else if (list)
|
|
||||||
// If there's a new end of list (deleting the last one)
|
|
||||||
// make sure the list knows about it.
|
|
||||||
list->last_node = previous;
|
|
||||||
|
|
||||||
// Make the previous node point to the next node from here
|
|
||||||
if (previous)
|
|
||||||
previous->next = next;
|
|
||||||
|
|
||||||
// Or if no previous node (start of list), make sure list points at
|
|
||||||
// the next node which becomes the first!.
|
|
||||||
else if (list)
|
|
||||||
list->first_node = next;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxList::wxList (void)
|
|
||||||
{
|
|
||||||
first_node = (wxNode *) NULL;
|
|
||||||
last_node = (wxNode *) NULL;
|
|
||||||
n = 0;
|
|
||||||
destroy_data = 0;
|
|
||||||
key_type = wxKEY_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxList::wxList (int N, wxObject * Objects[])
|
|
||||||
{
|
|
||||||
wxNode *last = (wxNode *) NULL;
|
|
||||||
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < N; i++)
|
|
||||||
{
|
|
||||||
wxNode *next = new wxNode (this, last, (wxNode *) NULL, Objects[i]);
|
|
||||||
last = next;
|
|
||||||
if (i == 0)
|
|
||||||
first_node = next;
|
|
||||||
}
|
|
||||||
last_node = last;
|
|
||||||
n = N;
|
|
||||||
key_type = wxKEY_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxList::wxList (const unsigned int the_key_type)
|
|
||||||
{
|
|
||||||
n = 0;
|
|
||||||
destroy_data = 0;
|
|
||||||
first_node = (wxNode *) NULL;
|
|
||||||
last_node = (wxNode *) NULL;
|
|
||||||
key_type = the_key_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Variable argument list, terminated by a zero
|
|
||||||
wxList::wxList (wxObject * first_one...)
|
|
||||||
{
|
|
||||||
// #ifndef __SGI__
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
va_start (ap, first_one);
|
|
||||||
|
|
||||||
wxNode *last = new wxNode (this, (wxNode *) NULL, (wxNode *) NULL, first_one);
|
|
||||||
first_node = last;
|
|
||||||
n = 1;
|
|
||||||
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
wxObject *object = va_arg (ap, wxObject *);
|
|
||||||
// if (object == NULL) // Doesn't work in Windows -- segment is non-zero for NULL!
|
|
||||||
#ifdef __WXMSW__
|
|
||||||
if ((int) object == 0)
|
|
||||||
#else
|
|
||||||
if ((long) object == 0)
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
else
|
|
||||||
{
|
|
||||||
wxNode *node = new wxNode (this, last, (wxNode *) NULL, object);
|
|
||||||
last = node;
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
last_node = last;
|
|
||||||
va_end (ap);
|
|
||||||
|
|
||||||
destroy_data = 0;
|
case wxKEY_INTEGER:
|
||||||
key_type = wxKEY_NONE;
|
m_key.integer = key.GetNumber();
|
||||||
/*
|
break;
|
||||||
#else
|
|
||||||
fprintf (stderr, "Error: cannot use variable-argument functions on SGI!\n");
|
case wxKEY_STRING:
|
||||||
#endif
|
// to be free()d later
|
||||||
*/
|
m_key.string = strdup(key.GetString());
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
wxFAIL_MSG("invalid key type");
|
||||||
}
|
}
|
||||||
|
|
||||||
wxList::~wxList (void)
|
if ( previous )
|
||||||
|
previous->m_next = this;
|
||||||
|
|
||||||
|
if ( next )
|
||||||
|
next->m_previous = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxNodeBase::~wxNodeBase()
|
||||||
{
|
{
|
||||||
wxNode *each = first_node;
|
// handle the case when we're being deleted from the list by the user (i.e.
|
||||||
while (each)
|
// not by the list itself from DeleteNode) - we must do it for
|
||||||
|
// compatibility with old code
|
||||||
|
if ( m_list != NULL )
|
||||||
{
|
{
|
||||||
wxNode *next = each->Next ();
|
m_list->DetachNode(this);
|
||||||
delete each;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// wxListBase
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxListBase::Init(wxKeyType keyType = wxKEY_NONE)
|
||||||
|
{
|
||||||
|
m_nodeFirst =
|
||||||
|
m_nodeLast = (wxNodeBase *) NULL;
|
||||||
|
m_count = 0;
|
||||||
|
m_destroy = FALSE;
|
||||||
|
m_keyType = keyType;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxListBase::wxListBase(size_t count, void *elements[])
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
|
||||||
|
for ( size_t n = 0; n < count; n++ )
|
||||||
|
{
|
||||||
|
Append(elements[n]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxListBase::DoCopy(const wxListBase& list)
|
||||||
|
{
|
||||||
|
wxASSERT_MSG( !list.m_destroy,
|
||||||
|
"copying list which owns it's elements is a bad idea" );
|
||||||
|
|
||||||
|
m_count = list.m_count;
|
||||||
|
m_destroy = list.m_destroy;
|
||||||
|
m_keyType = list.m_keyType;
|
||||||
|
m_nodeFirst =
|
||||||
|
m_nodeLast = (wxNodeBase *) NULL;
|
||||||
|
|
||||||
|
for ( wxNodeBase *node = list.GetFirst(); node; node = node->GetNext() )
|
||||||
|
{
|
||||||
|
Append(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wxListBase::~wxListBase()
|
||||||
|
{
|
||||||
|
wxNodeBase *each = m_nodeFirst;
|
||||||
|
while ( each != NULL )
|
||||||
|
{
|
||||||
|
wxNodeBase *next = each->GetNext();
|
||||||
|
DoDeleteNode(each);
|
||||||
each = next;
|
each = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxNode *wxList::Append(wxObject *object)
|
wxNodeBase *wxListBase::AppendCommon(wxNodeBase *node)
|
||||||
{
|
{
|
||||||
wxNode *node = new wxNode(this, last_node, (wxNode *) NULL, object);
|
if ( !m_nodeFirst )
|
||||||
if (!first_node)
|
{
|
||||||
first_node = node;
|
m_nodeFirst = node;
|
||||||
last_node = node;
|
m_nodeLast = m_nodeFirst;
|
||||||
n ++;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_nodeLast->m_next = node;
|
||||||
|
m_nodeLast = node;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_count++;
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxNode *wxList::Nth (int i) const
|
wxNodeBase *wxListBase::Append(void *object)
|
||||||
{
|
{
|
||||||
int j = 0;
|
// all objects in a keyed list should have a key
|
||||||
for (wxNode * current = First (); current; current = current->Next ())
|
wxCHECK_MSG( m_keyType == wxKEY_NONE, (wxNodeBase *)NULL,
|
||||||
|
"need a key for the object to append" );
|
||||||
|
|
||||||
|
wxNodeBase *node = CreateNode(m_nodeLast, (wxNodeBase *)NULL, object);
|
||||||
|
|
||||||
|
return AppendCommon(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxNodeBase *wxListBase::Append(long key, void *object)
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( (m_keyType == wxKEY_INTEGER) ||
|
||||||
|
(m_keyType == wxKEY_NONE && m_count == 0),
|
||||||
|
(wxNodeBase *)NULL,
|
||||||
|
"can't append object with numeric key to this list" );
|
||||||
|
|
||||||
|
wxNodeBase *node = CreateNode(m_nodeLast, (wxNodeBase *)NULL, object, key);
|
||||||
|
return AppendCommon(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxNodeBase *wxListBase::Append (const char *key, void *object)
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( (m_keyType == wxKEY_STRING) ||
|
||||||
|
(m_keyType == wxKEY_NONE && m_count == 0),
|
||||||
|
(wxNodeBase *)NULL,
|
||||||
|
"can't append object with string key to this list" );
|
||||||
|
|
||||||
|
wxNodeBase *node = CreateNode(m_nodeLast, (wxNodeBase *)NULL, object, key);
|
||||||
|
return AppendCommon(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxNodeBase *wxListBase::Insert(wxNodeBase *position, void *object)
|
||||||
|
{
|
||||||
|
// all objects in a keyed list should have a key
|
||||||
|
wxCHECK_MSG( m_keyType == wxKEY_NONE, (wxNodeBase *)NULL,
|
||||||
|
"need a key for the object to insert" );
|
||||||
|
|
||||||
|
wxNodeBase *prev = (wxNodeBase *)NULL;
|
||||||
|
if ( position )
|
||||||
|
prev = position->GetPrevious();
|
||||||
|
//else
|
||||||
|
// inserting in the beginning of the list
|
||||||
|
|
||||||
|
wxNodeBase *node = CreateNode(prev, position, object);
|
||||||
|
if ( !m_nodeFirst )
|
||||||
|
{
|
||||||
|
m_nodeFirst = node;
|
||||||
|
m_nodeLast = node;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( prev == NULL )
|
||||||
|
{
|
||||||
|
m_nodeFirst = node;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_count++;
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxNodeBase *wxListBase::Item(size_t n) const
|
||||||
|
{
|
||||||
|
for ( wxNodeBase *current = GetFirst(); current; current = current->GetNext() )
|
||||||
|
{
|
||||||
|
if ( n-- == 0 )
|
||||||
{
|
{
|
||||||
if (j++ == i)
|
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
return (wxNode *) NULL; // No such element
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxNode *wxList::Find (long key) const
|
wxFAIL_MSG( "invalid index in wxListBase::Item" );
|
||||||
{
|
|
||||||
wxNode *current = First();
|
return NULL;
|
||||||
while (current)
|
|
||||||
{
|
|
||||||
if (current->key.integer == key)
|
|
||||||
return current;
|
|
||||||
current = current->Next();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (wxNode *) NULL; // Not found!
|
wxNodeBase *wxListBase::Find(const wxListKey& key) const
|
||||||
}
|
{
|
||||||
|
wxASSERT_MSG( m_keyType == key.GetKeyType(),
|
||||||
|
"this list is not keyed on the type of this key" );
|
||||||
|
|
||||||
wxNode *wxList::Find (const char *key) const
|
for ( wxNodeBase *current = GetFirst(); current; current = current->GetNext() )
|
||||||
{
|
{
|
||||||
wxNode *current = First();
|
if ( key == current->m_key )
|
||||||
while (current)
|
|
||||||
{
|
{
|
||||||
if (!current->key.string)
|
|
||||||
{
|
|
||||||
wxFatalError (_("wxList: string key not present, probably did not Append correctly!"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (strcmp (current->key.string, key) == 0)
|
|
||||||
return current;
|
|
||||||
current = current->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
return (wxNode *) NULL; // Not found!
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
wxNode *wxList::Member (wxObject * object) const
|
|
||||||
{
|
|
||||||
for (wxNode * current = First (); current; current = current->Next ())
|
|
||||||
{
|
|
||||||
wxObject *each = current->Data ();
|
|
||||||
if (each == object)
|
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
return (wxNode *) NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxList::DeleteNode (wxNode * node)
|
// not found
|
||||||
|
return (wxNodeBase *)NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxNodeBase *wxListBase::Find(void *object) const
|
||||||
{
|
{
|
||||||
if (node)
|
for ( wxNodeBase *current = GetFirst(); current; current = current->GetNext() )
|
||||||
{
|
{
|
||||||
|
if ( current->GetData() == object )
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
// not found
|
||||||
|
return (wxNodeBase *)NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxListBase::DoDeleteNode(wxNodeBase *node)
|
||||||
|
{
|
||||||
|
// free node's data
|
||||||
|
if ( m_keyType == wxKEY_STRING )
|
||||||
|
{
|
||||||
|
free(node->m_key.string);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_destroy )
|
||||||
|
{
|
||||||
|
node->DeleteData();
|
||||||
|
}
|
||||||
|
|
||||||
delete node;
|
delete node;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxNodeBase *wxListBase::DetachNode(wxNodeBase *node)
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( node, NULL, "detaching NULL wxNodeBase" );
|
||||||
|
wxCHECK_MSG( node->m_list == this, NULL,
|
||||||
|
"detaching node which is not from this list" );
|
||||||
|
|
||||||
|
// update the list
|
||||||
|
wxNodeBase **prevNext = node->GetPrevious() ? &node->GetPrevious()->m_next
|
||||||
|
: &m_nodeFirst;
|
||||||
|
wxNodeBase **nextPrev = node->GetNext() ? &node->GetNext()->m_previous
|
||||||
|
: &m_nodeLast;
|
||||||
|
|
||||||
|
*prevNext = node->GetNext();
|
||||||
|
*nextPrev = node->GetPrevious();
|
||||||
|
|
||||||
|
m_count--;
|
||||||
|
|
||||||
|
// mark the node as not belonging to this list any more
|
||||||
|
node->m_list = NULL;
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxListBase::DeleteNode(wxNodeBase *node)
|
||||||
|
{
|
||||||
|
if ( !DetachNode(node) )
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
DoDeleteNode(node);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxListBase::DeleteObject(void *object)
|
||||||
|
{
|
||||||
|
for ( wxNodeBase *current = GetFirst(); current; current = current->GetNext() )
|
||||||
|
{
|
||||||
|
if ( current->GetData() == object )
|
||||||
|
{
|
||||||
|
DeleteNode(current);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// not found
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxList::DeleteObject (wxObject * object)
|
|
||||||
|
void wxListBase::Clear()
|
||||||
{
|
{
|
||||||
// Search list for object
|
wxNodeBase *current = m_nodeFirst;
|
||||||
for (wxNode * current = first_node; current; current = current->Next ())
|
|
||||||
{
|
|
||||||
if (current->Data () == object)
|
|
||||||
{
|
|
||||||
delete current;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return FALSE; // Did not find the object
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Insert new node at front of list
|
|
||||||
wxNode *wxList::Insert (wxObject * object)
|
|
||||||
{
|
|
||||||
wxNode *node = new wxNode (this, (wxNode *) NULL, First (), object);
|
|
||||||
first_node = node;
|
|
||||||
|
|
||||||
if (!(node->Next ()))
|
|
||||||
last_node = node;
|
|
||||||
|
|
||||||
n++;
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Insert new node before given node.
|
|
||||||
wxNode *wxList::Insert (wxNode * position, wxObject * object)
|
|
||||||
{
|
|
||||||
wxNode *prev = (wxNode *) NULL;
|
|
||||||
if (position)
|
|
||||||
prev = position->Previous ();
|
|
||||||
|
|
||||||
wxNode *node = new wxNode (this, prev, position, object);
|
|
||||||
if (!first_node)
|
|
||||||
{
|
|
||||||
first_node = node;
|
|
||||||
last_node = node;
|
|
||||||
}
|
|
||||||
if (!prev)
|
|
||||||
first_node = node;
|
|
||||||
|
|
||||||
n++;
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keyed append
|
|
||||||
wxNode *wxList::Append (long key, wxObject * object)
|
|
||||||
{
|
|
||||||
wxNode *node = new wxNode (this, last_node, (wxNode *) NULL, object, key);
|
|
||||||
if (!first_node)
|
|
||||||
first_node = node;
|
|
||||||
last_node = node;
|
|
||||||
n++;
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxNode *wxList::Append (const char *key, wxObject * object)
|
|
||||||
{
|
|
||||||
wxNode *node = new wxNode (this, last_node, (wxNode *) NULL, object, key);
|
|
||||||
if (!first_node)
|
|
||||||
first_node = node;
|
|
||||||
last_node = node;
|
|
||||||
n++;
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxList::Clear (void)
|
|
||||||
{
|
|
||||||
wxNode *current = first_node;
|
|
||||||
while ( current )
|
while ( current )
|
||||||
{
|
{
|
||||||
wxNode *next = current->Next ();
|
wxNodeBase *next = current->GetNext();
|
||||||
delete current;
|
DoDeleteNode(current);
|
||||||
current = next;
|
current = next;
|
||||||
}
|
}
|
||||||
first_node = (wxNode *) NULL;
|
|
||||||
last_node = (wxNode *) NULL;
|
m_nodeFirst =
|
||||||
n = 0;
|
m_nodeLast = (wxNodeBase *)NULL;
|
||||||
|
|
||||||
|
m_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Executes function F with all items present in the list
|
void wxListBase::ForEach(wxListIterateFunction F)
|
||||||
void wxList::ForEach(wxListIterateFunction F)
|
|
||||||
{
|
{
|
||||||
wxNode *each = first_node;
|
for ( wxNodeBase *current = GetFirst(); current; current = current->GetNext() )
|
||||||
while (each)
|
|
||||||
{ (*F)( each->Data ());
|
|
||||||
each = each->Next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Returns a pointer to the item which returns TRUE with function F
|
|
||||||
// or NULL if no such item found
|
|
||||||
wxObject *wxList::FirstThat(wxListIterateFunction F)
|
|
||||||
{
|
{
|
||||||
wxNode *each = first_node;
|
(*F)(current->GetData());
|
||||||
while (each)
|
|
||||||
{ if ((*F)( each->Data ())) return each->Data();
|
|
||||||
each = each->Next();
|
|
||||||
}
|
}
|
||||||
return (wxNode *) NULL;
|
|
||||||
}
|
}
|
||||||
// Like FirstThat, but proceeds from the end backward
|
|
||||||
wxObject *wxList::LastThat(wxListIterateFunction F)
|
void *wxListBase::FirstThat(wxListIterateFunction F)
|
||||||
{
|
{
|
||||||
wxNode *each = last_node;
|
for ( wxNodeBase *current = GetFirst(); current; current = current->GetNext() )
|
||||||
while (each)
|
{
|
||||||
{ if ((*F)( each->Data ())) return each->Data();
|
if ( (*F)(current->GetData()) )
|
||||||
each = each->Previous();
|
return current->GetData();
|
||||||
}
|
}
|
||||||
return (wxNode *) NULL;
|
|
||||||
|
return (wxNodeBase *)NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *wxListBase::LastThat(wxListIterateFunction F)
|
||||||
|
{
|
||||||
|
for ( wxNodeBase *current = GetLast(); current; current = current->GetPrevious() )
|
||||||
|
{
|
||||||
|
if ( (*F)(current->GetData()) )
|
||||||
|
return current->GetData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (wxNodeBase *)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (stefan.hammes@urz.uni-heidelberg.de)
|
// (stefan.hammes@urz.uni-heidelberg.de)
|
||||||
@@ -422,7 +404,7 @@ wxObject *wxList::LastThat(wxListIterateFunction F)
|
|||||||
//
|
//
|
||||||
// void main()
|
// void main()
|
||||||
// {
|
// {
|
||||||
// wxList list;
|
// wxListBase list;
|
||||||
//
|
//
|
||||||
// list.Append(new wxString("DEF"));
|
// list.Append(new wxString("DEF"));
|
||||||
// list.Append(new wxString("GHI"));
|
// list.Append(new wxString("GHI"));
|
||||||
@@ -430,72 +412,70 @@ wxObject *wxList::LastThat(wxListIterateFunction F)
|
|||||||
// list.Sort(listcompare);
|
// list.Sort(listcompare);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
void wxList::Sort(const wxSortCompareFunction compfunc)
|
void wxListBase::Sort(const wxSortCompareFunction compfunc)
|
||||||
{
|
{
|
||||||
// allocate an array for the wxObject pointers of the list
|
// allocate an array for the wxObject pointers of the list
|
||||||
const size_t num = Number();
|
const size_t num = GetCount();
|
||||||
wxObject **objArray = new wxObject *[num];
|
void **objArray = new void *[num];
|
||||||
wxObject **objPtr = objArray;
|
void **objPtr = objArray;
|
||||||
|
|
||||||
// go through the list and put the pointers into the array
|
// go through the list and put the pointers into the array
|
||||||
wxNode *node = First();
|
wxNodeBase *node;
|
||||||
while(node!=NULL){
|
for ( node = GetFirst(); node; node = node->Next() )
|
||||||
|
{
|
||||||
*objPtr++ = node->Data();
|
*objPtr++ = node->Data();
|
||||||
node = node->Next();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort the array
|
// sort the array
|
||||||
qsort((void *)objArray,num,sizeof(wxObject *),compfunc);
|
qsort((void *)objArray,num,sizeof(wxObject *),compfunc);
|
||||||
|
|
||||||
// put the sorted pointers back into the list
|
// put the sorted pointers back into the list
|
||||||
objPtr = objArray;
|
objPtr = objArray;
|
||||||
node = First();
|
for ( node = GetFirst(); node; node = node->Next() )
|
||||||
while(node!=NULL){
|
{
|
||||||
node->SetData(*objPtr++);
|
node->SetData(*objPtr++);
|
||||||
node = node->Next();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// free the array
|
// free the array
|
||||||
delete[] objArray;
|
delete[] objArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// -----------------------------------------------------------------------------
|
||||||
* String list
|
// wxList (a.k.a. wxObjectList)
|
||||||
*
|
// -----------------------------------------------------------------------------
|
||||||
*/
|
|
||||||
|
|
||||||
wxStringList::wxStringList (void):
|
void wxObjectListNode::DeleteData()
|
||||||
wxList ()
|
|
||||||
{
|
{
|
||||||
|
delete (wxObject *)GetData();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxStringList::wxStringList (const wxStringList& list)
|
// -----------------------------------------------------------------------------
|
||||||
|
// wxStringList
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// instead of WX_DEFINE_LIST(wxStringListBase) we define this function
|
||||||
|
// ourselves
|
||||||
|
void wxStringListNode::DeleteData()
|
||||||
{
|
{
|
||||||
(*this) = list;
|
delete [] (char *)GetData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variable argument list, terminated by a zero
|
// Variable argument list, terminated by a zero
|
||||||
// Makes new storage for the strings
|
// Makes new storage for the strings
|
||||||
wxStringList::wxStringList (const char *first...)
|
wxStringList::wxStringList (const char *first, ...)
|
||||||
{
|
{
|
||||||
// #ifndef __SGI__
|
|
||||||
n = 0;
|
|
||||||
destroy_data = 0;
|
|
||||||
key_type = wxKEY_NONE;
|
|
||||||
first_node = (wxNode *) NULL;
|
|
||||||
last_node = (wxNode *) NULL;
|
|
||||||
|
|
||||||
if ( !first )
|
if ( !first )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, first);
|
va_start(ap, first);
|
||||||
|
|
||||||
wxNode *last = new wxNode (this, (wxNode *) NULL, (wxNode *) NULL, (wxObject *) copystring (first));
|
const char *s = first;
|
||||||
first_node = last;
|
|
||||||
n = 1;
|
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
char *s = va_arg (ap, char *);
|
Add(s);
|
||||||
|
|
||||||
|
s = va_arg(ap, const char *);
|
||||||
// if (s == NULL)
|
// if (s == NULL)
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
if ((int) s == 0)
|
if ((int) s == 0)
|
||||||
@@ -503,80 +483,42 @@ wxStringList::wxStringList (const char *first...)
|
|||||||
if ((long) s == 0)
|
if ((long) s == 0)
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
else
|
|
||||||
{
|
|
||||||
wxNode *node = new wxNode (this, last, (wxNode *) NULL, (wxObject *) copystring (s));
|
|
||||||
last = node;
|
|
||||||
n++;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
last_node = last;
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
/*
|
|
||||||
#else
|
|
||||||
fprintf (stderr, "Error: cannot use variable-argument functions on SGI!\n");
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
wxStringList::~wxStringList (void)
|
|
||||||
{
|
|
||||||
Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxStringList::Clear(void)
|
|
||||||
{
|
|
||||||
wxNode *each = First();
|
|
||||||
while (each)
|
|
||||||
{
|
|
||||||
char *s = (char *) each->Data ();
|
|
||||||
delete[]s;
|
|
||||||
wxNode *next = each->Next ();
|
|
||||||
delete each;
|
|
||||||
each = next;
|
|
||||||
}
|
|
||||||
wxList::Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
wxNode *wxStringList::Add (const char *s)
|
|
||||||
{
|
|
||||||
return Append ((wxObject *) (copystring (s)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxStringList::Delete (const char *s)
|
|
||||||
{
|
|
||||||
for (wxNode * node = First (); node; node = node->Next ())
|
|
||||||
{
|
|
||||||
char *string = (char *) node->Data ();
|
|
||||||
if (string == s || strcmp (string, s) == 0)
|
|
||||||
{
|
|
||||||
delete[]string;
|
|
||||||
delete node;
|
|
||||||
break; // Done!
|
|
||||||
|
|
||||||
}
|
|
||||||
} // for
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only makes new strings if arg is TRUE
|
// Only makes new strings if arg is TRUE
|
||||||
char **wxStringList::ListToArray(bool new_copies) const
|
char **wxStringList::ListToArray(bool new_copies) const
|
||||||
{
|
{
|
||||||
char **string_array = new char *[Number ()];
|
char **string_array = new char *[GetCount()];
|
||||||
wxNode *node = First ();
|
wxStringListNode *node = GetFirst();
|
||||||
int i;
|
for (size_t i = 0; i < GetCount(); i++)
|
||||||
for (i = 0; i < n; i++)
|
|
||||||
{
|
{
|
||||||
char *s = (char *) node->Data ();
|
char *s = node->GetData();
|
||||||
if ( new_copies )
|
if ( new_copies )
|
||||||
string_array[i] = copystring(s);
|
string_array[i] = copystring(s);
|
||||||
else
|
else
|
||||||
string_array[i] = s;
|
string_array[i] = s;
|
||||||
node = node->Next ();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return string_array;
|
return string_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checks whether s is a member of the list
|
||||||
|
bool wxStringList::Member(const char *s) const
|
||||||
|
{
|
||||||
|
for ( wxStringListNode *node = GetFirst(); node; node = node->GetNext() )
|
||||||
|
{
|
||||||
|
const char *s1 = node->GetData();
|
||||||
|
if (s == s1 || strcmp (s, s1) == 0)
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
wx_comparestrings(const void *arg1, const void *arg2)
|
wx_comparestrings(const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
@@ -587,53 +529,23 @@ wx_comparestrings (const void *arg1, const void *arg2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sort a list of strings - deallocates old nodes, allocates new
|
// Sort a list of strings - deallocates old nodes, allocates new
|
||||||
void wxStringList::Sort (void)
|
void wxStringList::Sort()
|
||||||
{
|
{
|
||||||
size_t N = n;
|
size_t N = GetCount();
|
||||||
char **array = new char *[N];
|
char **array = new char *[N];
|
||||||
|
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (wxNode * node = First (); node; node = node->Next ())
|
for ( wxStringListNode *node = GetFirst(); node; node = node->GetNext() )
|
||||||
array[i++] = (char *) node->Data ();
|
{
|
||||||
|
array[i++] = node->GetData();
|
||||||
|
}
|
||||||
|
|
||||||
qsort (array, N, sizeof (char *), wx_comparestrings);
|
qsort (array, N, sizeof (char *), wx_comparestrings);
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
for (i = 0; i < N; i++)
|
for (i = 0; i < N; i++)
|
||||||
Append ((wxObject *) (array[i]));
|
Append (array[i]);
|
||||||
|
|
||||||
delete[]array;
|
delete[]array;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks whether s is a member of the list
|
|
||||||
bool wxStringList::Member (const char *s) const
|
|
||||||
{
|
|
||||||
for (wxNode * node = First (); node; node = node->Next ())
|
|
||||||
{
|
|
||||||
const char *s1 = (const char *) node->Data ();
|
|
||||||
if (s == s1 || strcmp (s, s1) == 0)
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxStringList::operator= (const wxStringList& list)
|
|
||||||
{
|
|
||||||
Clear();
|
|
||||||
|
|
||||||
wxNode *node = list.First();
|
|
||||||
while (node)
|
|
||||||
{
|
|
||||||
char *s = (char *) node->Data ();
|
|
||||||
Add(s);
|
|
||||||
node = node->Next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
char* wxStringList::operator[] (int i) const
|
|
||||||
{
|
|
||||||
wxASSERT_MSG( (i < Number()), "Invalid index for wxStringList" );
|
|
||||||
|
|
||||||
return (char*) (Nth(i)->Data());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -25,6 +25,10 @@
|
|||||||
|
|
||||||
#if wxUSE_ODBC
|
#if wxUSE_ODBC
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(disable:4706) // assignment within conditional expression
|
||||||
|
#endif // VC++
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/dialog.h"
|
#include "wx/dialog.h"
|
||||||
@@ -1827,4 +1831,8 @@ bool wxQueryField::IsDirty(void) {
|
|||||||
return dirty;
|
return dirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(default:4706) // assignment within conditional expression
|
||||||
|
#endif // VC++
|
||||||
|
|
||||||
#endif // wxUSE_ODBC
|
#endif // wxUSE_ODBC
|
||||||
|
@@ -20,6 +20,12 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_WX_RESOURCES
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(disable:4706) // assignment within conditional expression
|
||||||
|
#endif // VC++
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
#include "wx/setup.h"
|
#include "wx/setup.h"
|
||||||
@@ -59,8 +65,6 @@
|
|||||||
|
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
|
||||||
#if wxUSE_WX_RESOURCES
|
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -2853,4 +2857,8 @@ wxControl *wxWindow::CreateItem(const wxItemResource *resource, const wxItemReso
|
|||||||
return table->CreateItem((wxWindow *)this, resource, parentResource);
|
return table->CreateItem((wxWindow *)this, resource, parentResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(default:4706) // assignment within conditional expression
|
||||||
|
#endif // VC++
|
||||||
|
|
||||||
#endif // wxUSE_WX_RESOURCES
|
#endif // wxUSE_WX_RESOURCES
|
||||||
|
@@ -195,7 +195,7 @@ void wxToolBarBase::AddSeparator ()
|
|||||||
{
|
{
|
||||||
wxToolBarTool *tool = new wxToolBarTool;
|
wxToolBarTool *tool = new wxToolBarTool;
|
||||||
tool->m_toolStyle = wxTOOL_STYLE_SEPARATOR;
|
tool->m_toolStyle = wxTOOL_STYLE_SEPARATOR;
|
||||||
m_tools.Append(tool);
|
m_tools.Append(-1, tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBarBase::ClearTools(void)
|
void wxToolBarBase::ClearTools(void)
|
||||||
|
@@ -50,10 +50,15 @@
|
|||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// use debug CRT functions for memory leak detections in VC++
|
// use debug CRT functions for memory leak detections in VC++ if we're not
|
||||||
/* Here we go again commenting it out. PLEASE don't
|
// using wxWindows own methods
|
||||||
* uncomment this again.
|
#if defined(__WXDEBUG__) && defined(_MSC_VER) && !wxUSE_GLOBAL_MEMORY_OPERATORS
|
||||||
#if defined(__WXDEBUG__) && defined(_MSC_VER)
|
#define wxUSE_VC_CRTDBG
|
||||||
|
#else
|
||||||
|
#undef wxUSE_VC_CRTDBG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef wxUSE_VC_CRTDBG
|
||||||
// VC++ uses this macro as debug/release mode indicator
|
// VC++ uses this macro as debug/release mode indicator
|
||||||
#ifndef _DEBUG
|
#ifndef _DEBUG
|
||||||
#define _DEBUG
|
#define _DEBUG
|
||||||
@@ -61,7 +66,6 @@
|
|||||||
|
|
||||||
#include <crtdbg.h>
|
#include <crtdbg.h>
|
||||||
#endif
|
#endif
|
||||||
*/
|
|
||||||
|
|
||||||
extern char *wxBuffer;
|
extern char *wxBuffer;
|
||||||
extern char *wxOsVersion;
|
extern char *wxOsVersion;
|
||||||
@@ -115,32 +119,12 @@ bool wxApp::Initialize()
|
|||||||
{
|
{
|
||||||
wxBuffer = new char[1500];
|
wxBuffer = new char[1500];
|
||||||
|
|
||||||
/* PLEASE don't uncomment this again. IT DOESN'T WORK when building
|
#ifdef wxUSE_VC_CRTDBG
|
||||||
* using the makefile.
|
|
||||||
#if defined(__WXDEBUG__) && defined(_MSC_VER)
|
|
||||||
// do check for memory leaks on program exit
|
// do check for memory leaks on program exit
|
||||||
// (another useful flag is _CRTDBG_DELAY_FREE_MEM_DF which doesn't free
|
// (another useful flag is _CRTDBG_DELAY_FREE_MEM_DF which doesn't free
|
||||||
// deallocated memory which may be used to simulate low-memory condition)
|
// deallocated memory which may be used to simulate low-memory condition)
|
||||||
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
|
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
|
||||||
#endif // debug build under MS VC++
|
#endif // debug build under MS VC++
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// 22/11/98: we're converting to wxLogDebug instead of wxTrace,
|
|
||||||
// so these are now obsolete.
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
|
|
||||||
#if defined(_WINDLL)
|
|
||||||
streambuf* sBuf = NULL;
|
|
||||||
#else // EXE
|
|
||||||
streambuf* sBuf = new wxDebugStreamBuf;
|
|
||||||
#endif // DLL
|
|
||||||
|
|
||||||
ostream* oStr = new ostream(sBuf) ;
|
|
||||||
wxDebugContext::SetStream(oStr, sBuf);
|
|
||||||
#endif // wxUSE_MEMORY_TRACING
|
|
||||||
#endif
|
|
||||||
|
|
||||||
wxClassInfo::InitializeClasses();
|
wxClassInfo::InitializeClasses();
|
||||||
|
|
||||||
|
@@ -741,19 +741,19 @@ bool wxXPMFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type
|
|||||||
#if wxUSE_XPM_IN_MSW
|
#if wxUSE_XPM_IN_MSW
|
||||||
HDC dc = NULL;
|
HDC dc = NULL;
|
||||||
|
|
||||||
Visual *visual = NULL;
|
|
||||||
XImage ximage;
|
XImage ximage;
|
||||||
|
|
||||||
dc = CreateCompatibleDC(NULL);
|
dc = CreateCompatibleDC(NULL);
|
||||||
if (dc)
|
if (dc)
|
||||||
{
|
{
|
||||||
if (SelectObject(dc, (HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap))
|
if (SelectObject(dc, (HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap))
|
||||||
{ /* for following SetPixel */
|
{
|
||||||
|
/* for following SetPixel */
|
||||||
/* fill the XImage struct 'by hand' */
|
/* fill the XImage struct 'by hand' */
|
||||||
ximage.width = M_BITMAPHANDLERDATA->m_width;
|
ximage.width = M_BITMAPHANDLERDATA->m_width;
|
||||||
ximage.height = M_BITMAPHANDLERDATA->m_height;
|
ximage.height = M_BITMAPHANDLERDATA->m_height;
|
||||||
ximage.depth = M_BITMAPHANDLERDATA->m_depth;
|
ximage.depth = M_BITMAPHANDLERDATA->m_depth;
|
||||||
ximage.bitmap = (void *)M_BITMAPHANDLERDATA->m_hBitmap;
|
ximage.bitmap = (HBITMAP)M_BITMAPHANDLERDATA->m_hBitmap;
|
||||||
int errorStatus = XpmWriteFileFromImage(&dc, WXSTRINGCAST name,
|
int errorStatus = XpmWriteFileFromImage(&dc, WXSTRINGCAST name,
|
||||||
&ximage, (XImage *) NULL, (XpmAttributes *) NULL);
|
&ximage, (XImage *) NULL, (XpmAttributes *) NULL);
|
||||||
|
|
||||||
|
@@ -240,6 +240,12 @@ void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
control_width = longest + cx*5;
|
control_width = longest + cx*5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If non-default width...
|
||||||
|
control_width = w1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Choice drop-down list depends on number of items (limited to 10)
|
// Choice drop-down list depends on number of items (limited to 10)
|
||||||
if (h1 <= 0)
|
if (h1 <= 0)
|
||||||
@@ -250,10 +256,6 @@ void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
h1 = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)*(wxMin(10, m_noStrings) + 1);
|
h1 = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)*(wxMin(10, m_noStrings) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If non-default width...
|
|
||||||
if (w1 >= 0)
|
|
||||||
control_width = w1;
|
|
||||||
|
|
||||||
control_height = h1;
|
control_height = h1;
|
||||||
|
|
||||||
// Calculations may have made text size too small
|
// Calculations may have made text size too small
|
||||||
|
@@ -185,7 +185,8 @@ long wxControl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
return wxWindow::MSWWindowProc(nMsg, wParam, lParam);
|
return wxWindow::MSWWindowProc(nMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxControl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
bool wxControl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam,
|
||||||
|
WXLPARAM* WXUNUSED(result))
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__)
|
#if defined(__WIN95__)
|
||||||
wxCommandEvent event(wxEVT_NULL, m_windowId);
|
wxCommandEvent event(wxEVT_NULL, m_windowId);
|
||||||
@@ -237,15 +238,15 @@ bool wxControl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
*/
|
*/
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event.SetEventType(eventType);
|
event.SetEventType(eventType);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
if ( !GetEventHandler()->ProcessEvent(event) )
|
if ( !GetEventHandler()->ProcessEvent(event) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#else
|
#else // !Win95
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -692,7 +692,7 @@ void wxDC::DrawText(const wxString& text, long x, long y, bool use16bit)
|
|||||||
if (m_textForegroundColour.Ok())
|
if (m_textForegroundColour.Ok())
|
||||||
SetTextColor((HDC) m_hDC, m_textForegroundColour.GetPixel() ) ;
|
SetTextColor((HDC) m_hDC, m_textForegroundColour.GetPixel() ) ;
|
||||||
|
|
||||||
DWORD old_background;
|
DWORD old_background = 0;
|
||||||
if (m_textBackgroundColour.Ok())
|
if (m_textBackgroundColour.Ok())
|
||||||
{
|
{
|
||||||
old_background = SetBkColor((HDC) m_hDC, m_textBackgroundColour.GetPixel() ) ;
|
old_background = SetBkColor((HDC) m_hDC, m_textBackgroundColour.GetPixel() ) ;
|
||||||
@@ -1132,7 +1132,7 @@ bool wxDC::Blit(long xdest, long ydest, long width, long height,
|
|||||||
rop == wxSRC_AND ? SRCAND :
|
rop == wxSRC_AND ? SRCAND :
|
||||||
SRCCOPY;
|
SRCCOPY;
|
||||||
|
|
||||||
bool success;
|
bool success = TRUE;
|
||||||
if (useMask && source->m_selectedBitmap.Ok() && source->m_selectedBitmap.GetMask())
|
if (useMask && source->m_selectedBitmap.Ok() && source->m_selectedBitmap.GetMask())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@@ -473,7 +473,8 @@ BOOL ReadDIB(LPSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette)
|
|||||||
goto ErrExit;
|
goto ErrExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(nNumColors = (WORD)lpbi->biClrUsed))
|
nNumColors = (WORD)lpbi->biClrUsed;
|
||||||
|
if ( nNumColors == 0 )
|
||||||
{
|
{
|
||||||
/* no color table for 24-bit, default size otherwise */
|
/* no color table for 24-bit, default size otherwise */
|
||||||
if (lpbi->biBitCount != 24)
|
if (lpbi->biBitCount != 24)
|
||||||
@@ -594,7 +595,8 @@ BOOL PASCAL MakeBitmapAndPalette(HDC hDC, HANDLE hDIB,
|
|||||||
lpInfo = (LPBITMAPINFOHEADER) GlobalLock(hDIB);
|
lpInfo = (LPBITMAPINFOHEADER) GlobalLock(hDIB);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((hPalette = MakeDIBPalette(lpInfo)))
|
hPalette = MakeDIBPalette(lpInfo);
|
||||||
|
if ( hPalette )
|
||||||
{
|
{
|
||||||
// Need to realize palette for converting DIB to bitmap.
|
// Need to realize palette for converting DIB to bitmap.
|
||||||
hOldPal = SelectPalette(hDC, hPalette, TRUE);
|
hOldPal = SelectPalette(hDC, hPalette, TRUE);
|
||||||
|
@@ -271,7 +271,8 @@ int wxFileDialog::ShowModal(void)
|
|||||||
extension = extension + strlen( extension ) +1;
|
extension = extension + strlen( extension ) +1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (extension = strrchr( extension, '.' )) // != "blabla"
|
extension = strrchr( extension, '.' );
|
||||||
|
if ( extension // != "blabla"
|
||||||
&& !strrchr( extension, '*' ) // != "blabla.*"
|
&& !strrchr( extension, '*' ) // != "blabla.*"
|
||||||
&& !strrchr( extension, '?' ) // != "blabla.?"
|
&& !strrchr( extension, '?' ) // != "blabla.?"
|
||||||
&& extension[1] // != "blabla."
|
&& extension[1] // != "blabla."
|
||||||
|
@@ -628,7 +628,7 @@ bool wxFrame::MSWOnPaint(void)
|
|||||||
HICON the_icon;
|
HICON the_icon;
|
||||||
if (m_icon.Ok())
|
if (m_icon.Ok())
|
||||||
the_icon = (HICON) m_icon.GetHICON();
|
the_icon = (HICON) m_icon.GetHICON();
|
||||||
if (the_icon == 0)
|
else
|
||||||
the_icon = (HICON) m_defaultIcon;
|
the_icon = (HICON) m_defaultIcon;
|
||||||
|
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
@@ -1037,7 +1037,6 @@ void wxFrame::PositionToolBar(void)
|
|||||||
// propagate our state change to all child frames
|
// propagate our state change to all child frames
|
||||||
void wxFrame::IconizeChildFrames(bool bIconize)
|
void wxFrame::IconizeChildFrames(bool bIconize)
|
||||||
{
|
{
|
||||||
wxWindow *child = NULL;
|
|
||||||
for ( wxNode *node = GetChildren()->First(); node; node = node->Next() ) {
|
for ( wxNode *node = GetChildren()->First(); node; node = node->Next() ) {
|
||||||
wxWindow *win = (wxWindow *)node->Data();
|
wxWindow *win = (wxWindow *)node->Data();
|
||||||
if ( win->IsKindOf(CLASSINFO(wxFrame)) ) {
|
if ( win->IsKindOf(CLASSINFO(wxFrame)) ) {
|
||||||
|
@@ -1111,22 +1111,31 @@ bool wxListCtrl::MSWCommand(WXUINT cmd, WXWORD id)
|
|||||||
else return FALSE;
|
else return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
|
||||||
{
|
{
|
||||||
wxListEvent event(wxEVT_NULL, m_windowId);
|
wxListEvent event(wxEVT_NULL, m_windowId);
|
||||||
wxEventType eventType = wxEVT_NULL;
|
wxEventType eventType = wxEVT_NULL;
|
||||||
NMHDR *hdr1 = (NMHDR *) lParam;
|
NMHDR *hdr1 = (NMHDR *) lParam;
|
||||||
switch ( hdr1->code )
|
switch ( hdr1->code )
|
||||||
{
|
{
|
||||||
|
case LVN_BEGINRDRAG:
|
||||||
|
eventType = wxEVT_COMMAND_LIST_BEGIN_RDRAG;
|
||||||
|
// fall through
|
||||||
|
|
||||||
case LVN_BEGINDRAG:
|
case LVN_BEGINDRAG:
|
||||||
|
if ( eventType == wxEVT_NULL )
|
||||||
{
|
{
|
||||||
eventType = wxEVT_COMMAND_LIST_BEGIN_DRAG;
|
eventType = wxEVT_COMMAND_LIST_BEGIN_DRAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
NM_LISTVIEW *hdr = (NM_LISTVIEW *)lParam;
|
NM_LISTVIEW *hdr = (NM_LISTVIEW *)lParam;
|
||||||
event.m_itemIndex = hdr->iItem;
|
event.m_itemIndex = hdr->iItem;
|
||||||
event.m_pointDrag.x = hdr->ptAction.x;
|
event.m_pointDrag.x = hdr->ptAction.x;
|
||||||
event.m_pointDrag.y = hdr->ptAction.y;
|
event.m_pointDrag.y = hdr->ptAction.y;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case LVN_BEGINLABELEDIT:
|
case LVN_BEGINLABELEDIT:
|
||||||
{
|
{
|
||||||
eventType = wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT;
|
eventType = wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT;
|
||||||
@@ -1134,15 +1143,7 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
wxConvertFromMSWListItem(this, event.m_item, info->item, (HWND) GetHWND());
|
wxConvertFromMSWListItem(this, event.m_item, info->item, (HWND) GetHWND());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LVN_BEGINRDRAG:
|
|
||||||
{
|
|
||||||
eventType = wxEVT_COMMAND_LIST_BEGIN_RDRAG;
|
|
||||||
NM_LISTVIEW* hdr = (NM_LISTVIEW*)lParam;
|
|
||||||
event.m_itemIndex = hdr->iItem;
|
|
||||||
event.m_pointDrag.x = hdr->ptAction.x;
|
|
||||||
event.m_pointDrag.y = hdr->ptAction.y;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case LVN_COLUMNCLICK:
|
case LVN_COLUMNCLICK:
|
||||||
{
|
{
|
||||||
eventType = wxEVT_COMMAND_LIST_COL_CLICK;
|
eventType = wxEVT_COMMAND_LIST_COL_CLICK;
|
||||||
@@ -1228,8 +1229,7 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
default :
|
default :
|
||||||
return wxControl::MSWNotify(wParam, lParam);
|
return wxControl::MSWNotify(wParam, lParam, result);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
@@ -1252,6 +1252,8 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
// wxConvertToMSWListItem(this, event.m_item, info->item);
|
// wxConvertToMSWListItem(this, event.m_item, info->item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*result = !event.IsAllowed();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1430,8 +1432,8 @@ static void wxConvertToMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_
|
|||||||
// List event
|
// List event
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxCommandEvent)
|
IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxCommandEvent)
|
||||||
|
|
||||||
wxListEvent::wxListEvent(wxEventType commandType, int id):
|
wxListEvent::wxListEvent(wxEventType commandType, int id)
|
||||||
wxCommandEvent(commandType, id)
|
: wxNotifyEvent(commandType, id)
|
||||||
{
|
{
|
||||||
m_code = 0;
|
m_code = 0;
|
||||||
m_itemIndex = 0;
|
m_itemIndex = 0;
|
||||||
|
@@ -595,8 +595,6 @@ long wxMDIParentFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARA
|
|||||||
|
|
||||||
bool wxMDIParentFrame::MSWProcessMessage(WXMSG* msg)
|
bool wxMDIParentFrame::MSWProcessMessage(WXMSG* msg)
|
||||||
{
|
{
|
||||||
MSG *pMsg = (MSG *)msg;
|
|
||||||
|
|
||||||
if ((m_currentChild != (wxWindow *)NULL) && (m_currentChild->GetHWND() != (WXHWND) NULL) && m_currentChild->MSWProcessMessage(msg))
|
if ((m_currentChild != (wxWindow *)NULL) && (m_currentChild->GetHWND() != (WXHWND) NULL) && m_currentChild->MSWProcessMessage(msg))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
@@ -231,10 +231,10 @@ void wxMenu::Append(int Id, const wxString& label,
|
|||||||
void wxMenu::Delete(int id)
|
void wxMenu::Delete(int id)
|
||||||
{
|
{
|
||||||
wxNode *node;
|
wxNode *node;
|
||||||
wxMenuItem *item;
|
|
||||||
int pos;
|
int pos;
|
||||||
HMENU menu;
|
HMENU menu;
|
||||||
|
|
||||||
|
wxMenuItem *item = NULL;
|
||||||
for (pos = 0, node = m_menuItems.First(); node; node = node->Next(), pos++) {
|
for (pos = 0, node = m_menuItems.First(); node; node = node->Next(), pos++) {
|
||||||
item = (wxMenuItem *)node->Data();
|
item = (wxMenuItem *)node->Data();
|
||||||
if (item->GetId() == id)
|
if (item->GetId() == id)
|
||||||
@@ -310,9 +310,9 @@ void wxMenu::SetTitle(const wxString& label)
|
|||||||
{
|
{
|
||||||
if ( !label.IsEmpty() )
|
if ( !label.IsEmpty() )
|
||||||
{
|
{
|
||||||
if ( !InsertMenu(hMenu, 0, MF_BYPOSITION | MF_STRING,
|
if ( !InsertMenu(hMenu, 0u, MF_BYPOSITION | MF_STRING,
|
||||||
idMenuTitle, m_title) ||
|
(unsigned)idMenuTitle, m_title) ||
|
||||||
!InsertMenu(hMenu, 1, MF_BYPOSITION, -1, NULL) )
|
!InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, NULL) )
|
||||||
{
|
{
|
||||||
wxLogLastError("InsertMenu");
|
wxLogLastError("InsertMenu");
|
||||||
}
|
}
|
||||||
@@ -332,9 +332,9 @@ void wxMenu::SetTitle(const wxString& label)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// modify the title
|
// modify the title
|
||||||
if ( !ModifyMenu(hMenu, 0,
|
if ( !ModifyMenu(hMenu, 0u,
|
||||||
MF_BYPOSITION | MF_STRING,
|
MF_BYPOSITION | MF_STRING,
|
||||||
idMenuTitle, m_title) )
|
(unsigned)idMenuTitle, m_title) )
|
||||||
{
|
{
|
||||||
wxLogLastError("ModifyMenu");
|
wxLogLastError("ModifyMenu");
|
||||||
}
|
}
|
||||||
@@ -667,7 +667,7 @@ bool wxMenuBar::Checked(int Id) const
|
|||||||
if (!item)
|
if (!item)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
int Flag ;
|
int Flag = 0;
|
||||||
|
|
||||||
if (itemMenu->m_hMenu)
|
if (itemMenu->m_hMenu)
|
||||||
Flag=GetMenuState((HMENU)itemMenu->m_hMenu, Id, MF_BYCOMMAND) ;
|
Flag=GetMenuState((HMENU)itemMenu->m_hMenu, Id, MF_BYCOMMAND) ;
|
||||||
@@ -892,8 +892,11 @@ wxMenuItem *wxMenuBar::FindItemForId (int Id, wxMenu ** itemMenu) const
|
|||||||
wxMenuItem *item = NULL;
|
wxMenuItem *item = NULL;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < m_menuCount; i++)
|
for (i = 0; i < m_menuCount; i++)
|
||||||
if ((item = m_menus[i]->FindItemForId (Id, itemMenu)))
|
{
|
||||||
|
item = m_menus[i]->FindItemForId (Id, itemMenu);
|
||||||
|
if (item)
|
||||||
return item;
|
return item;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -376,12 +376,19 @@ LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lPa
|
|||||||
cx = GetSystemMetrics( SM_CXFRAME ) ;
|
cx = GetSystemMetrics( SM_CXFRAME ) ;
|
||||||
cy = GetSystemMetrics( SM_CYFRAME ) ;
|
cy = GetSystemMetrics( SM_CYFRAME ) ;
|
||||||
}
|
}
|
||||||
else
|
else if (TestWinStyle(hWnd, WS_BORDER ))
|
||||||
if (TestWinStyle(hWnd, WS_BORDER ))
|
|
||||||
{
|
{
|
||||||
cx = GetSystemMetrics( SM_CXBORDER ) ;
|
cx = GetSystemMetrics( SM_CXBORDER ) ;
|
||||||
cy = GetSystemMetrics( SM_CYBORDER ) ;
|
cy = GetSystemMetrics( SM_CYBORDER ) ;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// VZ: I don't know what should be here, but the vars must
|
||||||
|
// be inited!
|
||||||
|
wxFAIL_MSG("don't know how to initialize cx, cy");
|
||||||
|
|
||||||
|
cx = cy = 0;
|
||||||
|
}
|
||||||
|
|
||||||
GetIconRect( hWnd, &rcMenu ) ;
|
GetIconRect( hWnd, &rcMenu ) ;
|
||||||
GetMinButtonRect( hWnd, &rcMin ) ;
|
GetMinButtonRect( hWnd, &rcMin ) ;
|
||||||
@@ -865,7 +872,8 @@ BOOL PASCAL DrawCaption( HDC hDC, HWND hWnd, LPRECT lprc,
|
|||||||
int cy ;
|
int cy ;
|
||||||
SIZE Size ;
|
SIZE Size ;
|
||||||
|
|
||||||
if ((lpsz = (char*)GlobalAllocPtr( GHND, ui + 2 )))
|
lpsz = (char*)GlobalAllocPtr( GHND, ui + 2 );
|
||||||
|
if (lpsz)
|
||||||
{
|
{
|
||||||
UINT nBkMode ;
|
UINT nBkMode ;
|
||||||
|
|
||||||
@@ -1074,7 +1082,8 @@ BOOL PASCAL DoMenu( HWND hWnd )
|
|||||||
if (!TestWinStyle(hWnd, WS_SYSMENU))
|
if (!TestWinStyle(hWnd, WS_SYSMENU))
|
||||||
return FALSE ;
|
return FALSE ;
|
||||||
|
|
||||||
if ((hDC = GetWindowDC( hWnd )))
|
hDC = GetWindowDC( hWnd );
|
||||||
|
if (hDC)
|
||||||
{
|
{
|
||||||
// Invert the icon
|
// Invert the icon
|
||||||
//
|
//
|
||||||
|
@@ -437,7 +437,7 @@ void wxNotebook::Command(wxCommandEvent& event)
|
|||||||
wxFAIL_MSG("wxNotebook::Command not implemented");
|
wxFAIL_MSG("wxNotebook::Command not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxNotebook::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
bool wxNotebook::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM* result)
|
||||||
{
|
{
|
||||||
wxNotebookEvent event(wxEVT_NULL, m_windowId);
|
wxNotebookEvent event(wxEVT_NULL, m_windowId);
|
||||||
|
|
||||||
@@ -451,21 +451,18 @@ bool wxNotebook::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
event.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING);
|
event.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// prevent this msg from being passed to wxControl::MSWNotify which would
|
|
||||||
// retrun FALSE disabling the change of page
|
|
||||||
case UDN_DELTAPOS:
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return wxControl::MSWNotify(wParam, lParam);
|
return wxControl::MSWNotify(wParam, lParam, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
event.SetSelection(TabCtrl_GetCurSel(m_hwnd));
|
event.SetSelection(TabCtrl_GetCurSel(m_hwnd));
|
||||||
event.SetOldSelection(m_nSelection);
|
event.SetOldSelection(m_nSelection);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
event.SetInt(LOWORD(wParam));
|
event.SetInt(LOWORD(wParam)); // ctrl id
|
||||||
|
|
||||||
return GetEventHandler()->ProcessEvent(event);
|
bool processed = GetEventHandler()->ProcessEvent(event);
|
||||||
|
*result = !event.IsAllowed();
|
||||||
|
return processed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -475,11 +472,32 @@ bool wxNotebook::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
// hide the currently active panel and show the new one
|
// hide the currently active panel and show the new one
|
||||||
void wxNotebook::ChangePage(int nOldSel, int nSel)
|
void wxNotebook::ChangePage(int nOldSel, int nSel)
|
||||||
{
|
{
|
||||||
|
// MT-FIXME should use a real semaphore
|
||||||
|
static bool s_bInsideChangePage = FALSE;
|
||||||
|
|
||||||
|
// when we call ProcessEvent(), our own OnSelChange() is called which calls
|
||||||
|
// this function - break the infinite loop
|
||||||
|
if ( s_bInsideChangePage )
|
||||||
|
return;
|
||||||
|
|
||||||
// it's not an error (the message may be generated by the tab control itself)
|
// it's not an error (the message may be generated by the tab control itself)
|
||||||
// and it may happen - just do nothing
|
// and it may happen - just do nothing
|
||||||
if ( nSel == nOldSel )
|
if ( nSel == nOldSel )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
s_bInsideChangePage = TRUE;
|
||||||
|
|
||||||
|
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId);
|
||||||
|
event.SetSelection(nSel);
|
||||||
|
event.SetOldSelection(nOldSel);
|
||||||
|
event.SetEventObject(this);
|
||||||
|
if ( ProcessEvent(event) && !event.IsAllowed() )
|
||||||
|
{
|
||||||
|
// program doesn't allow the page change
|
||||||
|
s_bInsideChangePage = FALSE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( nOldSel != -1 )
|
if ( nOldSel != -1 )
|
||||||
m_aPages[nOldSel]->Show(FALSE);
|
m_aPages[nOldSel]->Show(FALSE);
|
||||||
|
|
||||||
@@ -487,7 +505,11 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
|
|||||||
pPage->Show(TRUE);
|
pPage->Show(TRUE);
|
||||||
pPage->SetFocus();
|
pPage->SetFocus();
|
||||||
|
|
||||||
|
event.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED);
|
||||||
|
ProcessEvent(event);
|
||||||
|
|
||||||
m_nSelection = nSel;
|
m_nSelection = nSel;
|
||||||
|
s_bInsideChangePage = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxNotebook::OnEraseBackground(wxEraseEvent& event)
|
void wxNotebook::OnEraseBackground(wxEraseEvent& event)
|
||||||
|
@@ -358,6 +358,11 @@ wxDataObject::~wxDataObject()
|
|||||||
const char *wxDataObject::GetFormatName(wxDataFormat format)
|
const char *wxDataObject::GetFormatName(wxDataFormat format)
|
||||||
{
|
{
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
|
// case 'xxx' is not a valid value for switch of enum 'wxDataFormat'
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(disable:4063)
|
||||||
|
#endif // VC++
|
||||||
|
|
||||||
static char s_szBuf[128];
|
static char s_szBuf[128];
|
||||||
switch ( format ) {
|
switch ( format ) {
|
||||||
case CF_TEXT: return "CF_TEXT";
|
case CF_TEXT: return "CF_TEXT";
|
||||||
@@ -380,9 +385,14 @@ const char *wxDataObject::GetFormatName(wxDataFormat format)
|
|||||||
sprintf(s_szBuf, "clipboard format %d (unknown)", format);
|
sprintf(s_szBuf, "clipboard format %d (unknown)", format);
|
||||||
return s_szBuf;
|
return s_szBuf;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(default:4063)
|
||||||
|
#endif // VC++
|
||||||
|
|
||||||
|
#else // !Debug
|
||||||
return "";
|
return "";
|
||||||
#endif
|
#endif // Debug
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -371,7 +371,7 @@ bool wxFileDropTarget::OnDrop(long x, long y, const void *pData)
|
|||||||
HDROP hdrop = (HDROP)pData; // @@ it works, but I'm not sure about it
|
HDROP hdrop = (HDROP)pData; // @@ it works, but I'm not sure about it
|
||||||
|
|
||||||
// get number of files (magic value -1)
|
// get number of files (magic value -1)
|
||||||
UINT nFiles = ::DragQueryFile(hdrop, -1, NULL, 0);
|
UINT nFiles = ::DragQueryFile(hdrop, (unsigned)-1, NULL, 0u);
|
||||||
|
|
||||||
// for each file get the length, allocate memory and then get the name
|
// for each file get the length, allocate memory and then get the name
|
||||||
char **aszFiles = new char *[nFiles];
|
char **aszFiles = new char *[nFiles];
|
||||||
|
@@ -144,7 +144,7 @@ wxRegKey::StdKey wxRegKey::ExtractKeyName(wxString& strKey)
|
|||||||
{
|
{
|
||||||
wxString strRoot = strKey.Left(REG_SEPARATOR);
|
wxString strRoot = strKey.Left(REG_SEPARATOR);
|
||||||
|
|
||||||
HKEY hRootKey;
|
HKEY hRootKey = 0;
|
||||||
size_t ui;
|
size_t ui;
|
||||||
for ( ui = 0; ui < nStdKeys; ui++ ) {
|
for ( ui = 0; ui < nStdKeys; ui++ ) {
|
||||||
if ( strRoot.CmpNoCase(aStdKeys[ui].szName) == 0 ||
|
if ( strRoot.CmpNoCase(aStdKeys[ui].szName) == 0 ||
|
||||||
|
@@ -233,19 +233,16 @@ bool wxSpinButton::MSWCommand(WXUINT cmd, WXWORD id)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSpinButton::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
bool wxSpinButton::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM* result)
|
||||||
{
|
{
|
||||||
NMHDR* hdr1 = (NMHDR*) lParam;
|
NMHDR* hdr1 = (NMHDR*) lParam;
|
||||||
switch ( hdr1->code )
|
switch ( hdr1->code )
|
||||||
{
|
{
|
||||||
/* We don't process this message, currently */
|
/* We don't process this message, currently */
|
||||||
case UDN_DELTAPOS:
|
case UDN_DELTAPOS:
|
||||||
{
|
|
||||||
return wxControl::MSWNotify(wParam, lParam);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default :
|
default :
|
||||||
return wxControl::MSWNotify(wParam, lParam);
|
return wxControl::MSWNotify(wParam, lParam, result);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@@ -146,7 +146,7 @@ bool wxTabCtrl::MSWCommand(WXUINT cmd, WXWORD id)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTabCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
bool wxTabCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
|
||||||
{
|
{
|
||||||
wxTabEvent event(wxEVT_NULL, m_windowId);
|
wxTabEvent event(wxEVT_NULL, m_windowId);
|
||||||
wxEventType eventType = wxEVT_NULL;
|
wxEventType eventType = wxEVT_NULL;
|
||||||
@@ -154,37 +154,29 @@ bool wxTabCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
switch ( hdr1->code )
|
switch ( hdr1->code )
|
||||||
{
|
{
|
||||||
case TCN_SELCHANGE:
|
case TCN_SELCHANGE:
|
||||||
{
|
|
||||||
eventType = wxEVT_COMMAND_TAB_SEL_CHANGED;
|
eventType = wxEVT_COMMAND_TAB_SEL_CHANGED;
|
||||||
event.SetInt( (int) LOWORD(wParam) ) ;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case TCN_SELCHANGING:
|
case TCN_SELCHANGING:
|
||||||
{
|
|
||||||
eventType = wxEVT_COMMAND_TAB_SEL_CHANGING;
|
eventType = wxEVT_COMMAND_TAB_SEL_CHANGING;
|
||||||
event.SetInt( (int) LOWORD(wParam) ) ;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case TTN_NEEDTEXT:
|
case TTN_NEEDTEXT:
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
// if (tool->m_shortHelpString != "")
|
// if (tool->m_shortHelpString != "")
|
||||||
// ttText->lpszText = (char *) (const char *)tool->m_shortHelpString;
|
// ttText->lpszText = (char *) (const char *)tool->m_shortHelpString;
|
||||||
return wxControl::MSWNotify(wParam, lParam);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default :
|
default :
|
||||||
return wxControl::MSWNotify(wParam, lParam);
|
return wxControl::MSWNotify(wParam, lParam, result);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
event.SetEventType(eventType);
|
event.SetEventType(eventType);
|
||||||
|
event.SetInt( (int) LOWORD(wParam) ) ;
|
||||||
|
|
||||||
if ( !ProcessEvent(event) )
|
return ProcessEvent(event);
|
||||||
return FALSE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Responds to colour changes, and passes event on to children.
|
// Responds to colour changes, and passes event on to children.
|
||||||
|
@@ -325,7 +325,9 @@ bool wxToolBar95::MSWCommand(WXUINT cmd, WXWORD id)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxToolBar95::MSWNotify(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam)
|
bool wxToolBar95::MSWNotify(WXWPARAM WXUNUSED(wParam),
|
||||||
|
WXLPARAM lParam,
|
||||||
|
WXLPARAM *result)
|
||||||
{
|
{
|
||||||
// First check if this applies to us
|
// First check if this applies to us
|
||||||
NMHDR *hdr = (NMHDR *)lParam;
|
NMHDR *hdr = (NMHDR *)lParam;
|
||||||
|
@@ -490,12 +490,18 @@ wxTreeItemId wxTreeCtrl::DoInsertItem(const wxTreeItemId& parent,
|
|||||||
|
|
||||||
tvIns.item.mask = mask;
|
tvIns.item.mask = mask;
|
||||||
|
|
||||||
HTREEITEM id = (HTREEITEM) TreeView_InsertItem(wxhWnd, &tvIns);
|
HTREEITEM id = TreeView_InsertItem(wxhWnd, &tvIns);
|
||||||
if ( id == 0 )
|
if ( id == 0 )
|
||||||
{
|
{
|
||||||
wxLogLastError("TreeView_InsertItem");
|
wxLogLastError("TreeView_InsertItem");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( data != NULL )
|
||||||
|
{
|
||||||
|
// associate the application tree item with Win32 tree item handle
|
||||||
|
data->SetId((WXHTREEITEM)id);
|
||||||
|
}
|
||||||
|
|
||||||
return wxTreeItemId((WXHTREEITEM)id);
|
return wxTreeItemId((WXHTREEITEM)id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -763,7 +769,7 @@ bool wxTreeCtrl::MSWCommand(WXUINT cmd, WXWORD id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// process WM_NOTIFY Windows message
|
// process WM_NOTIFY Windows message
|
||||||
bool wxTreeCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
bool wxTreeCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
|
||||||
{
|
{
|
||||||
wxTreeEvent event(wxEVT_NULL, m_windowId);
|
wxTreeEvent event(wxEVT_NULL, m_windowId);
|
||||||
wxEventType eventType = wxEVT_NULL;
|
wxEventType eventType = wxEVT_NULL;
|
||||||
@@ -889,36 +895,28 @@ bool wxTreeCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return wxControl::MSWNotify(wParam, lParam);
|
return wxControl::MSWNotify(wParam, lParam, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
event.SetEventType(eventType);
|
event.SetEventType(eventType);
|
||||||
|
|
||||||
bool rc = GetEventHandler()->ProcessEvent(event);
|
bool processed = GetEventHandler()->ProcessEvent(event);
|
||||||
|
|
||||||
// post processing
|
// post processing
|
||||||
switch ( hdr->code )
|
if ( hdr->code == TVN_DELETEITEM )
|
||||||
{
|
{
|
||||||
// NB: we might process this message using wxWindows event tables, but
|
// NB: we might process this message using wxWindows event tables, but
|
||||||
// due to overhead of wxWin event system we prefer to do it here
|
// due to overhead of wxWin event system we prefer to do it here
|
||||||
// (otherwise deleting a tree with many items is just too slow)
|
// (otherwise deleting a tree with many items is just too slow)
|
||||||
case TVN_DELETEITEM:
|
|
||||||
{
|
|
||||||
NM_TREEVIEW* tv = (NM_TREEVIEW *)lParam;
|
NM_TREEVIEW* tv = (NM_TREEVIEW *)lParam;
|
||||||
wxTreeItemData *data = (wxTreeItemData *)tv->itemOld.lParam;
|
wxTreeItemData *data = (wxTreeItemData *)tv->itemOld.lParam;
|
||||||
delete data; // may be NULL, ok
|
delete data; // may be NULL, ok
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case TVN_ITEMEXPANDING:
|
*result = !event.IsAllowed();
|
||||||
// if user called Veto(), don't allow expansion/collapse by
|
|
||||||
// returning TRUE from here
|
|
||||||
rc = event.m_code != 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rc;
|
return processed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -928,7 +926,7 @@ bool wxTreeCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxCommandEvent)
|
IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxCommandEvent)
|
||||||
|
|
||||||
wxTreeEvent::wxTreeEvent(wxEventType commandType, int id)
|
wxTreeEvent::wxTreeEvent(wxEventType commandType, int id)
|
||||||
: wxCommandEvent(commandType, id)
|
: wxNotifyEvent(commandType, id)
|
||||||
{
|
{
|
||||||
m_code = 0;
|
m_code = 0;
|
||||||
m_itemOld = 0;
|
m_itemOld = 0;
|
||||||
|
@@ -174,7 +174,9 @@ bool wxWindow::MSWCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id))
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindow::MSWNotify(WXWPARAM WXUNUSED(wParam), WXLPARAM WXUNUSED(lParam))
|
bool wxWindow::MSWNotify(WXWPARAM WXUNUSED(wParam),
|
||||||
|
WXLPARAM WXUNUSED(lParam),
|
||||||
|
WXLPARAM* WXUNUSED(result))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -193,8 +195,11 @@ void wxWindow::SetHWND(WXHWND hWnd)
|
|||||||
m_hWnd = hWnd;
|
m_hWnd = hWnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor
|
// ----------------------------------------------------------------------------
|
||||||
wxWindow::wxWindow(void)
|
// constructors and such
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxWindow::Init()
|
||||||
{
|
{
|
||||||
// Generic
|
// Generic
|
||||||
m_windowId = 0;
|
m_windowId = 0;
|
||||||
@@ -202,7 +207,6 @@ wxWindow::wxWindow(void)
|
|||||||
m_windowStyle = 0;
|
m_windowStyle = 0;
|
||||||
m_windowParent = NULL;
|
m_windowParent = NULL;
|
||||||
m_windowEventHandler = this;
|
m_windowEventHandler = this;
|
||||||
m_windowName = "";
|
|
||||||
m_windowCursor = *wxSTANDARD_CURSOR;
|
m_windowCursor = *wxSTANDARD_CURSOR;
|
||||||
m_children = new wxList;
|
m_children = new wxList;
|
||||||
m_doubleClickAllowed = 0 ;
|
m_doubleClickAllowed = 0 ;
|
||||||
@@ -217,41 +221,35 @@ wxWindow::wxWindow(void)
|
|||||||
// MSW-specific
|
// MSW-specific
|
||||||
m_hWnd = 0;
|
m_hWnd = 0;
|
||||||
m_winEnabled = TRUE;
|
m_winEnabled = TRUE;
|
||||||
m_caretWidth = 0; m_caretHeight = 0;
|
m_caretWidth = m_caretHeight = 0;
|
||||||
m_caretEnabled = FALSE;
|
m_caretEnabled =
|
||||||
m_caretShown = FALSE;
|
m_caretShown = FALSE;
|
||||||
m_inOnSize = FALSE;
|
m_inOnSize = FALSE;
|
||||||
m_minSizeX = -1;
|
m_minSizeX =
|
||||||
m_minSizeY = -1;
|
m_minSizeY =
|
||||||
m_maxSizeX = -1;
|
m_maxSizeX =
|
||||||
m_maxSizeY = -1;
|
m_maxSizeY = -1;
|
||||||
// m_paintHDC = 0;
|
|
||||||
// m_tempHDC = 0;
|
|
||||||
m_isBeingDeleted = FALSE;
|
m_isBeingDeleted = FALSE;
|
||||||
m_oldWndProc = 0;
|
m_oldWndProc = 0;
|
||||||
#ifndef __WIN32__
|
#ifndef __WIN32__
|
||||||
m_globalHandle = 0;
|
m_globalHandle = 0;
|
||||||
#endif
|
#endif
|
||||||
m_useCtl3D = FALSE;
|
m_useCtl3D = FALSE;
|
||||||
|
m_mouseInWindow = FALSE;
|
||||||
|
|
||||||
|
m_windowParent = NULL;
|
||||||
m_defaultItem = NULL;
|
m_defaultItem = NULL;
|
||||||
|
|
||||||
wxSystemSettings settings;
|
wxSystemSettings settings;
|
||||||
|
|
||||||
m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_3DFACE) ;
|
m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_3DFACE) ;
|
||||||
// m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_WINDOW) ; ;
|
|
||||||
m_foregroundColour = *wxBLACK;
|
m_foregroundColour = *wxBLACK;
|
||||||
|
|
||||||
/*
|
|
||||||
wxColour(GetRValue(GetSysColor(COLOR_WINDOW)),
|
|
||||||
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
|
|
||||||
*/
|
|
||||||
|
|
||||||
// wxWnd
|
// wxWnd
|
||||||
m_lastMsg = 0;
|
m_lastMsg = 0;
|
||||||
m_lastWParam = 0;
|
m_lastWParam = 0;
|
||||||
m_lastLParam = 0;
|
m_lastLParam = 0;
|
||||||
// m_acceleratorTable = 0;
|
|
||||||
m_hMenu = 0;
|
m_hMenu = 0;
|
||||||
|
|
||||||
m_xThumbSize = 0;
|
m_xThumbSize = 0;
|
||||||
@@ -268,8 +266,13 @@ wxWindow::wxWindow(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxWindow::wxWindow()
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
wxWindow::~wxWindow(void)
|
wxWindow::~wxWindow()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = TRUE;
|
m_isBeingDeleted = TRUE;
|
||||||
|
|
||||||
@@ -346,7 +349,7 @@ wxWindow::~wxWindow(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Destroy the window (delayed, if a managed window)
|
// Destroy the window (delayed, if a managed window)
|
||||||
bool wxWindow::Destroy(void)
|
bool wxWindow::Destroy()
|
||||||
{
|
{
|
||||||
delete this;
|
delete this;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -354,72 +357,18 @@ bool wxWindow::Destroy(void)
|
|||||||
|
|
||||||
extern char wxCanvasClassName[];
|
extern char wxCanvasClassName[];
|
||||||
|
|
||||||
// Constructor
|
// real construction (Init() must have been called before!)
|
||||||
bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
// Generic
|
Init();
|
||||||
m_isBeingDeleted = FALSE;
|
|
||||||
m_windowId = 0;
|
|
||||||
m_isShown = TRUE;
|
|
||||||
m_windowStyle = 0;
|
|
||||||
m_windowParent = NULL;
|
|
||||||
m_windowEventHandler = this;
|
|
||||||
m_windowName = "";
|
|
||||||
m_windowCursor = *wxSTANDARD_CURSOR;
|
|
||||||
m_doubleClickAllowed = 0 ;
|
|
||||||
m_winCaptured = FALSE;
|
|
||||||
m_constraints = NULL;
|
|
||||||
m_constraintsInvolvedIn = NULL;
|
|
||||||
m_windowSizer = NULL;
|
|
||||||
m_sizerParent = NULL;
|
|
||||||
m_autoLayout = FALSE;
|
|
||||||
m_windowValidator = NULL;
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
|
||||||
m_pDropTarget = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// MSW-specific
|
wxCHECK_MSG( parent, FALSE, "can't create wxWindow without parent" );
|
||||||
m_hWnd = 0;
|
|
||||||
m_winEnabled = TRUE;
|
|
||||||
m_caretWidth = 0; m_caretHeight = 0;
|
|
||||||
m_caretEnabled = FALSE;
|
|
||||||
m_caretShown = FALSE;
|
|
||||||
m_inOnSize = FALSE;
|
|
||||||
m_minSizeX = -1;
|
|
||||||
m_minSizeY = -1;
|
|
||||||
m_maxSizeX = -1;
|
|
||||||
m_maxSizeY = -1;
|
|
||||||
m_oldWndProc = 0;
|
|
||||||
#ifndef __WIN32__
|
|
||||||
m_globalHandle = 0;
|
|
||||||
#endif
|
|
||||||
m_useCtl3D = FALSE;
|
|
||||||
m_defaultItem = NULL;
|
|
||||||
m_windowParent = NULL;
|
|
||||||
m_mouseInWindow = FALSE;
|
|
||||||
if (!parent)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (parent) parent->AddChild(this);
|
parent->AddChild(this);
|
||||||
|
|
||||||
// wxWnd
|
|
||||||
m_lastMsg = 0;
|
|
||||||
m_lastWParam = 0;
|
|
||||||
m_lastLParam = 0;
|
|
||||||
m_hMenu = 0;
|
|
||||||
|
|
||||||
m_xThumbSize = 0;
|
|
||||||
m_yThumbSize = 0;
|
|
||||||
m_backgroundTransparent = FALSE;
|
|
||||||
|
|
||||||
m_lastXPos = (float)-1.0;
|
|
||||||
m_lastYPos = (float)-1.0;
|
|
||||||
m_lastEvent = -1;
|
|
||||||
m_returnCode = 0;
|
|
||||||
|
|
||||||
SetName(name);
|
SetName(name);
|
||||||
|
|
||||||
@@ -441,10 +390,6 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
wxSystemSettings settings;
|
wxSystemSettings settings;
|
||||||
|
|
||||||
m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_WINDOW) ; ;
|
|
||||||
// m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_3DFACE) ;
|
|
||||||
m_foregroundColour = *wxBLACK;
|
|
||||||
|
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
|
|
||||||
DWORD msflags = 0;
|
DWORD msflags = 0;
|
||||||
@@ -466,15 +411,13 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
|||||||
(m_windowStyle & wxSUNKEN_BORDER) || (m_windowStyle & wxDOUBLE_BORDER))
|
(m_windowStyle & wxSUNKEN_BORDER) || (m_windowStyle & wxDOUBLE_BORDER))
|
||||||
msflags |= WS_BORDER;
|
msflags |= WS_BORDER;
|
||||||
|
|
||||||
m_mouseInWindow = FALSE ;
|
|
||||||
|
|
||||||
MSWCreate(m_windowId, parent, wxCanvasClassName, this, NULL,
|
MSWCreate(m_windowId, parent, wxCanvasClassName, this, NULL,
|
||||||
x, y, width, height, msflags, NULL, exStyle);
|
x, y, width, height, msflags, NULL, exStyle);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::SetFocus(void)
|
void wxWindow::SetFocus()
|
||||||
{
|
{
|
||||||
HWND hWnd = (HWND) GetHWND();
|
HWND hWnd = (HWND) GetHWND();
|
||||||
if (hWnd)
|
if (hWnd)
|
||||||
@@ -489,7 +432,7 @@ void wxWindow::Enable(bool enable)
|
|||||||
::EnableWindow(hWnd, (BOOL)enable);
|
::EnableWindow(hWnd, (BOOL)enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::CaptureMouse(void)
|
void wxWindow::CaptureMouse()
|
||||||
{
|
{
|
||||||
HWND hWnd = (HWND) GetHWND();
|
HWND hWnd = (HWND) GetHWND();
|
||||||
if (hWnd && !m_winCaptured)
|
if (hWnd && !m_winCaptured)
|
||||||
@@ -499,7 +442,7 @@ void wxWindow::CaptureMouse(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::ReleaseMouse(void)
|
void wxWindow::ReleaseMouse()
|
||||||
{
|
{
|
||||||
if (m_winCaptured)
|
if (m_winCaptured)
|
||||||
{
|
{
|
||||||
@@ -814,7 +757,8 @@ void wxWindow::GetTextExtent(const wxString& string, int *x, int *y,
|
|||||||
HFONT was = 0;
|
HFONT was = 0;
|
||||||
if (fontToUse && fontToUse->Ok())
|
if (fontToUse && fontToUse->Ok())
|
||||||
{
|
{
|
||||||
if ((fnt=(HFONT) fontToUse->GetResourceHandle()))
|
fnt = (HFONT)fontToUse->GetResourceHandle();
|
||||||
|
if ( fnt )
|
||||||
was = (HFONT) SelectObject(dc,fnt) ;
|
was = (HFONT) SelectObject(dc,fnt) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -996,10 +940,11 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
}
|
}
|
||||||
case WM_QUERYDRAGICON:
|
case WM_QUERYDRAGICON:
|
||||||
{
|
{
|
||||||
HICON hIcon = 0;
|
HICON hIcon = (HICON)MSWOnQueryDragIcon();
|
||||||
if ((hIcon = (HICON) MSWOnQueryDragIcon()))
|
if ( hIcon )
|
||||||
return (long)hIcon;
|
return (long)hIcon;
|
||||||
else return MSWDefWindowProc(message, wParam, lParam );
|
else
|
||||||
|
return MSWDefWindowProc(message, wParam, lParam );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1181,9 +1126,10 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
#if defined(__WIN95__)
|
#if defined(__WIN95__)
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
{
|
{
|
||||||
if (!MSWOnNotify(wParam, lParam))
|
// for some messages (TVN_ITEMEXPANDING for example), the return
|
||||||
return MSWDefWindowProc(message, wParam, lParam );
|
// value of WM_NOTIFY handler is important, so don't just return 0
|
||||||
break;
|
// if we processed the message
|
||||||
|
return MSWOnNotify(wParam, lParam);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
case WM_MENUSELECT:
|
case WM_MENUSELECT:
|
||||||
@@ -1475,7 +1421,7 @@ void wxRemoveHandleAssociation(wxWindow *win)
|
|||||||
|
|
||||||
// Default destroyer - override if you destroy it in some other way
|
// Default destroyer - override if you destroy it in some other way
|
||||||
// (e.g. with MDI child windows)
|
// (e.g. with MDI child windows)
|
||||||
void wxWindow::MSWDestroyWindow(void)
|
void wxWindow::MSWDestroyWindow()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1562,7 +1508,7 @@ void wxWindow::MSWOnCreate(WXLPCREATESTRUCT WXUNUSED(cs))
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindow::MSWOnClose(void)
|
bool wxWindow::MSWOnClose()
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -1604,7 +1550,7 @@ bool wxWindow::MSWOnEndSession(bool endSession, long logOff)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindow::MSWOnDestroy(void)
|
bool wxWindow::MSWOnDestroy()
|
||||||
{
|
{
|
||||||
// delete our drop target if we've got one
|
// delete our drop target if we've got one
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
@@ -1621,7 +1567,7 @@ bool wxWindow::MSWOnDestroy(void)
|
|||||||
|
|
||||||
// Deal with child commands from buttons etc.
|
// Deal with child commands from buttons etc.
|
||||||
|
|
||||||
bool wxWindow::MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam)
|
long wxWindow::MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__)
|
#if defined(__WIN95__)
|
||||||
// Find a child window to send the notification to, e.g. a toolbar.
|
// Find a child window to send the notification to, e.g. a toolbar.
|
||||||
@@ -1640,8 +1586,12 @@ bool wxWindow::MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
HWND hWnd = (HWND)hdr->hwndFrom;
|
HWND hWnd = (HWND)hdr->hwndFrom;
|
||||||
wxWindow *win = wxFindWinFromHandle((WXHWND) hWnd);
|
wxWindow *win = wxFindWinFromHandle((WXHWND) hWnd);
|
||||||
|
|
||||||
|
WXLPARAM result = 0;
|
||||||
|
|
||||||
if ( win )
|
if ( win )
|
||||||
return win->MSWNotify(wParam, lParam);
|
{
|
||||||
|
win->MSWNotify(wParam, lParam, &result);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Rely on MSWNotify to check whether the message
|
// Rely on MSWNotify to check whether the message
|
||||||
@@ -1650,15 +1600,15 @@ bool wxWindow::MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxWindow *child = (wxWindow *)node->Data();
|
wxWindow *child = (wxWindow *)node->Data();
|
||||||
if ( child->MSWNotify(wParam, lParam) )
|
if ( child->MSWNotify(wParam, lParam, &result) )
|
||||||
return TRUE;
|
break;
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return result;
|
||||||
|
#endif // Win95
|
||||||
|
|
||||||
#endif
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1926,11 +1876,11 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
|
|||||||
lDlgCode = ::SendMessage(msg->hwnd, WM_GETDLGCODE, 0, 0);
|
lDlgCode = ::SendMessage(msg->hwnd, WM_GETDLGCODE, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bForward;
|
bool bForward = TRUE;
|
||||||
if ( bProcess ) {
|
if ( bProcess ) {
|
||||||
switch ( msg->wParam ) {
|
switch ( msg->wParam ) {
|
||||||
case VK_TAB:
|
case VK_TAB:
|
||||||
if ( lDlgCode & DLGC_WANTTAB ) // this is FALSE for Ctrl-Tab
|
if ( lDlgCode & DLGC_WANTTAB ) // FALSE for Ctrl-Tab
|
||||||
bProcess = FALSE;
|
bProcess = FALSE;
|
||||||
else
|
else
|
||||||
bForward = !(::GetKeyState(VK_SHIFT) & 0x100);
|
bForward = !(::GetKeyState(VK_SHIFT) & 0x100);
|
||||||
@@ -1948,8 +1898,6 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
|
|||||||
case VK_RIGHT:
|
case VK_RIGHT:
|
||||||
if ( (lDlgCode & DLGC_WANTARROWS) || bCtrlDown )
|
if ( (lDlgCode & DLGC_WANTARROWS) || bCtrlDown )
|
||||||
bProcess = FALSE;
|
bProcess = FALSE;
|
||||||
else
|
|
||||||
bForward = TRUE;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -1987,7 +1935,7 @@ long wxWindow::MSWOnMDIActivate(long WXUNUSED(flag), WXHWND WXUNUSED(activate),
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::MSWDetachWindowMenu(void)
|
void wxWindow::MSWDetachWindowMenu()
|
||||||
{
|
{
|
||||||
if (m_hMenu)
|
if (m_hMenu)
|
||||||
{
|
{
|
||||||
@@ -2006,7 +1954,7 @@ void wxWindow::MSWDetachWindowMenu(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindow::MSWOnPaint(void)
|
bool wxWindow::MSWOnPaint()
|
||||||
{
|
{
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
HRGN hRegion = ::CreateRectRgn(0, 0, 0, 0); // Dummy call to get a handle
|
HRGN hRegion = ::CreateRectRgn(0, 0, 0, 0); // Dummy call to get a handle
|
||||||
@@ -2659,7 +2607,7 @@ bool wxWindow::MSWOnInitDialog(WXHWND WXUNUSED(hWndFocus))
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::InitDialog(void)
|
void wxWindow::InitDialog()
|
||||||
{
|
{
|
||||||
wxInitDialogEvent event(GetId());
|
wxInitDialogEvent event(GetId());
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
@@ -2682,7 +2630,8 @@ void wxGetCharSize(WXHWND wnd, int *x, int *y,wxFont *the_font)
|
|||||||
{
|
{
|
||||||
// the_font->UseResource();
|
// the_font->UseResource();
|
||||||
// the_font->RealizeResource();
|
// the_font->RealizeResource();
|
||||||
if ((fnt=(HFONT) the_font->GetResourceHandle()))
|
fnt = (HFONT)the_font->GetResourceHandle();
|
||||||
|
if ( fnt )
|
||||||
was = (HFONT) SelectObject(dc,fnt) ;
|
was = (HFONT) SelectObject(dc,fnt) ;
|
||||||
}
|
}
|
||||||
GetTextMetrics(dc, &tm);
|
GetTextMetrics(dc, &tm);
|
||||||
@@ -2881,7 +2830,7 @@ void wxWindow::ShowCaret(bool show)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::DestroyCaret(void)
|
void wxWindow::DestroyCaret()
|
||||||
{
|
{
|
||||||
m_caretEnabled = FALSE;
|
m_caretEnabled = FALSE;
|
||||||
}
|
}
|
||||||
@@ -2899,7 +2848,7 @@ void wxWindow::GetCaretPos(int *x, int *y) const
|
|||||||
*y = point.y;
|
*y = point.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxWindow *wxGetActiveWindow(void)
|
wxWindow *wxGetActiveWindow()
|
||||||
{
|
{
|
||||||
HWND hWnd = GetActiveWindow();
|
HWND hWnd = GetActiveWindow();
|
||||||
if (hWnd != 0)
|
if (hWnd != 0)
|
||||||
@@ -3007,7 +2956,7 @@ void wxWindow::Centre(int direction)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* TODO (maybe)
|
/* TODO (maybe)
|
||||||
void wxWindow::OnPaint(void)
|
void wxWindow::OnPaint()
|
||||||
{
|
{
|
||||||
PaintSelectionHandles();
|
PaintSelectionHandles();
|
||||||
}
|
}
|
||||||
@@ -3404,7 +3353,7 @@ void wxWindow::SubclassWin(WXHWND hWnd)
|
|||||||
SetWindowLong((HWND) hWnd, GWL_WNDPROC, (LONG) wxWndProc);
|
SetWindowLong((HWND) hWnd, GWL_WNDPROC, (LONG) wxWndProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::UnsubclassWin(void)
|
void wxWindow::UnsubclassWin()
|
||||||
{
|
{
|
||||||
wxRemoveHandleAssociation(this);
|
wxRemoveHandleAssociation(this);
|
||||||
|
|
||||||
@@ -3541,7 +3490,7 @@ bool wxWindow::IsEnabled(void) const
|
|||||||
|
|
||||||
// Transfer values to controls. If returns FALSE,
|
// Transfer values to controls. If returns FALSE,
|
||||||
// it's an application error (pops up a dialog)
|
// it's an application error (pops up a dialog)
|
||||||
bool wxWindow::TransferDataToWindow(void)
|
bool wxWindow::TransferDataToWindow()
|
||||||
{
|
{
|
||||||
wxNode *node = GetChildren()->First();
|
wxNode *node = GetChildren()->First();
|
||||||
while ( node )
|
while ( node )
|
||||||
@@ -3561,7 +3510,7 @@ bool wxWindow::TransferDataToWindow(void)
|
|||||||
|
|
||||||
// Transfer values from controls. If returns FALSE,
|
// Transfer values from controls. If returns FALSE,
|
||||||
// validation failed: don't quit
|
// validation failed: don't quit
|
||||||
bool wxWindow::TransferDataFromWindow(void)
|
bool wxWindow::TransferDataFromWindow()
|
||||||
{
|
{
|
||||||
wxNode *node = GetChildren()->First();
|
wxNode *node = GetChildren()->First();
|
||||||
while ( node )
|
while ( node )
|
||||||
@@ -3577,7 +3526,7 @@ bool wxWindow::TransferDataFromWindow(void)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindow::Validate(void)
|
bool wxWindow::Validate()
|
||||||
{
|
{
|
||||||
wxNode *node = GetChildren()->First();
|
wxNode *node = GetChildren()->First();
|
||||||
while ( node )
|
while ( node )
|
||||||
@@ -3594,7 +3543,7 @@ bool wxWindow::Validate(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the window with the focus
|
// Get the window with the focus
|
||||||
wxWindow *wxWindow::FindFocus(void)
|
wxWindow *wxWindow::FindFocus()
|
||||||
{
|
{
|
||||||
HWND hWnd = ::GetFocus();
|
HWND hWnd = ::GetFocus();
|
||||||
if ( hWnd )
|
if ( hWnd )
|
||||||
@@ -3617,7 +3566,7 @@ void wxWindow::RemoveChild(wxWindow *child)
|
|||||||
child->m_windowParent = NULL;
|
child->m_windowParent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::DestroyChildren(void)
|
void wxWindow::DestroyChildren()
|
||||||
{
|
{
|
||||||
if (GetChildren()) {
|
if (GetChildren()) {
|
||||||
wxNode *node;
|
wxNode *node;
|
||||||
@@ -3733,7 +3682,7 @@ void wxWindow::RemoveConstraintReference(wxWindow *otherWin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset any constraints that mention this window
|
// Reset any constraints that mention this window
|
||||||
void wxWindow::DeleteRelatedConstraints(void)
|
void wxWindow::DeleteRelatedConstraints()
|
||||||
{
|
{
|
||||||
if (m_constraintsInvolvedIn)
|
if (m_constraintsInvolvedIn)
|
||||||
{
|
{
|
||||||
@@ -3775,7 +3724,7 @@ void wxWindow::SetSizer(wxSizer *sizer)
|
|||||||
* New version
|
* New version
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool wxWindow::Layout(void)
|
bool wxWindow::Layout()
|
||||||
{
|
{
|
||||||
if (GetConstraints())
|
if (GetConstraints())
|
||||||
{
|
{
|
||||||
@@ -3875,7 +3824,7 @@ bool wxWindow::DoPhase(int phase)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::ResetConstraints(void)
|
void wxWindow::ResetConstraints()
|
||||||
{
|
{
|
||||||
wxLayoutConstraints *constr = GetConstraints();
|
wxLayoutConstraints *constr = GetConstraints();
|
||||||
if (constr)
|
if (constr)
|
||||||
@@ -4137,7 +4086,7 @@ void wxWindow::OnDefaultAction(wxControl *initiatingItem)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::Clear(void)
|
void wxWindow::Clear()
|
||||||
{
|
{
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
wxBrush brush(GetBackgroundColour(), wxSOLID);
|
wxBrush brush(GetBackgroundColour(), wxSOLID);
|
||||||
@@ -4146,7 +4095,7 @@ void wxWindow::Clear(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fits the panel around the items
|
// Fits the panel around the items
|
||||||
void wxWindow::Fit(void)
|
void wxWindow::Fit()
|
||||||
{
|
{
|
||||||
int maxX = 0;
|
int maxX = 0;
|
||||||
int maxY = 0;
|
int maxY = 0;
|
||||||
@@ -4315,7 +4264,7 @@ int y_pages = 0;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Setup background and foreground colours correctly
|
// Setup background and foreground colours correctly
|
||||||
void wxWindow::SetupColours(void)
|
void wxWindow::SetupColours()
|
||||||
{
|
{
|
||||||
if (GetParent())
|
if (GetParent())
|
||||||
SetBackgroundColour(GetParent()->GetBackgroundColour());
|
SetBackgroundColour(GetParent()->GetBackgroundColour());
|
||||||
@@ -4350,13 +4299,13 @@ void wxWindow::OnIdle(wxIdleEvent& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Raise the window to the top of the Z order
|
// Raise the window to the top of the Z order
|
||||||
void wxWindow::Raise(void)
|
void wxWindow::Raise()
|
||||||
{
|
{
|
||||||
::BringWindowToTop((HWND) GetHWND());
|
::BringWindowToTop((HWND) GetHWND());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lower the window to the bottom of the Z order
|
// Lower the window to the bottom of the Z order
|
||||||
void wxWindow::Lower(void)
|
void wxWindow::Lower()
|
||||||
{
|
{
|
||||||
::SetWindowPos((HWND) GetHWND(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
|
::SetWindowPos((HWND) GetHWND(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user