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:
parent
621793f45e
commit
fd3f686c27
@ -41,9 +41,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Eliminate double/float warnings
|
||||
// suppress some Visual C++ warnings
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(disable:4244)
|
||||
# pragma warning(disable:4244) // cobversion from double to float
|
||||
# pragma warning(disable:4100) // unreferenced formal parameter
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -368,8 +368,8 @@ private: \
|
||||
|
||||
@memo declare list class 'name' containing elements of type 'T'
|
||||
*/
|
||||
#define WX_DECLARE_LIST(T, name) typedef T _L##name; \
|
||||
_WX_DECLARE_LIST(_L##name, name)
|
||||
#define WX_DECLARE_OBJARRAY(T, name) typedef T _L##name; \
|
||||
_WX_DECLARE_LIST(_L##name, name)
|
||||
/**
|
||||
To use a list class you must
|
||||
<ll>
|
||||
@ -387,7 +387,7 @@ private: \
|
||||
|
||||
@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
|
||||
};
|
||||
|
||||
// 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
|
||||
/*
|
||||
wxEVT_SCROLL_TOP
|
||||
|
@ -169,6 +169,10 @@ public:
|
||||
~wxTempFile();
|
||||
|
||||
private:
|
||||
// no copy ctor/assignment operator
|
||||
wxTempFile(const wxTempFile&);
|
||||
wxTempFile& operator=(const wxTempFile&);
|
||||
|
||||
wxString m_strName, // name of the file to replace in Commit()
|
||||
m_strTemp; // temporary file name
|
||||
wxFile m_file; // the temporary file
|
||||
|
@ -353,11 +353,13 @@ extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor);
|
||||
|
||||
class WXDLLEXPORT wxResourceCache: public wxList
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxResourceCache)
|
||||
public:
|
||||
wxResourceCache();
|
||||
wxResourceCache(const unsigned int the_key_type);
|
||||
~wxResourceCache();
|
||||
public:
|
||||
wxResourceCache() { }
|
||||
wxResourceCache(const unsigned int keyType) : wxList(keyType) { }
|
||||
~wxResourceCache();
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxResourceCache)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -37,13 +37,27 @@ class wxNotebookEvent : public wxCommandEvent
|
||||
public:
|
||||
wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
|
||||
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
|
||||
int GetSelection() const { return m_nSel; }
|
||||
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:
|
||||
bool m_bAllow;
|
||||
|
||||
int m_nSel, // currently selected page
|
||||
m_nOldSel; // previously selected page
|
||||
|
||||
|
@ -37,13 +37,27 @@ class wxNotebookEvent : public wxCommandEvent
|
||||
public:
|
||||
wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
|
||||
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
|
||||
int GetSelection() const { return m_nSel; }
|
||||
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:
|
||||
bool m_bAllow;
|
||||
|
||||
int m_nSel, // currently selected page
|
||||
m_nOldSel; // previously selected page
|
||||
|
||||
|
@ -2,13 +2,26 @@
|
||||
// Name: list.h
|
||||
// Purpose: wxList, wxStringList classes
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Modified by: VZ at 16/11/98: WX_DECLARE_LIST() and typesafe lists added
|
||||
// Created: 29/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Julian Smart
|
||||
// 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__
|
||||
#define _WX_LISTH__
|
||||
|
||||
@ -16,133 +29,445 @@
|
||||
#pragma interface "list.h"
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// headers
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/debug.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
|
||||
#define wxKEY_INTEGER 1
|
||||
#define wxKEY_STRING 2
|
||||
class WXDLLEXPORT wxNode: public wxObject
|
||||
class WXDLLEXPORT wxObjectListNode;
|
||||
typedef wxObjectListNode wxNode;
|
||||
|
||||
// undef it to get rid of old, deprecated functions
|
||||
#define wxLIST_COMPATIBILITY
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// constants
|
||||
// -----------------------------------------------------------------------------
|
||||
enum wxKeyType
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxNode)
|
||||
private:
|
||||
wxKEY_NONE,
|
||||
wxKEY_INTEGER,
|
||||
wxKEY_STRING
|
||||
};
|
||||
|
||||
wxObject *data;
|
||||
wxNode *next;
|
||||
wxNode *previous;
|
||||
// -----------------------------------------------------------------------------
|
||||
// types
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
wxList *list;
|
||||
// type of compare function for list sort operation (as in 'qsort'): it should
|
||||
// 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;
|
||||
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')
|
||||
typedef int (*wxSortCompareFunction)(const void *elem1, const void *elem2);
|
||||
typedef int (*wxListIterateFunction)(wxObject *o);
|
||||
|
||||
class WXDLLEXPORT wxList: public wxObject
|
||||
// a struct which may contain both types of keys
|
||||
//
|
||||
// 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
|
||||
// resolve ambiguity which we would otherwise have with wxStringList::Find() and
|
||||
// wxList::Find(const char *).
|
||||
class WXDLLEXPORT wxListKey
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxList)
|
||||
public:
|
||||
// implicit ctors
|
||||
wxListKey()
|
||||
{ m_keyType = wxKEY_NONE; }
|
||||
wxListKey(long i)
|
||||
{ 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()); }
|
||||
|
||||
public:
|
||||
int n;
|
||||
int destroy_data;
|
||||
wxNode *first_node;
|
||||
wxNode *last_node;
|
||||
unsigned int key_type;
|
||||
// accessors
|
||||
wxKeyType GetKeyType() const { return m_keyType; }
|
||||
const char *GetString() const
|
||||
{ wxASSERT( m_keyType == wxKEY_STRING ); return m_key.string; }
|
||||
long GetNumber() const
|
||||
{ wxASSERT( m_keyType == wxKEY_INTEGER ); return m_key.integer; }
|
||||
|
||||
wxList(void);
|
||||
wxList(const unsigned int the_key_type);
|
||||
wxList(int N, wxObject *Objects[]);
|
||||
wxList(wxObject *object, ...);
|
||||
// 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...
|
||||
|
||||
~wxList(void);
|
||||
case wxKEY_STRING:
|
||||
return strcmp(m_key.string, value.string) == 0;
|
||||
|
||||
inline int Number(void) const { return n; }
|
||||
inline int GetCount(void) const { return n; }
|
||||
case wxKEY_INTEGER:
|
||||
return m_key.integer == value.integer;
|
||||
}
|
||||
}
|
||||
|
||||
// Append to end of list
|
||||
wxNode *Append(wxObject *object);
|
||||
// dtor
|
||||
~wxListKey()
|
||||
{
|
||||
if ( m_keyType == wxKEY_STRING )
|
||||
free(m_key.string);
|
||||
}
|
||||
|
||||
// Insert at front of list
|
||||
wxNode *Insert(wxObject *object);
|
||||
|
||||
// Insert before given node
|
||||
wxNode *Insert(wxNode *position, wxObject *object);
|
||||
|
||||
// Keyed append
|
||||
wxNode *Append(long key, wxObject *object);
|
||||
wxNode *Append(const char *key, wxObject *object);
|
||||
|
||||
bool DeleteNode(wxNode *node);
|
||||
bool DeleteObject(wxObject *object); // Finds object pointer and
|
||||
// deletes node (and object if
|
||||
// DeleteContents is on)
|
||||
virtual void Clear(void); // Delete all nodes
|
||||
|
||||
inline wxNode *First(void) const { return first_node; }
|
||||
inline wxNode *Last(void) const { return last_node; }
|
||||
wxNode *Nth(int i) const; // nth node counting from 0
|
||||
|
||||
// Keyed search
|
||||
virtual wxNode *Find(long key) const;
|
||||
virtual wxNode *Find(const char *key) const;
|
||||
|
||||
virtual wxNode *Member(wxObject *object) 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
|
||||
// a function to compare two list elements.
|
||||
void Sort(const wxSortCompareFunction compfunc);
|
||||
|
||||
wxObject *FirstThat(wxListIterateFunction func);
|
||||
void ForEach(wxListIterateFunction func);
|
||||
wxObject *LastThat(wxListIterateFunction func);
|
||||
private:
|
||||
wxKeyType m_keyType;
|
||||
wxListKeyValue m_key;
|
||||
};
|
||||
|
||||
// String list class. N.B. this always copies strings
|
||||
// with Add and deletes them itself.
|
||||
class WXDLLEXPORT wxStringList: public wxList
|
||||
// -----------------------------------------------------------------------------
|
||||
// wxNodeBase class is a (base for) node in a double linked list
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxNodeBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxStringList)
|
||||
friend class wxListBase;
|
||||
public:
|
||||
// ctor
|
||||
wxNodeBase(wxListBase *list = (wxListBase *)NULL,
|
||||
wxNodeBase *previous = (wxNodeBase *)NULL,
|
||||
wxNodeBase *next = (wxNodeBase *)NULL,
|
||||
void *data = NULL,
|
||||
const wxListKey& key = wxListKey());
|
||||
|
||||
public:
|
||||
wxStringList(void);
|
||||
wxStringList(const wxStringList& list);
|
||||
wxStringList(const char *first ...);
|
||||
~wxStringList(void);
|
||||
virtual ~wxNodeBase();
|
||||
|
||||
virtual wxNode *Add(const char *s);
|
||||
virtual void Delete(const char *s);
|
||||
virtual char **ListToArray(bool new_copies = FALSE) const;
|
||||
virtual void Sort(void);
|
||||
virtual bool Member(const char *s) const;
|
||||
virtual void Clear(void);
|
||||
void operator= (const wxStringList& list);
|
||||
char* operator[] (int i) const;
|
||||
// @@ no check is done that the list is really keyed on strings
|
||||
const char *GetKeyString() const { return m_key.string; }
|
||||
|
||||
#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;
|
||||
|
||||
// this function allows the sorting of arbitrary lists by giving
|
||||
// a function to compare two list elements. The list is sorted in place.
|
||||
void Sort(wxSortCompareFunction compfunc);
|
||||
|
||||
// functions for iterating over the list
|
||||
void *FirstThat(wxListIterateFunction func);
|
||||
void ForEach(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)
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// macros for definition of "template" list type
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// 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
|
||||
{
|
||||
public:
|
||||
wxList(int key_type = wxKEY_NONE) : wxObjectList((wxKeyType)key_type) { }
|
||||
|
||||
// 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); }
|
||||
wxNode *Member(wxObject *object) const { return (wxNode *)Find(object); }
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// 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
|
||||
// _WX_LISTH__
|
||||
|
@ -1,111 +1,24 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: listimpl.cpp
|
||||
// Purpose: helper file for implementation of dynamic lists
|
||||
// Purpose: second-part of macro based implementation of template lists
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 16.10.97
|
||||
// Created: 16/11/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1997 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright: (c) 1998 Vadim Zeitlin
|
||||
// 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) \
|
||||
name::~name() \
|
||||
{ \
|
||||
Empty(); \
|
||||
} \
|
||||
\
|
||||
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; \
|
||||
}
|
||||
#define _DEFINE_LIST(T, name) \
|
||||
void wx##name##Node::DeleteData() \
|
||||
{ \
|
||||
delete (T *)GetData(); \
|
||||
}
|
||||
|
||||
// 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
|
||||
#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
|
||||
#undef _DEFINE_LIST
|
||||
|
||||
//#undef _DEFINE_LIST
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
// Window procedure
|
||||
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
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);
|
||||
|
||||
|
@ -418,8 +418,8 @@ class WXDLLEXPORT wxListCtrl: public wxControl
|
||||
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
||||
|
||||
// IMPLEMENTATION
|
||||
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);
|
||||
|
||||
// Recreate window - seems to be necessary when changing a style.
|
||||
void RecreateWindow(void);
|
||||
@ -442,11 +442,9 @@ 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);
|
||||
|
||||
int m_code;
|
||||
@ -457,6 +455,8 @@ class WXDLLEXPORT wxListEvent: public wxCommandEvent
|
||||
wxPoint m_pointDrag;
|
||||
|
||||
wxListItem m_item;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxListEvent)
|
||||
};
|
||||
|
||||
typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&);
|
||||
|
@ -44,12 +44,16 @@ WX_DEFINE_ARRAY(wxNotebookPage *, wxArrayPages);
|
||||
// ----------------------------------------------------------------------------
|
||||
// notebook events
|
||||
// ----------------------------------------------------------------------------
|
||||
class WXDLLEXPORT wxNotebookEvent : public wxCommandEvent
|
||||
class WXDLLEXPORT wxNotebookEvent : public wxNotifyEvent
|
||||
{
|
||||
public:
|
||||
wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
|
||||
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
|
||||
// the currently selected page (-1 if none)
|
||||
@ -173,7 +177,7 @@ public:
|
||||
// base class virtuals
|
||||
// -------------------
|
||||
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 bool DoPhase(int nPhase);
|
||||
|
||||
|
@ -91,6 +91,10 @@ public:
|
||||
virtual bool DeleteAll();
|
||||
|
||||
private:
|
||||
// no copy ctor/assignment operator
|
||||
wxRegConfig(const wxRegConfig&);
|
||||
wxRegConfig& operator=(const wxRegConfig&);
|
||||
|
||||
// these keys are opened during all lifetime of wxRegConfig object
|
||||
wxRegKey m_keyLocalRoot, m_keyLocal,
|
||||
m_keyGlobalRoot, m_keyGlobal;
|
||||
|
@ -6,7 +6,7 @@
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_SETUP_H_
|
||||
@ -44,7 +44,7 @@
|
||||
#define wxUSE_HELP 1
|
||||
// 0 for no help facility
|
||||
#define wxUSE_RESOURCES 1
|
||||
// 0 for no wxGetResource/wxWriteResource
|
||||
// 0 for no wxGetResource/wxWriteResource
|
||||
#define wxUSE_CONSTRAINTS 1
|
||||
// 0 for no window layout constraint system
|
||||
|
||||
@ -52,15 +52,15 @@
|
||||
// 0 for no wxTime/wxDate classes
|
||||
|
||||
#define wxUSE_CLIPBOARD 1
|
||||
// 0 for no clipboard functions
|
||||
// 0 for no clipboard functions
|
||||
#define wxUSE_SPLINES 1
|
||||
// 0 for no splines
|
||||
// 0 for no splines
|
||||
#define wxUSE_XFIG_SPLINE_CODE 1
|
||||
// 1 for XFIG spline code, 0 for AIAI spline code.
|
||||
// 1 for XFIG spline code, 0 for AIAI spline code.
|
||||
// AIAI spline code is slower, but freer of copyright issues.
|
||||
|
||||
#define wxUSE_DRAG_AND_DROP 1
|
||||
// 0 for no drag and drop
|
||||
// 0 for no drag and drop
|
||||
|
||||
#define wxUSE_TOOLBAR 1
|
||||
// Define 1 to use toolbar classes
|
||||
@ -79,7 +79,7 @@
|
||||
#define wxUSE_SCROLLBAR 1
|
||||
// Define 1 to compile contributed wxScrollBar class
|
||||
#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,
|
||||
// separated by platform. If 1, you must link in
|
||||
// the XPM library to your applications.
|
||||
@ -114,12 +114,12 @@
|
||||
#define wxUSE_DYNAMIC_CLASSES 1
|
||||
// If 1, enables provision of run-time type information.
|
||||
// NOW MANDATORY: don't change.
|
||||
#define wxUSE_MEMORY_TRACING 1
|
||||
#define wxUSE_MEMORY_TRACING 0
|
||||
// If 1, enables debugging versions of wxObject::new and
|
||||
// wxObject::delete *IF* __WXDEBUG__ is also defined.
|
||||
// WARNING: this code may not work with all architectures, especially
|
||||
// if alignment is an issue.
|
||||
#define wxUSE_DEBUG_CONTEXT 1
|
||||
#define wxUSE_DEBUG_CONTEXT 0
|
||||
// If 1, enables wxDebugContext, for
|
||||
// writing error messages to file, etc.
|
||||
// If __WXDEBUG__ is not defined, will still use
|
||||
@ -128,7 +128,7 @@
|
||||
// since you may well need to output
|
||||
// an error log in a production
|
||||
// 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.
|
||||
// If this causes problems (e.g. link errors), set this to 0.
|
||||
|
||||
@ -162,10 +162,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define wxUSE_APPLE_IEEE 1
|
||||
// if enabled, the float codec written by Apple
|
||||
// will be used to write, in a portable way,
|
||||
// float on the disk
|
||||
#define wxUSE_APPLE_IEEE 1
|
||||
// if enabled, the float codec written by Apple
|
||||
// will be used to write, in a portable way,
|
||||
// float on the disk
|
||||
|
||||
/*
|
||||
* MS Windows/Windows NT
|
||||
@ -218,9 +218,9 @@
|
||||
|
||||
#define wxUSE_TYPEDEFS 0
|
||||
// Use typedefs not classes for wxPoint
|
||||
// and others, to reduce overhead and avoid
|
||||
// MS C7 memory bug. Bounds checker
|
||||
// complains about deallocating
|
||||
// and others, to reduce overhead and avoid
|
||||
// MS C7 memory bug. Bounds checker
|
||||
// complains about deallocating
|
||||
// arrays of wxPoints if wxPoint is a class.
|
||||
|
||||
#if (!defined(WIN32) && !defined(__WIN32__)) || defined(__GNUWIN32__) || defined(__BORLANDC__)
|
||||
|
@ -67,10 +67,10 @@ class WXDLLEXPORT wxSpinButton: public wxControl
|
||||
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
||||
|
||||
// IMPLEMENTATION
|
||||
bool MSWCommand(WXUINT param, WXWORD id);
|
||||
bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam);
|
||||
void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
||||
void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||
virtual void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
||||
virtual void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
||||
|
||||
protected:
|
||||
int m_min;
|
||||
|
@ -122,8 +122,9 @@ class WXDLLEXPORT wxTabCtrl: public wxControl
|
||||
void OnKillFocus(wxFocusEvent& event) { Default() ; }
|
||||
|
||||
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
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
|
@ -81,8 +81,8 @@ class WXDLLEXPORT wxToolBar95: public wxToolBarBase
|
||||
bool Realize() { return CreateTools(); };
|
||||
|
||||
// IMPLEMENTATION
|
||||
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
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
|
@ -410,8 +410,8 @@ public:
|
||||
// implementation
|
||||
// --------------
|
||||
void Command(wxCommandEvent& event) { ProcessCommand(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);
|
||||
|
||||
protected:
|
||||
// SetImageList helper
|
||||
@ -448,7 +448,7 @@ private:
|
||||
// NB: note that not all accessors make sense for all events, see the event
|
||||
// descriptions below
|
||||
// ----------------------------------------------------------------------------
|
||||
class WXDLLEXPORT wxTreeEvent : public wxCommandEvent
|
||||
class WXDLLEXPORT wxTreeEvent : public wxNotifyEvent
|
||||
{
|
||||
friend wxTreeCtrl;
|
||||
public:
|
||||
@ -470,10 +470,6 @@ public:
|
||||
// keyboard code (for wxEVT_COMMAND_TREE_KEY_DOWN only)
|
||||
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:
|
||||
// @@ we could save some space by using union here
|
||||
int m_code;
|
||||
|
@ -81,7 +81,7 @@ WXDLLEXPORT_DATA(extern const char*) wxPanelNameStr;
|
||||
WXDLLEXPORT_DATA(extern const wxSize) wxDefaultSize;
|
||||
WXDLLEXPORT_DATA(extern const wxPoint) wxDefaultPosition;
|
||||
|
||||
class WXDLLEXPORT wxWindow: public wxEvtHandler
|
||||
class WXDLLEXPORT wxWindow : public wxEvtHandler
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxWindow)
|
||||
|
||||
@ -89,18 +89,17 @@ class WXDLLEXPORT wxWindow: public wxEvtHandler
|
||||
friend class wxPaintDC;
|
||||
|
||||
public:
|
||||
wxWindow(void);
|
||||
inline wxWindow(wxWindow *parent, wxWindowID id,
|
||||
wxWindow();
|
||||
wxWindow(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
{
|
||||
m_children = new wxList;
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
virtual ~wxWindow(void);
|
||||
virtual ~wxWindow();
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
@ -109,25 +108,25 @@ public:
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
// Fit the window around the items
|
||||
virtual void Fit(void);
|
||||
virtual void Fit();
|
||||
|
||||
// Show or hide the window
|
||||
virtual bool Show(bool show);
|
||||
|
||||
// Is the window shown?
|
||||
virtual bool IsShown(void) const;
|
||||
virtual bool IsShown() const;
|
||||
|
||||
// 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
|
||||
virtual void Lower(void);
|
||||
virtual void Lower();
|
||||
|
||||
// Is the window enabled?
|
||||
virtual bool IsEnabled(void) const;
|
||||
virtual bool IsEnabled() const;
|
||||
|
||||
// For compatibility
|
||||
inline bool Enabled(void) const { return IsEnabled(); }
|
||||
inline bool Enabled() const { return IsEnabled(); }
|
||||
|
||||
// Dialog support: override these and call
|
||||
// base class members to add functionality
|
||||
@ -135,30 +134,30 @@ public:
|
||||
|
||||
// Transfer values to controls. If returns FALSE,
|
||||
// it's an application error (pops up a dialog)
|
||||
virtual bool TransferDataToWindow(void);
|
||||
virtual bool TransferDataToWindow();
|
||||
|
||||
// Transfer values from controls. If returns FALSE,
|
||||
// transfer failed: don't quit
|
||||
virtual bool TransferDataFromWindow(void);
|
||||
virtual bool TransferDataFromWindow();
|
||||
|
||||
// Validate controls. If returns FALSE,
|
||||
// validation failed: don't quit
|
||||
virtual bool Validate(void);
|
||||
virtual bool Validate();
|
||||
|
||||
// Return code for dialogs
|
||||
inline void SetReturnCode(int retCode);
|
||||
inline int GetReturnCode(void);
|
||||
inline int GetReturnCode();
|
||||
|
||||
// Set the 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
|
||||
static wxWindow *FindFocus(void);
|
||||
static wxWindow *FindFocus();
|
||||
|
||||
// Get character size
|
||||
virtual int GetCharHeight(void) const;
|
||||
virtual int GetCharWidth(void) const;
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
|
||||
// Get overall window size
|
||||
virtual void GetSize(int *width, int *height) const;
|
||||
@ -184,11 +183,11 @@ public:
|
||||
virtual void ScreenToClient(int *x, int *y) const;
|
||||
|
||||
// Set the focus to this window
|
||||
virtual void SetFocus(void);
|
||||
virtual void SetFocus();
|
||||
|
||||
// Capture/release mouse
|
||||
virtual void CaptureMouse(void);
|
||||
virtual void ReleaseMouse(void);
|
||||
virtual void CaptureMouse();
|
||||
virtual void ReleaseMouse();
|
||||
|
||||
// Enable or disable the window
|
||||
virtual void Enable(bool enable);
|
||||
@ -211,13 +210,13 @@ public:
|
||||
|
||||
// Set/get the window 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
|
||||
// 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)
|
||||
inline virtual wxString GetName(void) const;
|
||||
inline virtual wxString GetName() const;
|
||||
inline virtual void SetName(const wxString& name);
|
||||
|
||||
// Centre the window
|
||||
@ -252,7 +251,7 @@ public:
|
||||
// Caret manipulation
|
||||
virtual void CreateCaret(int w, int h);
|
||||
virtual void CreateCaret(const wxBitmap *bitmap);
|
||||
virtual void DestroyCaret(void);
|
||||
virtual void DestroyCaret();
|
||||
virtual void ShowCaret(bool show);
|
||||
virtual void SetCaretPos(int x, int y);
|
||||
virtual void GetCaretPos(int *x, int *y) const;
|
||||
@ -268,31 +267,31 @@ public:
|
||||
virtual void MakeModal(bool modal);
|
||||
|
||||
// Get the private handle (platform-dependent)
|
||||
inline void *GetHandle(void) const;
|
||||
inline void *GetHandle() const;
|
||||
|
||||
// Set/get the window's relatives
|
||||
inline wxWindow *GetParent(void) const;
|
||||
inline wxWindow *GetParent() const;
|
||||
inline void SetParent(wxWindow *p) ;
|
||||
inline wxWindow *GetGrandParent(void) const;
|
||||
inline wxWindow *GetGrandParent() const;
|
||||
inline wxList *GetChildren() const;
|
||||
|
||||
// Set/get the window's font
|
||||
virtual void SetFont(const wxFont& f);
|
||||
inline virtual wxFont *GetFont(void) const;
|
||||
inline virtual wxFont *GetFont() const;
|
||||
|
||||
// Set/get the window's validator
|
||||
void SetValidator(const wxValidator& validator);
|
||||
inline wxValidator *GetValidator(void) const;
|
||||
inline wxValidator *GetValidator() const;
|
||||
|
||||
// Set/get the window's style
|
||||
inline void SetWindowStyleFlag(long flag);
|
||||
inline long GetWindowStyleFlag(void) const;
|
||||
inline long GetWindowStyleFlag() const;
|
||||
|
||||
// Set/get double-clickability
|
||||
// TODO: we probably wish to get rid of this, and
|
||||
// always allow double clicks.
|
||||
inline void SetDoubleClick(bool flag);
|
||||
inline bool GetDoubleClick(void) const;
|
||||
inline bool GetDoubleClick() const;
|
||||
inline void AllowDoubleClick(bool value) { SetDoubleClick(value); }
|
||||
|
||||
// Handle a control command
|
||||
@ -300,7 +299,7 @@ public:
|
||||
|
||||
// Set/get event 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
|
||||
// be searched)
|
||||
@ -311,33 +310,33 @@ public:
|
||||
virtual bool Close(bool force = FALSE);
|
||||
|
||||
// Destroy the window (delayed, if a managed window)
|
||||
virtual bool Destroy(void) ;
|
||||
virtual bool Destroy() ;
|
||||
|
||||
// Mode for telling default OnSize members to
|
||||
// call Layout(), if not using Sizers, just top-down constraints
|
||||
inline void SetAutoLayout(bool a);
|
||||
inline bool GetAutoLayout(void) const;
|
||||
inline bool GetAutoLayout() const;
|
||||
|
||||
// Set/get constraints
|
||||
inline wxLayoutConstraints *GetConstraints(void) const;
|
||||
inline wxLayoutConstraints *GetConstraints() const;
|
||||
void SetConstraints(wxLayoutConstraints *c);
|
||||
|
||||
// Set/get window background colour
|
||||
inline virtual void SetBackgroundColour(const wxColour& col);
|
||||
inline virtual wxColour GetBackgroundColour(void) const;
|
||||
inline virtual wxColour GetBackgroundColour() const;
|
||||
|
||||
// Set/get window foreground colour
|
||||
inline virtual void SetForegroundColour(const wxColour& col);
|
||||
inline virtual wxColour GetForegroundColour(void) const;
|
||||
inline virtual wxColour GetForegroundColour() const;
|
||||
|
||||
// For backward compatibility
|
||||
inline virtual void SetButtonFont(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 *GetButtonFont(void) const { return GetFont(); };
|
||||
inline virtual wxFont *GetLabelFont() const { return GetFont(); };
|
||||
inline virtual wxFont *GetButtonFont() const { return GetFont(); };
|
||||
|
||||
// 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);
|
||||
|
||||
virtual void SetAcceleratorTable(const wxAcceleratorTable& accel);
|
||||
@ -365,27 +364,27 @@ public:
|
||||
const wxFont *theFont = NULL, bool use16 = FALSE) const;
|
||||
|
||||
// Is the window retained?
|
||||
inline bool IsRetained(void) const;
|
||||
inline bool IsRetained() const;
|
||||
|
||||
// Warp the pointer the given position
|
||||
virtual void WarpPointer(int x_pos, int y_pos) ;
|
||||
|
||||
// Clear the window
|
||||
virtual void Clear(void);
|
||||
virtual void Clear();
|
||||
|
||||
// Find a window by id or name
|
||||
virtual wxWindow *FindWindow(long id);
|
||||
virtual wxWindow *FindWindow(const wxString& name);
|
||||
|
||||
// Constraint operations
|
||||
bool Layout(void);
|
||||
bool Layout();
|
||||
void SetSizer(wxSizer *sizer); // Adds sizer child to this window
|
||||
inline wxSizer *GetSizer(void) const ;
|
||||
inline wxWindow *GetSizerParent(void) const ;
|
||||
inline wxSizer *GetSizer() const ;
|
||||
inline wxWindow *GetSizerParent() const ;
|
||||
inline void SetSizerParent(wxWindow *win);
|
||||
|
||||
// Do Update UI processing for controls
|
||||
void UpdateWindowUI(void);
|
||||
void UpdateWindowUI();
|
||||
|
||||
void OnEraseBackground(wxEraseEvent& event);
|
||||
void OnChar(wxKeyEvent& event);
|
||||
@ -410,15 +409,18 @@ public:
|
||||
|
||||
// Windows subclassing
|
||||
void SubclassWin(WXHWND hWnd);
|
||||
void UnsubclassWin(void);
|
||||
virtual long Default(void);
|
||||
void UnsubclassWin();
|
||||
virtual long Default();
|
||||
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 *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const ;
|
||||
virtual void PreDelete(WXHDC dc); // Allows system cleanup
|
||||
// TO DO: how many of these need to be virtual?
|
||||
virtual WXHWND GetHWND(void) const ;
|
||||
virtual WXHWND GetHWND() const ;
|
||||
virtual void SetHWND(WXHWND hWnd);
|
||||
|
||||
// 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 RemoveChild(wxWindow *child); // Removes reference to child
|
||||
// (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
|
||||
virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; };
|
||||
|
||||
// Constraint implementation
|
||||
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
|
||||
// this window, we must delete any constraints we're involved with.
|
||||
void AddConstraintReference(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 bool LayoutPhase1(int *noChanges);
|
||||
virtual bool LayoutPhase2(int *noChanges);
|
||||
@ -487,25 +489,25 @@ public:
|
||||
virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd);
|
||||
|
||||
// Make sure the window style reflects the HWND style (roughly)
|
||||
virtual void AdoptAttributesFromHWND(void);
|
||||
virtual void AdoptAttributesFromHWND();
|
||||
|
||||
// Setup background and foreground colours correctly
|
||||
virtual void SetupColours(void);
|
||||
virtual void SetupColours();
|
||||
|
||||
// Saves the last message information before calling base version
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
// Handlers
|
||||
virtual void MSWOnCreate(WXLPCREATESTRUCT cs);
|
||||
virtual bool MSWOnPaint(void);
|
||||
virtual WXHICON MSWOnQueryDragIcon(void) { return 0; }
|
||||
virtual bool MSWOnPaint();
|
||||
virtual WXHICON MSWOnQueryDragIcon() { return 0; }
|
||||
virtual void MSWOnSize(int x, int y, WXUINT flag);
|
||||
virtual void MSWOnWindowPosChanging(void *lpPos);
|
||||
virtual void MSWOnHScroll(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 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,
|
||||
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 void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
|
||||
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.
|
||||
virtual bool MSWOnQueryEndSession(long logOff);
|
||||
virtual bool MSWOnEndSession(bool endSession, long logOff);
|
||||
virtual bool MSWOnDestroy(void);
|
||||
virtual bool MSWOnDestroy();
|
||||
virtual bool MSWOnSetFocus(WXHWND wnd);
|
||||
virtual bool MSWOnKillFocus(WXHWND wnd);
|
||||
virtual void MSWOnDropFiles(WXWPARAM wParam);
|
||||
@ -565,10 +567,10 @@ public:
|
||||
virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
virtual bool MSWProcessMessage(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
|
||||
void MSWDetachWindowMenu(void);
|
||||
void MSWDetachWindowMenu();
|
||||
|
||||
inline WXFARPROC MSWGetOldWndProc() const;
|
||||
inline void MSWSetOldWndProc(WXFARPROC proc);
|
||||
@ -578,9 +580,9 @@ public:
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
inline void SetShowing(bool show);
|
||||
inline bool IsUserEnabled(void) const;
|
||||
inline bool GetUseCtl3D(void) const ;
|
||||
inline bool GetTransparentBackground(void) const ;
|
||||
inline bool IsUserEnabled() const;
|
||||
inline bool GetUseCtl3D() const ;
|
||||
inline bool GetTransparentBackground() const ;
|
||||
|
||||
// Responds to colour changes: passes event on to children.
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
@ -590,7 +592,7 @@ public:
|
||||
|
||||
// Sends an OnInitDialog event, which in turns transfers data to
|
||||
// to the window via validators.
|
||||
virtual void InitDialog(void);
|
||||
virtual void InitDialog();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//// PROTECTED DATA
|
||||
@ -678,57 +680,61 @@ public:
|
||||
bool m_isBeingDeleted; // Fudge because can't access parent
|
||||
// when being deleted
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
private:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//// 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 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 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 wxFont *wxWindow::GetFont(void) const { return (wxFont *) & m_windowFont; }
|
||||
inline wxString wxWindow::GetName(void) const { return m_windowName; }
|
||||
inline wxFont *wxWindow::GetFont() const { return (wxFont *) & m_windowFont; }
|
||||
inline wxString wxWindow::GetName() const { return m_windowName; }
|
||||
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::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 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 bool wxWindow::GetAutoLayout(void) const { return m_autoLayout; }
|
||||
inline wxLayoutConstraints *wxWindow::GetConstraints(void) const { return m_constraints; }
|
||||
inline bool wxWindow::GetAutoLayout() const { return m_autoLayout; }
|
||||
inline wxLayoutConstraints *wxWindow::GetConstraints() const { return m_constraints; }
|
||||
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 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 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 wxList *wxWindow::GetConstraintsInvolvedIn(void) const { return m_constraintsInvolvedIn; }
|
||||
inline wxSizer *wxWindow::GetSizer(void) const { return m_windowSizer; }
|
||||
inline wxWindow *wxWindow::GetSizerParent(void) const { return m_sizerParent; }
|
||||
inline wxList *wxWindow::GetConstraintsInvolvedIn() const { return m_constraintsInvolvedIn; }
|
||||
inline wxSizer *wxWindow::GetSizer() const { return m_windowSizer; }
|
||||
inline wxWindow *wxWindow::GetSizerParent() const { return m_sizerParent; }
|
||||
inline void wxWindow::SetSizerParent(wxWindow *win) { m_sizerParent = win; }
|
||||
inline WXFARPROC wxWindow::MSWGetOldWndProc() const { return m_oldWndProc; }
|
||||
inline void wxWindow::MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; }
|
||||
inline wxValidator *wxWindow::GetValidator(void) const { return m_windowValidator; }
|
||||
inline bool wxWindow::IsUserEnabled(void) const { return m_winEnabled; }
|
||||
inline bool wxWindow::GetUseCtl3D(void) const { return m_useCtl3D; }
|
||||
inline bool wxWindow::GetTransparentBackground(void) const { return m_backgroundTransparent; }
|
||||
inline wxValidator *wxWindow::GetValidator() const { return m_windowValidator; }
|
||||
inline bool wxWindow::IsUserEnabled() const { return m_winEnabled; }
|
||||
inline bool wxWindow::GetUseCtl3D() const { return m_useCtl3D; }
|
||||
inline bool wxWindow::GetTransparentBackground() const { return m_backgroundTransparent; }
|
||||
inline void wxWindow::SetReturnCode(int retCode) { m_returnCode = retCode; }
|
||||
inline int wxWindow::GetReturnCode(void) { return m_returnCode; }
|
||||
inline bool wxWindow::IsBeingDeleted(void) { return m_isBeingDeleted; }
|
||||
inline int wxWindow::GetReturnCode() { return m_returnCode; }
|
||||
inline bool wxWindow::IsBeingDeleted() { return m_isBeingDeleted; }
|
||||
|
||||
// Window specific (so far)
|
||||
WXDLLEXPORT wxWindow* wxGetActiveWindow(void);
|
||||
WXDLLEXPORT wxWindow* wxGetActiveWindow();
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxList) wxTopLevelWindows;
|
||||
|
||||
@ -736,7 +742,7 @@ WXDLLEXPORT int wxCharCodeMSWToWX(int keySym);
|
||||
WXDLLEXPORT int wxCharCodeWXToMSW(int id, bool *IsVirtual);
|
||||
|
||||
// Allocates control ids
|
||||
WXDLLEXPORT int NewControlId(void);
|
||||
WXDLLEXPORT int NewControlId();
|
||||
|
||||
#endif
|
||||
// _WX_WINDOW_H_
|
||||
|
@ -6,7 +6,7 @@
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COLOUR_H_
|
||||
@ -77,7 +77,7 @@ public:
|
||||
*/
|
||||
|
||||
private:
|
||||
bool m_isInit;
|
||||
bool m_isInit;
|
||||
unsigned char m_red;
|
||||
unsigned char m_blue;
|
||||
unsigned char m_green;
|
||||
@ -92,4 +92,4 @@ private:
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_COLOUR_H_
|
||||
// _WX_COLOUR_H_
|
||||
|
@ -28,6 +28,11 @@
|
||||
#include "wx/utils.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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -1545,5 +1550,9 @@ bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
|
||||
pattern++;
|
||||
return ((*str == '\0') && (*pattern == '\0'));
|
||||
};
|
||||
|
||||
#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)
|
||||
{
|
||||
char *found = node->key.string;
|
||||
const char *found = node->GetKeyString();
|
||||
if (found)
|
||||
return wxString(found);
|
||||
}
|
||||
@ -621,12 +621,6 @@ wxSize wxGetDisplaySize()
|
||||
return wxSize(x, y);
|
||||
}
|
||||
|
||||
wxResourceCache::wxResourceCache () : wxList() {
|
||||
}
|
||||
|
||||
wxResourceCache::wxResourceCache (const unsigned int the_key_type) : wxList(the_key_type) {
|
||||
}
|
||||
|
||||
wxResourceCache::~wxResourceCache () {
|
||||
wxNode *node = First ();
|
||||
while (node) {
|
||||
|
@ -275,10 +275,8 @@ bool wxMsgCatalog::Load(const char *szDirPrefix, const char *szName)
|
||||
// examine header
|
||||
bool bValid = (size_t)nSize > sizeof(wxMsgCatalogHeader);
|
||||
|
||||
wxMsgCatalogHeader *pHeader;
|
||||
wxMsgCatalogHeader *pHeader = (wxMsgCatalogHeader *)m_pData;
|
||||
if ( bValid ) {
|
||||
pHeader = (wxMsgCatalogHeader *)m_pData;
|
||||
|
||||
// we'll have to swap all the integers if it's true
|
||||
m_bSwapped = pHeader->magic == MSGCATALOG_MAGIC_SW;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,10 @@
|
||||
|
||||
#if wxUSE_ODBC
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4706) // assignment within conditional expression
|
||||
#endif // VC++
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/utils.h"
|
||||
#include "wx/dialog.h"
|
||||
@ -1827,4 +1831,8 @@ bool wxQueryField::IsDirty(void) {
|
||||
return dirty;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default:4706) // assignment within conditional expression
|
||||
#endif // VC++
|
||||
|
||||
#endif // wxUSE_ODBC
|
||||
|
@ -20,6 +20,12 @@
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_WX_RESOURCES
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4706) // assignment within conditional expression
|
||||
#endif // VC++
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/defs.h"
|
||||
#include "wx/setup.h"
|
||||
@ -59,8 +65,6 @@
|
||||
|
||||
#include "wx/log.h"
|
||||
|
||||
#if wxUSE_WX_RESOURCES
|
||||
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
@ -2853,4 +2857,8 @@ wxControl *wxWindow::CreateItem(const wxItemResource *resource, const wxItemReso
|
||||
return table->CreateItem((wxWindow *)this, resource, parentResource);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default:4706) // assignment within conditional expression
|
||||
#endif // VC++
|
||||
|
||||
#endif // wxUSE_WX_RESOURCES
|
||||
|
@ -195,7 +195,7 @@ void wxToolBarBase::AddSeparator ()
|
||||
{
|
||||
wxToolBarTool *tool = new wxToolBarTool;
|
||||
tool->m_toolStyle = wxTOOL_STYLE_SEPARATOR;
|
||||
m_tools.Append(tool);
|
||||
m_tools.Append(-1, tool);
|
||||
}
|
||||
|
||||
void wxToolBarBase::ClearTools(void)
|
||||
|
@ -50,10 +50,15 @@
|
||||
#include <commctrl.h>
|
||||
#endif
|
||||
|
||||
// use debug CRT functions for memory leak detections in VC++
|
||||
/* Here we go again commenting it out. PLEASE don't
|
||||
* uncomment this again.
|
||||
#if defined(__WXDEBUG__) && defined(_MSC_VER)
|
||||
// use debug CRT functions for memory leak detections in VC++ if we're not
|
||||
// using wxWindows own methods
|
||||
#if defined(__WXDEBUG__) && defined(_MSC_VER) && !wxUSE_GLOBAL_MEMORY_OPERATORS
|
||||
#define wxUSE_VC_CRTDBG
|
||||
#else
|
||||
#undef wxUSE_VC_CRTDBG
|
||||
#endif
|
||||
|
||||
#ifdef wxUSE_VC_CRTDBG
|
||||
// VC++ uses this macro as debug/release mode indicator
|
||||
#ifndef _DEBUG
|
||||
#define _DEBUG
|
||||
@ -61,7 +66,6 @@
|
||||
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
*/
|
||||
|
||||
extern char *wxBuffer;
|
||||
extern char *wxOsVersion;
|
||||
@ -115,32 +119,12 @@ bool wxApp::Initialize()
|
||||
{
|
||||
wxBuffer = new char[1500];
|
||||
|
||||
/* PLEASE don't uncomment this again. IT DOESN'T WORK when building
|
||||
* using the makefile.
|
||||
#if defined(__WXDEBUG__) && defined(_MSC_VER)
|
||||
#ifdef wxUSE_VC_CRTDBG
|
||||
// do check for memory leaks on program exit
|
||||
// (another useful flag is _CRTDBG_DELAY_FREE_MEM_DF which doesn't free
|
||||
// deallocated memory which may be used to simulate low-memory condition)
|
||||
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
|
||||
#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();
|
||||
|
||||
|
@ -739,35 +739,35 @@ bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long fla
|
||||
bool wxXPMFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette)
|
||||
{
|
||||
#if wxUSE_XPM_IN_MSW
|
||||
HDC dc = NULL;
|
||||
HDC dc = NULL;
|
||||
|
||||
Visual *visual = NULL;
|
||||
XImage ximage;
|
||||
XImage ximage;
|
||||
|
||||
dc = CreateCompatibleDC(NULL);
|
||||
if (dc)
|
||||
{
|
||||
dc = CreateCompatibleDC(NULL);
|
||||
if (dc)
|
||||
{
|
||||
if (SelectObject(dc, (HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap))
|
||||
{ /* for following SetPixel */
|
||||
/* fill the XImage struct 'by hand' */
|
||||
ximage.width = M_BITMAPHANDLERDATA->m_width;
|
||||
ximage.height = M_BITMAPHANDLERDATA->m_height;
|
||||
ximage.depth = M_BITMAPHANDLERDATA->m_depth;
|
||||
ximage.bitmap = (void *)M_BITMAPHANDLERDATA->m_hBitmap;
|
||||
int errorStatus = XpmWriteFileFromImage(&dc, WXSTRINGCAST name,
|
||||
&ximage, (XImage *) NULL, (XpmAttributes *) NULL);
|
||||
{
|
||||
/* for following SetPixel */
|
||||
/* fill the XImage struct 'by hand' */
|
||||
ximage.width = M_BITMAPHANDLERDATA->m_width;
|
||||
ximage.height = M_BITMAPHANDLERDATA->m_height;
|
||||
ximage.depth = M_BITMAPHANDLERDATA->m_depth;
|
||||
ximage.bitmap = (HBITMAP)M_BITMAPHANDLERDATA->m_hBitmap;
|
||||
int errorStatus = XpmWriteFileFromImage(&dc, WXSTRINGCAST name,
|
||||
&ximage, (XImage *) NULL, (XpmAttributes *) NULL);
|
||||
|
||||
if (dc)
|
||||
DeleteDC(dc);
|
||||
if (dc)
|
||||
DeleteDC(dc);
|
||||
|
||||
if (errorStatus == XpmSuccess)
|
||||
return TRUE; /* no error */
|
||||
else
|
||||
return FALSE;
|
||||
if (errorStatus == XpmSuccess)
|
||||
return TRUE; /* no error */
|
||||
else
|
||||
return FALSE;
|
||||
} else return FALSE;
|
||||
} else return FALSE;
|
||||
} else return FALSE;
|
||||
#else
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
@ -52,8 +52,8 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
|
||||
|
||||
if ( style & wxBU_AUTODRAW )
|
||||
{
|
||||
m_marginX = wxDEFAULT_BUTTON_MARGIN;
|
||||
m_marginY = wxDEFAULT_BUTTON_MARGIN;
|
||||
m_marginX = wxDEFAULT_BUTTON_MARGIN;
|
||||
m_marginY = wxDEFAULT_BUTTON_MARGIN;
|
||||
}
|
||||
|
||||
int x = pos.x;
|
||||
@ -67,10 +67,10 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
|
||||
m_windowId = id;
|
||||
|
||||
if ( width == -1 && bitmap.Ok())
|
||||
width = bitmap.GetWidth() + 2*m_marginX;
|
||||
width = bitmap.GetWidth() + 2*m_marginX;
|
||||
|
||||
if ( height == -1 && bitmap.Ok())
|
||||
height = bitmap.GetHeight() + 2*m_marginY;
|
||||
height = bitmap.GetHeight() + 2*m_marginY;
|
||||
|
||||
HWND wx_button =
|
||||
CreateWindowEx(0, "BUTTON", "", BS_OWNERDRAW | WS_TABSTOP | WS_CHILD,
|
||||
@ -97,22 +97,22 @@ void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
|
||||
|
||||
bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item)
|
||||
{
|
||||
long style = GetWindowLong((HWND) GetHWND(), GWL_STYLE);
|
||||
long style = GetWindowLong((HWND) GetHWND(), GWL_STYLE);
|
||||
#if defined(__WIN95__)
|
||||
if (style & BS_BITMAP)
|
||||
{
|
||||
// Should we call Default() here?
|
||||
// Default();
|
||||
if (style & BS_BITMAP)
|
||||
{
|
||||
// Should we call Default() here?
|
||||
// Default();
|
||||
|
||||
// Let default procedure draw the bitmap, which is defined
|
||||
// in the Windows resource.
|
||||
return FALSE;
|
||||
}
|
||||
// Let default procedure draw the bitmap, which is defined
|
||||
// in the Windows resource.
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT) item;
|
||||
|
||||
wxBitmap* bitmap = &m_buttonBitmap;
|
||||
wxBitmap* bitmap = &m_buttonBitmap;
|
||||
|
||||
UINT state = lpDIS->itemState;
|
||||
if ((state & ODS_SELECTED) && m_buttonBitmapSelected.Ok())
|
||||
@ -143,24 +143,24 @@ bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item)
|
||||
DrawFace((WXHDC) hDC, lpDIS->rcItem.left, lpDIS->rcItem.top, lpDIS->rcItem.right, lpDIS->rcItem.bottom,
|
||||
((state & ODS_SELECTED) == ODS_SELECTED));
|
||||
|
||||
// Centre the bitmap in the control area
|
||||
int x1 = (int) (x + ((width - bitmap->GetWidth()) / 2));
|
||||
int y1 = (int) (y + ((height - bitmap->GetHeight()) / 2));
|
||||
// Centre the bitmap in the control area
|
||||
int x1 = (int) (x + ((width - bitmap->GetWidth()) / 2));
|
||||
int y1 = (int) (y + ((height - bitmap->GetHeight()) / 2));
|
||||
|
||||
if ( (state & ODS_SELECTED) && (GetWindowStyleFlag() & wxBU_AUTODRAW) )
|
||||
{
|
||||
x1 ++;
|
||||
y1 ++;
|
||||
}
|
||||
if ( (state & ODS_SELECTED) && (GetWindowStyleFlag() & wxBU_AUTODRAW) )
|
||||
{
|
||||
x1 ++;
|
||||
y1 ++;
|
||||
}
|
||||
|
||||
::BitBlt(hDC, x1, y1, bitmap->GetWidth(), bitmap->GetHeight(), memDC, 0, 0, SRCCOPY);
|
||||
::BitBlt(hDC, x1, y1, bitmap->GetWidth(), bitmap->GetHeight(), memDC, 0, 0, SRCCOPY);
|
||||
|
||||
if ( (state & ODS_DISABLED) && (GetWindowStyleFlag() & wxBU_AUTODRAW) )
|
||||
DrawButtonDisable( (WXHDC) hDC, lpDIS->rcItem.left, lpDIS->rcItem.top, lpDIS->rcItem.right, lpDIS->rcItem.bottom, TRUE ) ;
|
||||
else if ( (state & ODS_FOCUS) && (GetWindowStyleFlag() & wxBU_AUTODRAW) )
|
||||
DrawButtonFocus( (WXHDC) hDC, lpDIS->rcItem.left, lpDIS->rcItem.top, lpDIS->rcItem.right, lpDIS->rcItem.bottom, ((state & ODS_SELECTED) == ODS_SELECTED));
|
||||
if ( (state & ODS_DISABLED) && (GetWindowStyleFlag() & wxBU_AUTODRAW) )
|
||||
DrawButtonDisable( (WXHDC) hDC, lpDIS->rcItem.left, lpDIS->rcItem.top, lpDIS->rcItem.right, lpDIS->rcItem.bottom, TRUE ) ;
|
||||
else if ( (state & ODS_FOCUS) && (GetWindowStyleFlag() & wxBU_AUTODRAW) )
|
||||
DrawButtonFocus( (WXHDC) hDC, lpDIS->rcItem.left, lpDIS->rcItem.top, lpDIS->rcItem.right, lpDIS->rcItem.bottom, ((state & ODS_SELECTED) == ODS_SELECTED));
|
||||
|
||||
::SelectObject(memDC, old);
|
||||
::SelectObject(memDC, old);
|
||||
|
||||
::DeleteDC(memDC);
|
||||
|
||||
@ -169,8 +169,8 @@ bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item)
|
||||
|
||||
void wxBitmapButton::DrawFace( WXHDC dc, int left, int top, int right, int bottom, bool sel )
|
||||
{
|
||||
HPEN oldp;
|
||||
HBRUSH oldb ;
|
||||
HPEN oldp;
|
||||
HBRUSH oldb ;
|
||||
|
||||
HPEN penBorder;
|
||||
HPEN penLight;
|
||||
@ -178,51 +178,51 @@ void wxBitmapButton::DrawFace( WXHDC dc, int left, int top, int right, int botto
|
||||
HBRUSH brushFace;
|
||||
COLORREF ms_color;
|
||||
|
||||
ms_color = GetSysColor(COLOR_WINDOWFRAME) ;
|
||||
penBorder = CreatePen(PS_SOLID,0,ms_color) ;
|
||||
ms_color = GetSysColor(COLOR_WINDOWFRAME) ;
|
||||
penBorder = CreatePen(PS_SOLID,0,ms_color) ;
|
||||
|
||||
ms_color = GetSysColor(COLOR_BTNSHADOW) ;
|
||||
penShadow = CreatePen(PS_SOLID,0,ms_color) ;
|
||||
ms_color = GetSysColor(COLOR_BTNSHADOW) ;
|
||||
penShadow = CreatePen(PS_SOLID,0,ms_color) ;
|
||||
|
||||
ms_color = GetSysColor(COLOR_BTNHIGHLIGHT) ;
|
||||
penLight = CreatePen(PS_SOLID,0,ms_color) ;
|
||||
ms_color = GetSysColor(COLOR_BTNHIGHLIGHT) ;
|
||||
penLight = CreatePen(PS_SOLID,0,ms_color) ;
|
||||
|
||||
ms_color = GetSysColor(COLOR_BTNFACE) ;
|
||||
brushFace = CreateSolidBrush(ms_color) ;
|
||||
ms_color = GetSysColor(COLOR_BTNFACE) ;
|
||||
brushFace = CreateSolidBrush(ms_color) ;
|
||||
|
||||
oldp = (HPEN) SelectObject( (HDC) dc, GetStockObject( NULL_PEN ) ) ;
|
||||
oldb = (HBRUSH) SelectObject( (HDC) dc, brushFace ) ;
|
||||
Rectangle( (HDC) dc, left, top, right, bottom ) ;
|
||||
SelectObject( (HDC) dc, penBorder) ;
|
||||
oldp = (HPEN) SelectObject( (HDC) dc, GetStockObject( NULL_PEN ) ) ;
|
||||
oldb = (HBRUSH) SelectObject( (HDC) dc, brushFace ) ;
|
||||
Rectangle( (HDC) dc, left, top, right, bottom ) ;
|
||||
SelectObject( (HDC) dc, penBorder) ;
|
||||
MoveToEx((HDC) dc,left+1,top,NULL);LineTo((HDC) dc,right-1,top);
|
||||
MoveToEx((HDC) dc,left,top+1,NULL);LineTo((HDC) dc,left,bottom-1);
|
||||
MoveToEx((HDC) dc,left+1,bottom-1,NULL);LineTo((HDC) dc,right-1,bottom-1);
|
||||
MoveToEx((HDC) dc,right-1,top+1,NULL);LineTo((HDC) dc,right-1,bottom-1);
|
||||
|
||||
SelectObject( (HDC) dc, penShadow) ;
|
||||
if (sel)
|
||||
{
|
||||
MoveToEx((HDC) dc,left+1 ,bottom-2 ,NULL) ;
|
||||
LineTo((HDC) dc, left+1 ,top+1) ;
|
||||
LineTo((HDC) dc, right-2 ,top+1) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveToEx((HDC) dc,left+1 ,bottom-2 ,NULL) ;
|
||||
LineTo((HDC) dc, right-2 ,bottom-2) ;
|
||||
LineTo((HDC) dc, right-2 ,top) ;
|
||||
MoveToEx((HDC) dc,left+2 ,bottom-3 ,NULL) ;
|
||||
LineTo((HDC) dc, right-3 ,bottom-3) ;
|
||||
LineTo((HDC) dc, right-3 ,top+1) ;
|
||||
SelectObject( (HDC) dc, penShadow) ;
|
||||
if (sel)
|
||||
{
|
||||
MoveToEx((HDC) dc,left+1 ,bottom-2 ,NULL) ;
|
||||
LineTo((HDC) dc, left+1 ,top+1) ;
|
||||
LineTo((HDC) dc, right-2 ,top+1) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveToEx((HDC) dc,left+1 ,bottom-2 ,NULL) ;
|
||||
LineTo((HDC) dc, right-2 ,bottom-2) ;
|
||||
LineTo((HDC) dc, right-2 ,top) ;
|
||||
MoveToEx((HDC) dc,left+2 ,bottom-3 ,NULL) ;
|
||||
LineTo((HDC) dc, right-3 ,bottom-3) ;
|
||||
LineTo((HDC) dc, right-3 ,top+1) ;
|
||||
|
||||
SelectObject( (HDC) dc, penLight) ;
|
||||
SelectObject( (HDC) dc, penLight) ;
|
||||
|
||||
MoveToEx((HDC) dc,left+1 ,bottom-2 ,NULL) ;
|
||||
LineTo((HDC) dc, left+1 ,top+1) ;
|
||||
LineTo((HDC) dc, right-2 ,top+1) ;
|
||||
}
|
||||
SelectObject((HDC) dc,oldp) ;
|
||||
SelectObject((HDC) dc,oldb) ;
|
||||
MoveToEx((HDC) dc,left+1 ,bottom-2 ,NULL) ;
|
||||
LineTo((HDC) dc, left+1 ,top+1) ;
|
||||
LineTo((HDC) dc, right-2 ,top+1) ;
|
||||
}
|
||||
SelectObject((HDC) dc,oldp) ;
|
||||
SelectObject((HDC) dc,oldb) ;
|
||||
|
||||
DeleteObject(penBorder);
|
||||
DeleteObject(penLight);
|
||||
@ -234,28 +234,28 @@ void wxBitmapButton::DrawFace( WXHDC dc, int left, int top, int right, int botto
|
||||
|
||||
void wxBitmapButton::DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel )
|
||||
{
|
||||
RECT rect;
|
||||
rect.left = left;
|
||||
rect.top = top;
|
||||
rect.right = right;
|
||||
rect.bottom = bottom;
|
||||
InflateRect( &rect, - FOCUS_MARGIN, - FOCUS_MARGIN ) ;
|
||||
if ( sel )
|
||||
OffsetRect( &rect, 1, 1 ) ;
|
||||
DrawFocusRect( (HDC) dc, &rect ) ;
|
||||
RECT rect;
|
||||
rect.left = left;
|
||||
rect.top = top;
|
||||
rect.right = right;
|
||||
rect.bottom = bottom;
|
||||
InflateRect( &rect, - FOCUS_MARGIN, - FOCUS_MARGIN ) ;
|
||||
if ( sel )
|
||||
OffsetRect( &rect, 1, 1 ) ;
|
||||
DrawFocusRect( (HDC) dc, &rect ) ;
|
||||
}
|
||||
|
||||
extern HBRUSH wxDisableButtonBrush;
|
||||
void wxBitmapButton::DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg )
|
||||
{
|
||||
HBRUSH old = (HBRUSH) SelectObject( (HDC) dc, wxDisableButtonBrush ) ;
|
||||
HBRUSH old = (HBRUSH) SelectObject( (HDC) dc, wxDisableButtonBrush ) ;
|
||||
|
||||
if ( with_marg )
|
||||
::PatBlt( (HDC) dc, left + m_marginX, top + m_marginY,
|
||||
right - 2 * m_marginX, bottom - 2 * m_marginY,
|
||||
0xfa0089ul ) ;
|
||||
else ::PatBlt( (HDC) dc, left, top, right, bottom, 0xfa0089ul ) ;
|
||||
if ( with_marg )
|
||||
::PatBlt( (HDC) dc, left + m_marginX, top + m_marginY,
|
||||
right - 2 * m_marginX, bottom - 2 * m_marginY,
|
||||
0xfa0089ul ) ;
|
||||
else ::PatBlt( (HDC) dc, left, top, right, bottom, 0xfa0089ul ) ;
|
||||
|
||||
::SelectObject( (HDC) dc, old ) ;
|
||||
::SelectObject( (HDC) dc, old ) ;
|
||||
}
|
||||
|
||||
|
@ -240,6 +240,12 @@ void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
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)
|
||||
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);
|
||||
}
|
||||
|
||||
// If non-default width...
|
||||
if (w1 >= 0)
|
||||
control_width = w1;
|
||||
|
||||
control_height = h1;
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
bool wxControl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||
bool wxControl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam,
|
||||
WXLPARAM* WXUNUSED(result))
|
||||
{
|
||||
#if defined(__WIN95__)
|
||||
wxCommandEvent event(wxEVT_NULL, m_windowId);
|
||||
@ -235,18 +236,18 @@ bool wxControl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||
break;
|
||||
}
|
||||
*/
|
||||
default :
|
||||
default:
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
event.SetEventType(eventType);
|
||||
event.SetEventObject(this);
|
||||
|
||||
if ( !GetEventHandler()->ProcessEvent(event) )
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
#else
|
||||
return FALSE;
|
||||
#else // !Win95
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
308
src/msw/dc.cpp
308
src/msw/dc.cpp
@ -6,7 +6,7 @@
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
@ -242,7 +242,7 @@ void wxDC::SetPalette(const wxPalette& palette)
|
||||
m_oldPalette = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_palette.Ok() && m_palette.GetHPALETTE())
|
||||
@ -474,28 +474,28 @@ void wxDC::DrawRectangle(long x, long y, long width, long height)
|
||||
do_pen = m_pen.Ok() && m_pen.GetStyle() != wxTRANSPARENT;
|
||||
|
||||
if (do_brush) {
|
||||
HPEN orig_pen = NULL;
|
||||
HPEN orig_pen = NULL;
|
||||
|
||||
if (do_pen || !m_pen.Ok())
|
||||
orig_pen = (HPEN) ::SelectObject((HDC) m_hDC, (HPEN) ::GetStockObject(NULL_PEN));
|
||||
if (do_pen || !m_pen.Ok())
|
||||
orig_pen = (HPEN) ::SelectObject((HDC) m_hDC, (HPEN) ::GetStockObject(NULL_PEN));
|
||||
|
||||
(void)Rectangle((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y),
|
||||
XLOG2DEV(x2) + 1, YLOG2DEV(y2) + 1);
|
||||
(void)Rectangle((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y),
|
||||
XLOG2DEV(x2) + 1, YLOG2DEV(y2) + 1);
|
||||
|
||||
if (do_pen || !m_pen.Ok())
|
||||
::SelectObject((HDC) m_hDC , orig_pen);
|
||||
if (do_pen || !m_pen.Ok())
|
||||
::SelectObject((HDC) m_hDC , orig_pen);
|
||||
}
|
||||
if (do_pen) {
|
||||
HBRUSH orig_brush = NULL;
|
||||
HBRUSH orig_brush = NULL;
|
||||
|
||||
if (do_brush || !m_brush.Ok())
|
||||
orig_brush = (HBRUSH) ::SelectObject((HDC) m_hDC, (HBRUSH) ::GetStockObject(NULL_BRUSH));
|
||||
if (do_brush || !m_brush.Ok())
|
||||
orig_brush = (HBRUSH) ::SelectObject((HDC) m_hDC, (HBRUSH) ::GetStockObject(NULL_BRUSH));
|
||||
|
||||
(void)Rectangle((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y),
|
||||
XLOG2DEV(x2), YLOG2DEV(y2));
|
||||
(void)Rectangle((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y),
|
||||
XLOG2DEV(x2), YLOG2DEV(y2));
|
||||
|
||||
if (do_brush || !m_brush.Ok())
|
||||
::SelectObject((HDC) m_hDC, orig_brush);
|
||||
if (do_brush || !m_brush.Ok())
|
||||
::SelectObject((HDC) m_hDC, orig_brush);
|
||||
}
|
||||
#else
|
||||
(void)Rectangle((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2));
|
||||
@ -563,16 +563,16 @@ void wxDC::DrawEllipticArc(long x,long y,long w,long h,double sa,double ea)
|
||||
if (m_signY > 0)
|
||||
{
|
||||
(void)Pie((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2)+1, YLOG2DEV(y2)+1,
|
||||
rx1, ry1, rx2, ry2);
|
||||
rx1, ry1, rx2, ry2);
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)Pie((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y)-1, XLOG2DEV(x2)+1, YLOG2DEV(y2),
|
||||
rx1, ry1-1, rx2, ry2-1);
|
||||
rx1, ry1-1, rx2, ry2-1);
|
||||
}
|
||||
::SelectObject((HDC) m_hDC, orig_pen);
|
||||
(void)Arc((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2),
|
||||
rx1, ry1, rx2, ry2);
|
||||
rx1, ry1, rx2, ry2);
|
||||
|
||||
CalcBoundingBox(x, y);
|
||||
CalcBoundingBox(x2, y2);
|
||||
@ -692,7 +692,7 @@ void wxDC::DrawText(const wxString& text, long x, long y, bool use16bit)
|
||||
if (m_textForegroundColour.Ok())
|
||||
SetTextColor((HDC) m_hDC, m_textForegroundColour.GetPixel() ) ;
|
||||
|
||||
DWORD old_background;
|
||||
DWORD old_background = 0;
|
||||
if (m_textBackgroundColour.Ok())
|
||||
{
|
||||
old_background = SetBkColor((HDC) m_hDC, m_textBackgroundColour.GetPixel() ) ;
|
||||
@ -1007,42 +1007,42 @@ void wxDC::SetDeviceOrigin(long x, long y)
|
||||
|
||||
long wxDC::DeviceToLogicalX(long x) const
|
||||
{
|
||||
return (long) (((x) - m_deviceOriginX)/(m_logicalScaleX*m_userScaleX*m_signX*m_systemScaleX) - m_logicalOriginX) ;
|
||||
return (long) (((x) - m_deviceOriginX)/(m_logicalScaleX*m_userScaleX*m_signX*m_systemScaleX) - m_logicalOriginX) ;
|
||||
}
|
||||
|
||||
long wxDC::DeviceToLogicalXRel(long x) const
|
||||
{
|
||||
return (long) ((x)/(m_logicalScaleX*m_userScaleX*m_signX*m_systemScaleX)) ;
|
||||
return (long) ((x)/(m_logicalScaleX*m_userScaleX*m_signX*m_systemScaleX)) ;
|
||||
}
|
||||
|
||||
long wxDC::DeviceToLogicalY(long y) const
|
||||
{
|
||||
return (long) (((y) - m_deviceOriginY)/(m_logicalScaleY*m_userScaleY*m_signY*m_systemScaleY) - m_logicalOriginY) ;
|
||||
return (long) (((y) - m_deviceOriginY)/(m_logicalScaleY*m_userScaleY*m_signY*m_systemScaleY) - m_logicalOriginY) ;
|
||||
}
|
||||
|
||||
long wxDC::DeviceToLogicalYRel(long y) const
|
||||
{
|
||||
return (long) ((y)/(m_logicalScaleY*m_userScaleY*m_signY*m_systemScaleY)) ;
|
||||
return (long) ((y)/(m_logicalScaleY*m_userScaleY*m_signY*m_systemScaleY)) ;
|
||||
}
|
||||
|
||||
long wxDC::LogicalToDeviceX(long x) const
|
||||
{
|
||||
return (long) (floor((x) - m_logicalOriginX)*m_logicalScaleX*m_userScaleX*m_signX*m_systemScaleX + m_deviceOriginX) ;
|
||||
return (long) (floor((x) - m_logicalOriginX)*m_logicalScaleX*m_userScaleX*m_signX*m_systemScaleX + m_deviceOriginX) ;
|
||||
}
|
||||
|
||||
long wxDC::LogicalToDeviceXRel(long x) const
|
||||
{
|
||||
return (long) (floor(x)*m_logicalScaleX*m_userScaleX*m_signX*m_systemScaleX) ;
|
||||
return (long) (floor(x)*m_logicalScaleX*m_userScaleX*m_signX*m_systemScaleX) ;
|
||||
}
|
||||
|
||||
long wxDC::LogicalToDeviceY(long y) const
|
||||
{
|
||||
return (long) (floor((y) - m_logicalOriginY)*m_logicalScaleY*m_userScaleY*m_signY*m_systemScaleY + m_deviceOriginY);
|
||||
return (long) (floor((y) - m_logicalOriginY)*m_logicalScaleY*m_userScaleY*m_signY*m_systemScaleY + m_deviceOriginY);
|
||||
}
|
||||
|
||||
long wxDC::LogicalToDeviceYRel(long y) const
|
||||
{
|
||||
return (long) (floor(y)*m_logicalScaleY*m_userScaleY*m_signY*m_systemScaleY) ;
|
||||
return (long) (floor(y)*m_logicalScaleY*m_userScaleY*m_signY*m_systemScaleY) ;
|
||||
}
|
||||
|
||||
// This group of functions may not do any conversion
|
||||
@ -1051,50 +1051,50 @@ long wxDC::LogicalToDeviceYRel(long y) const
|
||||
|
||||
long wxDC::ImplDeviceToLogicalX(long x) const
|
||||
{
|
||||
// return (m_scaleGDI ? x : DeviceToLogicalX(x));
|
||||
return x;
|
||||
// return (m_scaleGDI ? x : DeviceToLogicalX(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
long wxDC::ImplDeviceToLogicalY(long y) const
|
||||
{
|
||||
// return (m_scaleGDI ? y : DeviceToLogicalY(y));
|
||||
return y;
|
||||
// return (m_scaleGDI ? y : DeviceToLogicalY(y));
|
||||
return y;
|
||||
}
|
||||
|
||||
long wxDC::ImplDeviceToLogicalXRel(long x) const
|
||||
{
|
||||
// return (m_scaleGDI ? x : DeviceToLogicalXRel(x));
|
||||
return x;
|
||||
// return (m_scaleGDI ? x : DeviceToLogicalXRel(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
long wxDC::ImplDeviceToLogicalYRel(long y) const
|
||||
{
|
||||
// return (m_scaleGDI ? y : DeviceToLogicalYRel(y));
|
||||
return y;
|
||||
// return (m_scaleGDI ? y : DeviceToLogicalYRel(y));
|
||||
return y;
|
||||
}
|
||||
|
||||
long wxDC::ImplLogicalToDeviceX(long x) const
|
||||
{
|
||||
// return (m_scaleGDI ? (floor(double(x))) : LogicalToDeviceX(x));
|
||||
return x;
|
||||
// return (m_scaleGDI ? (floor(double(x))) : LogicalToDeviceX(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
long wxDC::ImplLogicalToDeviceY(long y) const
|
||||
{
|
||||
// return (m_scaleGDI ? (floor(double(y))) : LogicalToDeviceY(y));
|
||||
return y;
|
||||
// return (m_scaleGDI ? (floor(double(y))) : LogicalToDeviceY(y));
|
||||
return y;
|
||||
}
|
||||
|
||||
long wxDC::ImplLogicalToDeviceXRel(long x) const
|
||||
{
|
||||
// return (m_scaleGDI ? (floor(double(x))) : LogicalToDeviceXRel(x));
|
||||
return x;
|
||||
// return (m_scaleGDI ? (floor(double(x))) : LogicalToDeviceXRel(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
long wxDC::ImplLogicalToDeviceYRel(long y) const
|
||||
{
|
||||
// return (m_scaleGDI ? (floor(double(y))) : LogicalToDeviceYRel(y));
|
||||
return y;
|
||||
// return (m_scaleGDI ? (floor(double(y))) : LogicalToDeviceYRel(y));
|
||||
return y;
|
||||
}
|
||||
|
||||
bool wxDC::Blit(long xdest, long ydest, long width, long height,
|
||||
@ -1111,11 +1111,11 @@ bool wxDC::Blit(long xdest, long ydest, long width, long height,
|
||||
COLORREF old_background = ::GetBkColor((HDC)m_hDC);
|
||||
if (m_textForegroundColour.Ok())
|
||||
{
|
||||
::SetTextColor((HDC) m_hDC, m_textForegroundColour.GetPixel() ) ;
|
||||
::SetTextColor((HDC) m_hDC, m_textForegroundColour.GetPixel() ) ;
|
||||
}
|
||||
if (m_textBackgroundColour.Ok())
|
||||
{
|
||||
::SetBkColor((HDC) m_hDC, m_textBackgroundColour.GetPixel() ) ;
|
||||
::SetBkColor((HDC) m_hDC, m_textBackgroundColour.GetPixel() ) ;
|
||||
}
|
||||
|
||||
DWORD dwRop = rop == wxCOPY ? SRCCOPY :
|
||||
@ -1132,12 +1132,12 @@ bool wxDC::Blit(long xdest, long ydest, long width, long height,
|
||||
rop == wxSRC_AND ? SRCAND :
|
||||
SRCCOPY;
|
||||
|
||||
bool success;
|
||||
bool success = TRUE;
|
||||
if (useMask && source->m_selectedBitmap.Ok() && source->m_selectedBitmap.GetMask())
|
||||
{
|
||||
|
||||
#if 0 // __WIN32__
|
||||
// Not implemented under Win95 (or maybe a specific device?)
|
||||
// Not implemented under Win95 (or maybe a specific device?)
|
||||
if (MaskBlt((HDC) m_hDC, xdest1, ydest1, (int)width, (int)height,
|
||||
(HDC) source->m_hDC, xsrc1, ysrc1, (HBITMAP) source->m_selectedBitmap.GetMask()->GetMaskBitmap(),
|
||||
0, 0, 0xAACC0020))
|
||||
@ -1149,116 +1149,116 @@ bool wxDC::Blit(long xdest, long ydest, long width, long height,
|
||||
{
|
||||
// Old code
|
||||
#if 0
|
||||
HDC dc_mask = CreateCompatibleDC((HDC) source->m_hDC);
|
||||
::SelectObject(dc_mask, (HBITMAP) source->m_selectedBitmap.GetMask()->GetMaskBitmap());
|
||||
HDC dc_mask = CreateCompatibleDC((HDC) source->m_hDC);
|
||||
::SelectObject(dc_mask, (HBITMAP) source->m_selectedBitmap.GetMask()->GetMaskBitmap());
|
||||
success = (BitBlt((HDC) m_hDC, xdest1, ydest1, (int)width, (int)height,
|
||||
dc_mask, xsrc1, ysrc1, 0x00220326 /* NOTSRCAND */) != 0);
|
||||
dc_mask, xsrc1, ysrc1, 0x00220326 /* NOTSRCAND */) != 0);
|
||||
success = (BitBlt((HDC) m_hDC, xdest1, ydest1, (int)width, (int)height,
|
||||
(HDC) source->m_hDC, xsrc1, ysrc1, SRCPAINT) != 0);
|
||||
::SelectObject(dc_mask, 0);
|
||||
::DeleteDC(dc_mask);
|
||||
(HDC) source->m_hDC, xsrc1, ysrc1, SRCPAINT) != 0);
|
||||
::SelectObject(dc_mask, 0);
|
||||
::DeleteDC(dc_mask);
|
||||
#endif
|
||||
// New code from Chris Breeze, 15/7/98
|
||||
// Blit bitmap with mask
|
||||
// Blit bitmap with mask
|
||||
|
||||
if (IsKindOf(CLASSINFO(wxPrinterDC)))
|
||||
{
|
||||
// If we are printing source colours are screen colours
|
||||
// not printer colours and so we need copy the bitmap
|
||||
// pixel by pixel.
|
||||
RECT rect;
|
||||
HDC dc_mask = ::CreateCompatibleDC((HDC) source->m_hDC);
|
||||
HDC dc_src = (HDC) source->m_hDC;
|
||||
if (IsKindOf(CLASSINFO(wxPrinterDC)))
|
||||
{
|
||||
// If we are printing source colours are screen colours
|
||||
// not printer colours and so we need copy the bitmap
|
||||
// pixel by pixel.
|
||||
RECT rect;
|
||||
HDC dc_mask = ::CreateCompatibleDC((HDC) source->m_hDC);
|
||||
HDC dc_src = (HDC) source->m_hDC;
|
||||
|
||||
::SelectObject(dc_mask, (HBITMAP) source->m_selectedBitmap.GetMask()->GetMaskBitmap());
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
COLORREF cref = ::GetPixel(dc_mask, x, y);
|
||||
if (cref)
|
||||
{
|
||||
HBRUSH brush = ::CreateSolidBrush(::GetPixel(dc_src, x, y));
|
||||
rect.left = xdest1 + x; rect.right = rect.left + 1;
|
||||
rect.top = ydest1 + y; rect.bottom = rect.top + 1;
|
||||
::FillRect((HDC) m_hDC, &rect, brush);
|
||||
::DeleteObject(brush);
|
||||
}
|
||||
}
|
||||
}
|
||||
::SelectObject(dc_mask, 0);
|
||||
::DeleteDC(dc_mask);
|
||||
}
|
||||
else
|
||||
{
|
||||
// create a temp buffer bitmap and DCs to access it and the mask
|
||||
HDC dc_mask = ::CreateCompatibleDC((HDC) source->m_hDC);
|
||||
HDC dc_buffer = ::CreateCompatibleDC((HDC) m_hDC);
|
||||
HBITMAP buffer_bmap = ::CreateCompatibleBitmap((HDC) m_hDC, width, height);
|
||||
::SelectObject(dc_mask, (HBITMAP) source->m_selectedBitmap.GetMask()->GetMaskBitmap());
|
||||
::SelectObject(dc_buffer, buffer_bmap);
|
||||
::SelectObject(dc_mask, (HBITMAP) source->m_selectedBitmap.GetMask()->GetMaskBitmap());
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
COLORREF cref = ::GetPixel(dc_mask, x, y);
|
||||
if (cref)
|
||||
{
|
||||
HBRUSH brush = ::CreateSolidBrush(::GetPixel(dc_src, x, y));
|
||||
rect.left = xdest1 + x; rect.right = rect.left + 1;
|
||||
rect.top = ydest1 + y; rect.bottom = rect.top + 1;
|
||||
::FillRect((HDC) m_hDC, &rect, brush);
|
||||
::DeleteObject(brush);
|
||||
}
|
||||
}
|
||||
}
|
||||
::SelectObject(dc_mask, 0);
|
||||
::DeleteDC(dc_mask);
|
||||
}
|
||||
else
|
||||
{
|
||||
// create a temp buffer bitmap and DCs to access it and the mask
|
||||
HDC dc_mask = ::CreateCompatibleDC((HDC) source->m_hDC);
|
||||
HDC dc_buffer = ::CreateCompatibleDC((HDC) m_hDC);
|
||||
HBITMAP buffer_bmap = ::CreateCompatibleBitmap((HDC) m_hDC, width, height);
|
||||
::SelectObject(dc_mask, (HBITMAP) source->m_selectedBitmap.GetMask()->GetMaskBitmap());
|
||||
::SelectObject(dc_buffer, buffer_bmap);
|
||||
|
||||
// copy dest to buffer
|
||||
::BitBlt(dc_buffer, 0, 0, (int)width, (int)height,
|
||||
(HDC) m_hDC, xdest1, ydest1, SRCCOPY);
|
||||
// copy dest to buffer
|
||||
::BitBlt(dc_buffer, 0, 0, (int)width, (int)height,
|
||||
(HDC) m_hDC, xdest1, ydest1, SRCCOPY);
|
||||
|
||||
// copy src to buffer using selected raster op
|
||||
::BitBlt(dc_buffer, 0, 0, (int)width, (int)height,
|
||||
(HDC) source->m_hDC, xsrc1, ysrc1, dwRop);
|
||||
// copy src to buffer using selected raster op
|
||||
::BitBlt(dc_buffer, 0, 0, (int)width, (int)height,
|
||||
(HDC) source->m_hDC, xsrc1, ysrc1, dwRop);
|
||||
|
||||
// set masked area in buffer to BLACK (pixel value 0)
|
||||
COLORREF prevBkCol = ::SetBkColor((HDC) m_hDC, RGB(255, 255, 255));
|
||||
COLORREF prevCol = ::SetTextColor((HDC) m_hDC, RGB(0, 0, 0));
|
||||
::BitBlt(dc_buffer, 0, 0, (int)width, (int)height,
|
||||
dc_mask, xsrc1, ysrc1, SRCAND);
|
||||
// set masked area in buffer to BLACK (pixel value 0)
|
||||
COLORREF prevBkCol = ::SetBkColor((HDC) m_hDC, RGB(255, 255, 255));
|
||||
COLORREF prevCol = ::SetTextColor((HDC) m_hDC, RGB(0, 0, 0));
|
||||
::BitBlt(dc_buffer, 0, 0, (int)width, (int)height,
|
||||
dc_mask, xsrc1, ysrc1, SRCAND);
|
||||
|
||||
// set unmasked area in dest to BLACK
|
||||
::SetBkColor((HDC) m_hDC, RGB(0, 0, 0));
|
||||
::SetTextColor((HDC) m_hDC, RGB(255, 255, 255));
|
||||
::BitBlt((HDC) m_hDC, xdest1, ydest1, (int)width, (int)height,
|
||||
dc_mask, xsrc1, ysrc1, SRCAND);
|
||||
::SetBkColor((HDC) m_hDC, prevBkCol); // restore colours to original values
|
||||
::SetTextColor((HDC) m_hDC, prevCol);
|
||||
// set unmasked area in dest to BLACK
|
||||
::SetBkColor((HDC) m_hDC, RGB(0, 0, 0));
|
||||
::SetTextColor((HDC) m_hDC, RGB(255, 255, 255));
|
||||
::BitBlt((HDC) m_hDC, xdest1, ydest1, (int)width, (int)height,
|
||||
dc_mask, xsrc1, ysrc1, SRCAND);
|
||||
::SetBkColor((HDC) m_hDC, prevBkCol); // restore colours to original values
|
||||
::SetTextColor((HDC) m_hDC, prevCol);
|
||||
|
||||
// OR buffer to dest
|
||||
success = (::BitBlt((HDC) m_hDC, xdest1, ydest1, (int)width, (int)height,
|
||||
dc_buffer, 0, 0, SRCPAINT) != 0);
|
||||
// OR buffer to dest
|
||||
success = (::BitBlt((HDC) m_hDC, xdest1, ydest1, (int)width, (int)height,
|
||||
dc_buffer, 0, 0, SRCPAINT) != 0);
|
||||
|
||||
// tidy up temporary DCs and bitmap
|
||||
::SelectObject(dc_mask, 0);
|
||||
::DeleteDC(dc_mask);
|
||||
::SelectObject(dc_buffer, 0);
|
||||
::DeleteDC(dc_buffer);
|
||||
::DeleteObject(buffer_bmap);
|
||||
}
|
||||
}
|
||||
// tidy up temporary DCs and bitmap
|
||||
::SelectObject(dc_mask, 0);
|
||||
::DeleteDC(dc_mask);
|
||||
::SelectObject(dc_buffer, 0);
|
||||
::DeleteDC(dc_buffer);
|
||||
::DeleteObject(buffer_bmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsKindOf(CLASSINFO(wxPrinterDC)))
|
||||
{
|
||||
if (IsKindOf(CLASSINFO(wxPrinterDC)))
|
||||
{
|
||||
// If we are printing source colours are screen colours
|
||||
// not printer colours and so we need copy the bitmap
|
||||
// pixel by pixel.
|
||||
HDC dc_src = (HDC) source->m_hDC;
|
||||
RECT rect;
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
{
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
{
|
||||
HBRUSH brush = ::CreateSolidBrush(::GetPixel(dc_src, x, y));
|
||||
rect.left = xdest1 + x; rect.right = rect.left + 1;
|
||||
rect.top = ydest1 + y; rect.bottom = rect.top + 1;
|
||||
rect.left = xdest1 + x; rect.right = rect.left + 1;
|
||||
rect.top = ydest1 + y; rect.bottom = rect.top + 1;
|
||||
::FillRect((HDC) m_hDC, &rect, brush);
|
||||
::DeleteObject(brush);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
{
|
||||
success = (BitBlt((HDC) m_hDC, xdest1, ydest1, (int)width, (int)height, (HDC) source->m_hDC,
|
||||
xsrc1, ysrc1, dwRop) != 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
::SetTextColor((HDC)m_hDC, old_textground);
|
||||
::SetBkColor((HDC)m_hDC, old_background);
|
||||
@ -1356,8 +1356,8 @@ void wxDC::GetTextExtent(const wxString& string, float *x, float *y,
|
||||
wxFont *theFont, bool use16bit) const
|
||||
{
|
||||
long x1, y1, descent1, externalLeading1;
|
||||
GetTextExtent(string, & x1, & y1, & descent1, & externalLeading1, theFont, use16bit);
|
||||
*x = x1; *y = y1;
|
||||
GetTextExtent(string, & x1, & y1, & descent1, & externalLeading1, theFont, use16bit);
|
||||
*x = x1; *y = y1;
|
||||
if (descent)
|
||||
*descent = descent1;
|
||||
if (externalLeading)
|
||||
@ -1473,10 +1473,10 @@ void wx_draw_open_spline(wxDC *dc, wxSpline *spline)
|
||||
while ((node = node->Next()) != NULL)
|
||||
{
|
||||
p = (wxPoint *)node->Data();
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
x2 = p->x;
|
||||
y2 = p->y;
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
x2 = p->x;
|
||||
y2 = p->y;
|
||||
cx4 = (double)(x1 + x2) / 2;
|
||||
cy4 = (double)(y1 + y2) / 2;
|
||||
cx3 = (double)(x1 + cx4) / 2;
|
||||
@ -1484,8 +1484,8 @@ void wx_draw_open_spline(wxDC *dc, wxSpline *spline)
|
||||
|
||||
wx_quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4);
|
||||
|
||||
cx1 = cx4;
|
||||
cy1 = cy4;
|
||||
cx1 = cx4;
|
||||
cy1 = cy4;
|
||||
cx2 = (double)(cx1 + x2) / 2;
|
||||
cy2 = (double)(cy1 + y2) / 2;
|
||||
}
|
||||
@ -1499,23 +1499,23 @@ void wx_draw_open_spline(wxDC *dc, wxSpline *spline)
|
||||
|
||||
/********************* CURVES FOR SPLINES *****************************
|
||||
|
||||
The following spline drawing routine is from
|
||||
The following spline drawing routine is from
|
||||
|
||||
"An Algorithm for High-Speed Curve Generation"
|
||||
by George Merrill Chaikin,
|
||||
Computer Graphics and Image Processing, 3, Academic Press,
|
||||
1974, 346-349.
|
||||
"An Algorithm for High-Speed Curve Generation"
|
||||
by George Merrill Chaikin,
|
||||
Computer Graphics and Image Processing, 3, Academic Press,
|
||||
1974, 346-349.
|
||||
|
||||
and
|
||||
and
|
||||
|
||||
"On Chaikin's Algorithm" by R. F. Riesenfeld,
|
||||
Computer Graphics and Image Processing, 4, Academic Press,
|
||||
1975, 304-310.
|
||||
"On Chaikin's Algorithm" by R. F. Riesenfeld,
|
||||
Computer Graphics and Image Processing, 4, Academic Press,
|
||||
1975, 304-310.
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#define half(z1, z2) ((z1+z2)/2.0)
|
||||
#define THRESHOLD 5
|
||||
#define half(z1, z2) ((z1+z2)/2.0)
|
||||
#define THRESHOLD 5
|
||||
|
||||
/* iterative version */
|
||||
|
||||
@ -1531,16 +1531,16 @@ void wx_quadratic_spline(double a1, double b1, double a2, double b2, double a3,
|
||||
while (wx_spline_pop(&x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)) {
|
||||
xmid = (double)half(x2, x3);
|
||||
ymid = (double)half(y2, y3);
|
||||
if (fabs(x1 - xmid) < THRESHOLD && fabs(y1 - ymid) < THRESHOLD &&
|
||||
fabs(xmid - x4) < THRESHOLD && fabs(ymid - y4) < THRESHOLD) {
|
||||
if (fabs(x1 - xmid) < THRESHOLD && fabs(y1 - ymid) < THRESHOLD &&
|
||||
fabs(xmid - x4) < THRESHOLD && fabs(ymid - y4) < THRESHOLD) {
|
||||
wx_spline_add_point((double)wx_round(x1), (double)wx_round(y1));
|
||||
wx_spline_add_point((double)wx_round(xmid), (double)wx_round(ymid));
|
||||
} else {
|
||||
} else {
|
||||
wx_spline_push(xmid, ymid, (double)half(xmid, x3), (double)half(ymid, y3),
|
||||
(double)half(x3, x4), (double)half(y3, y4), x4, y4);
|
||||
wx_spline_push(x1, y1, (double)half(x1, x2), (double)half(y1, y2),
|
||||
(double)half(x2, xmid), (double)half(y2, ymid), xmid, ymid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1582,7 +1582,7 @@ int wx_spline_pop(double *x1, double *y1, double *x2, double *y2,
|
||||
double *x3, double *y3, double *x4, double *y4)
|
||||
{
|
||||
if (wx_stack_count == 0)
|
||||
return (0);
|
||||
return (0);
|
||||
wx_stack_top--;
|
||||
wx_stack_count--;
|
||||
*x1 = wx_stack_top->x1;
|
||||
|
@ -473,7 +473,8 @@ BOOL ReadDIB(LPSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette)
|
||||
goto ErrExit;
|
||||
}
|
||||
|
||||
if (!(nNumColors = (WORD)lpbi->biClrUsed))
|
||||
nNumColors = (WORD)lpbi->biClrUsed;
|
||||
if ( nNumColors == 0 )
|
||||
{
|
||||
/* no color table for 24-bit, default size otherwise */
|
||||
if (lpbi->biBitCount != 24)
|
||||
@ -594,7 +595,8 @@ BOOL PASCAL MakeBitmapAndPalette(HDC hDC, HANDLE hDIB,
|
||||
lpInfo = (LPBITMAPINFOHEADER) GlobalLock(hDIB);
|
||||
#endif
|
||||
|
||||
if ((hPalette = MakeDIBPalette(lpInfo)))
|
||||
hPalette = MakeDIBPalette(lpInfo);
|
||||
if ( hPalette )
|
||||
{
|
||||
// Need to realize palette for converting DIB to bitmap.
|
||||
hOldPal = SelectPalette(hDC, hPalette, TRUE);
|
||||
|
@ -271,7 +271,8 @@ int wxFileDialog::ShowModal(void)
|
||||
extension = extension + strlen( extension ) +1;
|
||||
}
|
||||
|
||||
if ( (extension = strrchr( extension, '.' )) // != "blabla"
|
||||
extension = strrchr( extension, '.' );
|
||||
if ( extension // != "blabla"
|
||||
&& !strrchr( extension, '*' ) // != "blabla.*"
|
||||
&& !strrchr( extension, '?' ) // != "blabla.?"
|
||||
&& extension[1] // != "blabla."
|
||||
|
@ -626,9 +626,9 @@ bool wxFrame::MSWOnPaint(void)
|
||||
if (m_iconized)
|
||||
{
|
||||
HICON the_icon;
|
||||
if (m_icon.Ok())
|
||||
the_icon = (HICON) m_icon.GetHICON();
|
||||
if (the_icon == 0)
|
||||
if (m_icon.Ok())
|
||||
the_icon = (HICON) m_icon.GetHICON();
|
||||
else
|
||||
the_icon = (HICON) m_defaultIcon;
|
||||
|
||||
PAINTSTRUCT ps;
|
||||
@ -1037,7 +1037,6 @@ void wxFrame::PositionToolBar(void)
|
||||
// propagate our state change to all child frames
|
||||
void wxFrame::IconizeChildFrames(bool bIconize)
|
||||
{
|
||||
wxWindow *child = NULL;
|
||||
for ( wxNode *node = GetChildren()->First(); node; node = node->Next() ) {
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
if ( win->IsKindOf(CLASSINFO(wxFrame)) ) {
|
||||
|
@ -1111,22 +1111,31 @@ bool wxListCtrl::MSWCommand(WXUINT cmd, WXWORD id)
|
||||
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);
|
||||
wxEventType eventType = wxEVT_NULL;
|
||||
NMHDR *hdr1 = (NMHDR *) lParam;
|
||||
switch ( hdr1->code )
|
||||
{
|
||||
case LVN_BEGINRDRAG:
|
||||
eventType = wxEVT_COMMAND_LIST_BEGIN_RDRAG;
|
||||
// fall through
|
||||
|
||||
case LVN_BEGINDRAG:
|
||||
{
|
||||
eventType = wxEVT_COMMAND_LIST_BEGIN_DRAG;
|
||||
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;
|
||||
}
|
||||
if ( eventType == wxEVT_NULL )
|
||||
{
|
||||
eventType = wxEVT_COMMAND_LIST_BEGIN_DRAG;
|
||||
}
|
||||
|
||||
{
|
||||
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_BEGINLABELEDIT:
|
||||
{
|
||||
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());
|
||||
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:
|
||||
{
|
||||
eventType = wxEVT_COMMAND_LIST_COL_CLICK;
|
||||
@ -1228,8 +1229,7 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||
}
|
||||
|
||||
default :
|
||||
return wxControl::MSWNotify(wParam, lParam);
|
||||
break;
|
||||
return wxControl::MSWNotify(wParam, lParam, result);
|
||||
}
|
||||
|
||||
event.SetEventObject( this );
|
||||
@ -1252,7 +1252,9 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||
// wxConvertToMSWListItem(this, event.m_item, info->item);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
*result = !event.IsAllowed();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char *wxListCtrl::AddPool(const wxString& str)
|
||||
@ -1430,8 +1432,8 @@ static void wxConvertToMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_
|
||||
// List event
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxCommandEvent)
|
||||
|
||||
wxListEvent::wxListEvent(wxEventType commandType, int id):
|
||||
wxCommandEvent(commandType, id)
|
||||
wxListEvent::wxListEvent(wxEventType commandType, int id)
|
||||
: wxNotifyEvent(commandType, id)
|
||||
{
|
||||
m_code = 0;
|
||||
m_itemIndex = 0;
|
||||
|
@ -595,8 +595,6 @@ long wxMDIParentFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARA
|
||||
|
||||
bool wxMDIParentFrame::MSWProcessMessage(WXMSG* msg)
|
||||
{
|
||||
MSG *pMsg = (MSG *)msg;
|
||||
|
||||
if ((m_currentChild != (wxWindow *)NULL) && (m_currentChild->GetHWND() != (WXHWND) NULL) && m_currentChild->MSWProcessMessage(msg))
|
||||
return TRUE;
|
||||
|
||||
|
@ -231,10 +231,10 @@ void wxMenu::Append(int Id, const wxString& label,
|
||||
void wxMenu::Delete(int id)
|
||||
{
|
||||
wxNode *node;
|
||||
wxMenuItem *item;
|
||||
int pos;
|
||||
HMENU menu;
|
||||
|
||||
wxMenuItem *item = NULL;
|
||||
for (pos = 0, node = m_menuItems.First(); node; node = node->Next(), pos++) {
|
||||
item = (wxMenuItem *)node->Data();
|
||||
if (item->GetId() == id)
|
||||
@ -310,9 +310,9 @@ void wxMenu::SetTitle(const wxString& label)
|
||||
{
|
||||
if ( !label.IsEmpty() )
|
||||
{
|
||||
if ( !InsertMenu(hMenu, 0, MF_BYPOSITION | MF_STRING,
|
||||
idMenuTitle, m_title) ||
|
||||
!InsertMenu(hMenu, 1, MF_BYPOSITION, -1, NULL) )
|
||||
if ( !InsertMenu(hMenu, 0u, MF_BYPOSITION | MF_STRING,
|
||||
(unsigned)idMenuTitle, m_title) ||
|
||||
!InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, NULL) )
|
||||
{
|
||||
wxLogLastError("InsertMenu");
|
||||
}
|
||||
@ -332,9 +332,9 @@ void wxMenu::SetTitle(const wxString& label)
|
||||
else
|
||||
{
|
||||
// modify the title
|
||||
if ( !ModifyMenu(hMenu, 0,
|
||||
if ( !ModifyMenu(hMenu, 0u,
|
||||
MF_BYPOSITION | MF_STRING,
|
||||
idMenuTitle, m_title) )
|
||||
(unsigned)idMenuTitle, m_title) )
|
||||
{
|
||||
wxLogLastError("ModifyMenu");
|
||||
}
|
||||
@ -667,7 +667,7 @@ bool wxMenuBar::Checked(int Id) const
|
||||
if (!item)
|
||||
return FALSE;
|
||||
|
||||
int Flag ;
|
||||
int Flag = 0;
|
||||
|
||||
if (itemMenu->m_hMenu)
|
||||
Flag=GetMenuState((HMENU)itemMenu->m_hMenu, Id, MF_BYCOMMAND) ;
|
||||
@ -892,8 +892,11 @@ wxMenuItem *wxMenuBar::FindItemForId (int Id, wxMenu ** itemMenu) const
|
||||
wxMenuItem *item = NULL;
|
||||
int 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 NULL;
|
||||
}
|
||||
|
||||
|
@ -376,12 +376,19 @@ LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lPa
|
||||
cx = GetSystemMetrics( SM_CXFRAME ) ;
|
||||
cy = GetSystemMetrics( SM_CYFRAME ) ;
|
||||
}
|
||||
else if (TestWinStyle(hWnd, WS_BORDER ))
|
||||
{
|
||||
cx = GetSystemMetrics( SM_CXBORDER ) ;
|
||||
cy = GetSystemMetrics( SM_CYBORDER ) ;
|
||||
}
|
||||
else
|
||||
if (TestWinStyle(hWnd, WS_BORDER ))
|
||||
{
|
||||
cx = GetSystemMetrics( SM_CXBORDER ) ;
|
||||
cy = GetSystemMetrics( SM_CYBORDER ) ;
|
||||
}
|
||||
{
|
||||
// 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 ) ;
|
||||
GetMinButtonRect( hWnd, &rcMin ) ;
|
||||
@ -865,7 +872,8 @@ BOOL PASCAL DrawCaption( HDC hDC, HWND hWnd, LPRECT lprc,
|
||||
int cy ;
|
||||
SIZE Size ;
|
||||
|
||||
if ((lpsz = (char*)GlobalAllocPtr( GHND, ui + 2 )))
|
||||
lpsz = (char*)GlobalAllocPtr( GHND, ui + 2 );
|
||||
if (lpsz)
|
||||
{
|
||||
UINT nBkMode ;
|
||||
|
||||
@ -1074,7 +1082,8 @@ BOOL PASCAL DoMenu( HWND hWnd )
|
||||
if (!TestWinStyle(hWnd, WS_SYSMENU))
|
||||
return FALSE ;
|
||||
|
||||
if ((hDC = GetWindowDC( hWnd )))
|
||||
hDC = GetWindowDC( hWnd );
|
||||
if (hDC)
|
||||
{
|
||||
// Invert the icon
|
||||
//
|
||||
|
@ -437,7 +437,7 @@ void wxNotebook::Command(wxCommandEvent& event)
|
||||
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);
|
||||
|
||||
@ -451,21 +451,18 @@ bool wxNotebook::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||
event.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING);
|
||||
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 :
|
||||
return wxControl::MSWNotify(wParam, lParam);
|
||||
default:
|
||||
return wxControl::MSWNotify(wParam, lParam, result);
|
||||
}
|
||||
|
||||
event.SetSelection(TabCtrl_GetCurSel(m_hwnd));
|
||||
event.SetOldSelection(m_nSelection);
|
||||
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
|
||||
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)
|
||||
// and it may happen - just do nothing
|
||||
if ( nSel == nOldSel )
|
||||
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 )
|
||||
m_aPages[nOldSel]->Show(FALSE);
|
||||
|
||||
@ -487,7 +505,11 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
|
||||
pPage->Show(TRUE);
|
||||
pPage->SetFocus();
|
||||
|
||||
event.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED);
|
||||
ProcessEvent(event);
|
||||
|
||||
m_nSelection = nSel;
|
||||
s_bInsideChangePage = FALSE;
|
||||
}
|
||||
|
||||
void wxNotebook::OnEraseBackground(wxEraseEvent& event)
|
||||
|
@ -358,6 +358,11 @@ wxDataObject::~wxDataObject()
|
||||
const char *wxDataObject::GetFormatName(wxDataFormat format)
|
||||
{
|
||||
#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];
|
||||
switch ( format ) {
|
||||
case CF_TEXT: return "CF_TEXT";
|
||||
@ -380,9 +385,14 @@ const char *wxDataObject::GetFormatName(wxDataFormat format)
|
||||
sprintf(s_szBuf, "clipboard format %d (unknown)", format);
|
||||
return s_szBuf;
|
||||
}
|
||||
#else
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default:4063)
|
||||
#endif // VC++
|
||||
|
||||
#else // !Debug
|
||||
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
|
||||
|
||||
// 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
|
||||
char **aszFiles = new char *[nFiles];
|
||||
|
@ -144,7 +144,7 @@ wxRegKey::StdKey wxRegKey::ExtractKeyName(wxString& strKey)
|
||||
{
|
||||
wxString strRoot = strKey.Left(REG_SEPARATOR);
|
||||
|
||||
HKEY hRootKey;
|
||||
HKEY hRootKey = 0;
|
||||
size_t ui;
|
||||
for ( ui = 0; ui < nStdKeys; ui++ ) {
|
||||
if ( strRoot.CmpNoCase(aStdKeys[ui].szName) == 0 ||
|
||||
|
@ -233,19 +233,16 @@ bool wxSpinButton::MSWCommand(WXUINT cmd, WXWORD id)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxSpinButton::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||
bool wxSpinButton::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM* result)
|
||||
{
|
||||
NMHDR* hdr1 = (NMHDR*) lParam;
|
||||
switch ( hdr1->code )
|
||||
{
|
||||
/* We don't process this message, currently */
|
||||
/* We don't process this message, currently */
|
||||
case UDN_DELTAPOS:
|
||||
{
|
||||
return wxControl::MSWNotify(wParam, lParam);
|
||||
break;
|
||||
}
|
||||
|
||||
default :
|
||||
return wxControl::MSWNotify(wParam, lParam);
|
||||
return wxControl::MSWNotify(wParam, lParam, result);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
|
@ -6,7 +6,7 @@
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
@ -50,9 +50,9 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
|
||||
m_foregroundColour = parent->GetForegroundColour() ;
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
m_windowId = id;
|
||||
|
||||
int x = pos.x;
|
||||
int y = pos.y;
|
||||
@ -60,9 +60,9 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
|
||||
int height = size.y;
|
||||
|
||||
if ( width < 0 && bitmap.Ok() )
|
||||
width = bitmap.GetWidth();
|
||||
width = bitmap.GetWidth();
|
||||
if ( height < 0 && bitmap.Ok() )
|
||||
height = bitmap.GetHeight();
|
||||
height = bitmap.GetHeight();
|
||||
|
||||
m_windowStyle = style;
|
||||
|
||||
@ -135,7 +135,7 @@ void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
|
||||
rect.left = x; rect.top = y; rect.right = x + w; rect.bottom = y + h;
|
||||
|
||||
if ( bitmap.Ok() )
|
||||
MoveWindow((HWND) GetHWND(), x, y, bitmap.GetWidth(), bitmap.GetHeight(),
|
||||
MoveWindow((HWND) GetHWND(), x, y, bitmap.GetWidth(), bitmap.GetHeight(),
|
||||
FALSE);
|
||||
|
||||
InvalidateRect((HWND) GetParent()->GetHWND(), &rect, TRUE);
|
||||
@ -143,45 +143,45 @@ void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
|
||||
|
||||
bool wxStaticBitmap::MSWOnDraw(WXDRAWITEMSTRUCT *item)
|
||||
{
|
||||
long style = GetWindowLong((HWND) GetHWND(), GWL_STYLE);
|
||||
long style = GetWindowLong((HWND) GetHWND(), GWL_STYLE);
|
||||
#ifdef __WIN32__
|
||||
if ((style & 0xFF) == SS_BITMAP)
|
||||
{
|
||||
// Should we call Default() here?
|
||||
// Default();
|
||||
if ((style & 0xFF) == SS_BITMAP)
|
||||
{
|
||||
// Should we call Default() here?
|
||||
// Default();
|
||||
|
||||
// Let default procedure draw the bitmap, which is defined
|
||||
// in the Windows resource.
|
||||
return FALSE;
|
||||
}
|
||||
// Let default procedure draw the bitmap, which is defined
|
||||
// in the Windows resource.
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT) item;
|
||||
|
||||
wxBitmap* bitmap = &m_messageBitmap;
|
||||
if ( !bitmap->Ok() )
|
||||
return FALSE;
|
||||
wxBitmap* bitmap = &m_messageBitmap;
|
||||
if ( !bitmap->Ok() )
|
||||
return FALSE;
|
||||
|
||||
HDC hDC = lpDIS->hDC;
|
||||
HDC memDC = ::CreateCompatibleDC(hDC);
|
||||
HDC hDC = lpDIS->hDC;
|
||||
HDC memDC = ::CreateCompatibleDC(hDC);
|
||||
|
||||
HBITMAP old = (HBITMAP) ::SelectObject(memDC, (HBITMAP) bitmap->GetHBITMAP());
|
||||
HBITMAP old = (HBITMAP) ::SelectObject(memDC, (HBITMAP) bitmap->GetHBITMAP());
|
||||
|
||||
if (!old)
|
||||
return FALSE;
|
||||
if (!old)
|
||||
return FALSE;
|
||||
|
||||
int x = lpDIS->rcItem.left;
|
||||
int y = lpDIS->rcItem.top;
|
||||
int width = lpDIS->rcItem.right - x;
|
||||
int height = lpDIS->rcItem.bottom - y;
|
||||
|
||||
// Centre the bitmap in the control area
|
||||
int x1 = (int) (x + ((width - bitmap->GetWidth()) / 2));
|
||||
int y1 = (int) (y + ((height - bitmap->GetHeight()) / 2));
|
||||
// Centre the bitmap in the control area
|
||||
int x1 = (int) (x + ((width - bitmap->GetWidth()) / 2));
|
||||
int y1 = (int) (y + ((height - bitmap->GetHeight()) / 2));
|
||||
|
||||
::BitBlt(hDC, x1, y1, bitmap->GetWidth(), bitmap->GetHeight(), memDC, 0, 0, SRCCOPY);
|
||||
::BitBlt(hDC, x1, y1, bitmap->GetWidth(), bitmap->GetHeight(), memDC, 0, 0, SRCCOPY);
|
||||
|
||||
::SelectObject(memDC, old);
|
||||
::SelectObject(memDC, old);
|
||||
|
||||
::DeleteDC(memDC);
|
||||
|
||||
|
@ -146,7 +146,7 @@ bool wxTabCtrl::MSWCommand(WXUINT cmd, WXWORD id)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxTabCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||
bool wxTabCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
|
||||
{
|
||||
wxTabEvent event(wxEVT_NULL, m_windowId);
|
||||
wxEventType eventType = wxEVT_NULL;
|
||||
@ -154,37 +154,29 @@ bool wxTabCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||
switch ( hdr1->code )
|
||||
{
|
||||
case TCN_SELCHANGE:
|
||||
{
|
||||
eventType = wxEVT_COMMAND_TAB_SEL_CHANGED;
|
||||
event.SetInt( (int) LOWORD(wParam) ) ;
|
||||
break;
|
||||
}
|
||||
|
||||
case TCN_SELCHANGING:
|
||||
{
|
||||
eventType = wxEVT_COMMAND_TAB_SEL_CHANGING;
|
||||
event.SetInt( (int) LOWORD(wParam) ) ;
|
||||
break;
|
||||
}
|
||||
|
||||
case TTN_NEEDTEXT:
|
||||
{
|
||||
// TODO
|
||||
// if (tool->m_shortHelpString != "")
|
||||
// ttText->lpszText = (char *) (const char *)tool->m_shortHelpString;
|
||||
return wxControl::MSWNotify(wParam, lParam);
|
||||
break;
|
||||
}
|
||||
|
||||
default :
|
||||
return wxControl::MSWNotify(wParam, lParam);
|
||||
break;
|
||||
return wxControl::MSWNotify(wParam, lParam, result);
|
||||
}
|
||||
|
||||
event.SetEventObject( this );
|
||||
event.SetEventType(eventType);
|
||||
event.SetInt( (int) LOWORD(wParam) ) ;
|
||||
|
||||
if ( !ProcessEvent(event) )
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
return ProcessEvent(event);
|
||||
}
|
||||
|
||||
// Responds to colour changes, and passes event on to children.
|
||||
|
@ -325,7 +325,9 @@ bool wxToolBar95::MSWCommand(WXUINT cmd, WXWORD id)
|
||||
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
|
||||
NMHDR *hdr = (NMHDR *)lParam;
|
||||
|
@ -490,12 +490,18 @@ wxTreeItemId wxTreeCtrl::DoInsertItem(const wxTreeItemId& parent,
|
||||
|
||||
tvIns.item.mask = mask;
|
||||
|
||||
HTREEITEM id = (HTREEITEM) TreeView_InsertItem(wxhWnd, &tvIns);
|
||||
HTREEITEM id = TreeView_InsertItem(wxhWnd, &tvIns);
|
||||
if ( id == 0 )
|
||||
{
|
||||
wxLogLastError("TreeView_InsertItem");
|
||||
}
|
||||
|
||||
if ( data != NULL )
|
||||
{
|
||||
// associate the application tree item with Win32 tree item handle
|
||||
data->SetId((WXHTREEITEM)id);
|
||||
}
|
||||
|
||||
return wxTreeItemId((WXHTREEITEM)id);
|
||||
}
|
||||
|
||||
@ -763,7 +769,7 @@ bool wxTreeCtrl::MSWCommand(WXUINT cmd, WXWORD id)
|
||||
}
|
||||
|
||||
// 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);
|
||||
wxEventType eventType = wxEVT_NULL;
|
||||
@ -889,36 +895,28 @@ bool wxTreeCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||
}
|
||||
|
||||
default:
|
||||
return wxControl::MSWNotify(wParam, lParam);
|
||||
return wxControl::MSWNotify(wParam, lParam, result);
|
||||
}
|
||||
|
||||
event.SetEventObject(this);
|
||||
event.SetEventType(eventType);
|
||||
|
||||
bool rc = GetEventHandler()->ProcessEvent(event);
|
||||
bool processed = GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
// post processing
|
||||
switch ( hdr->code )
|
||||
if ( hdr->code == TVN_DELETEITEM )
|
||||
{
|
||||
// NB: we might process this message using wxWindows event tables, but
|
||||
// due to overhead of wxWin event system we prefer to do it here
|
||||
// (otherwise deleting a tree with many items is just too slow)
|
||||
case TVN_DELETEITEM:
|
||||
{
|
||||
NM_TREEVIEW* tv = (NM_TREEVIEW *)lParam;
|
||||
wxTreeItemData *data = (wxTreeItemData *)tv->itemOld.lParam;
|
||||
delete data; // may be NULL, ok
|
||||
}
|
||||
break;
|
||||
|
||||
case TVN_ITEMEXPANDING:
|
||||
// if user called Veto(), don't allow expansion/collapse by
|
||||
// returning TRUE from here
|
||||
rc = event.m_code != 0;
|
||||
break;
|
||||
NM_TREEVIEW* tv = (NM_TREEVIEW *)lParam;
|
||||
wxTreeItemData *data = (wxTreeItemData *)tv->itemOld.lParam;
|
||||
delete data; // may be NULL, ok
|
||||
}
|
||||
|
||||
return rc;
|
||||
*result = !event.IsAllowed();
|
||||
|
||||
return processed;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -928,7 +926,7 @@ bool wxTreeCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxCommandEvent)
|
||||
|
||||
wxTreeEvent::wxTreeEvent(wxEventType commandType, int id)
|
||||
: wxCommandEvent(commandType, id)
|
||||
: wxNotifyEvent(commandType, id)
|
||||
{
|
||||
m_code = 0;
|
||||
m_itemOld = 0;
|
||||
|
@ -174,7 +174,9 @@ bool wxWindow::MSWCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id))
|
||||
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;
|
||||
}
|
||||
@ -193,8 +195,11 @@ void wxWindow::SetHWND(WXHWND hWnd)
|
||||
m_hWnd = hWnd;
|
||||
}
|
||||
|
||||
// Constructor
|
||||
wxWindow::wxWindow(void)
|
||||
// ----------------------------------------------------------------------------
|
||||
// constructors and such
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxWindow::Init()
|
||||
{
|
||||
// Generic
|
||||
m_windowId = 0;
|
||||
@ -202,7 +207,6 @@ wxWindow::wxWindow(void)
|
||||
m_windowStyle = 0;
|
||||
m_windowParent = NULL;
|
||||
m_windowEventHandler = this;
|
||||
m_windowName = "";
|
||||
m_windowCursor = *wxSTANDARD_CURSOR;
|
||||
m_children = new wxList;
|
||||
m_doubleClickAllowed = 0 ;
|
||||
@ -217,41 +221,35 @@ wxWindow::wxWindow(void)
|
||||
// MSW-specific
|
||||
m_hWnd = 0;
|
||||
m_winEnabled = TRUE;
|
||||
m_caretWidth = 0; m_caretHeight = 0;
|
||||
m_caretEnabled = FALSE;
|
||||
m_caretWidth = m_caretHeight = 0;
|
||||
m_caretEnabled =
|
||||
m_caretShown = FALSE;
|
||||
m_inOnSize = FALSE;
|
||||
m_minSizeX = -1;
|
||||
m_minSizeY = -1;
|
||||
m_maxSizeX = -1;
|
||||
m_minSizeX =
|
||||
m_minSizeY =
|
||||
m_maxSizeX =
|
||||
m_maxSizeY = -1;
|
||||
// m_paintHDC = 0;
|
||||
// m_tempHDC = 0;
|
||||
|
||||
m_isBeingDeleted = FALSE;
|
||||
m_oldWndProc = 0;
|
||||
#ifndef __WIN32__
|
||||
m_globalHandle = 0;
|
||||
#endif
|
||||
m_useCtl3D = FALSE;
|
||||
m_mouseInWindow = FALSE;
|
||||
|
||||
m_windowParent = NULL;
|
||||
m_defaultItem = NULL;
|
||||
|
||||
wxSystemSettings settings;
|
||||
|
||||
m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_3DFACE) ;
|
||||
// m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_WINDOW) ; ;
|
||||
m_foregroundColour = *wxBLACK;
|
||||
|
||||
/*
|
||||
wxColour(GetRValue(GetSysColor(COLOR_WINDOW)),
|
||||
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
|
||||
*/
|
||||
|
||||
// wxWnd
|
||||
m_lastMsg = 0;
|
||||
m_lastWParam = 0;
|
||||
m_lastLParam = 0;
|
||||
// m_acceleratorTable = 0;
|
||||
m_hMenu = 0;
|
||||
|
||||
m_xThumbSize = 0;
|
||||
@ -268,8 +266,13 @@ wxWindow::wxWindow(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
wxWindow::wxWindow()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
// Destructor
|
||||
wxWindow::~wxWindow(void)
|
||||
wxWindow::~wxWindow()
|
||||
{
|
||||
m_isBeingDeleted = TRUE;
|
||||
|
||||
@ -346,7 +349,7 @@ wxWindow::~wxWindow(void)
|
||||
}
|
||||
|
||||
// Destroy the window (delayed, if a managed window)
|
||||
bool wxWindow::Destroy(void)
|
||||
bool wxWindow::Destroy()
|
||||
{
|
||||
delete this;
|
||||
return TRUE;
|
||||
@ -354,72 +357,18 @@ bool wxWindow::Destroy(void)
|
||||
|
||||
extern char wxCanvasClassName[];
|
||||
|
||||
// Constructor
|
||||
// real construction (Init() must have been called before!)
|
||||
bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
// Generic
|
||||
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
|
||||
Init();
|
||||
|
||||
// MSW-specific
|
||||
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;
|
||||
wxCHECK_MSG( parent, FALSE, "can't create wxWindow without parent" );
|
||||
|
||||
if (parent) 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;
|
||||
parent->AddChild(this);
|
||||
|
||||
SetName(name);
|
||||
|
||||
@ -441,10 +390,6 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
wxSystemSettings settings;
|
||||
|
||||
m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_WINDOW) ; ;
|
||||
// m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_3DFACE) ;
|
||||
m_foregroundColour = *wxBLACK;
|
||||
|
||||
m_windowStyle = style;
|
||||
|
||||
DWORD msflags = 0;
|
||||
@ -466,15 +411,13 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
||||
(m_windowStyle & wxSUNKEN_BORDER) || (m_windowStyle & wxDOUBLE_BORDER))
|
||||
msflags |= WS_BORDER;
|
||||
|
||||
m_mouseInWindow = FALSE ;
|
||||
|
||||
MSWCreate(m_windowId, parent, wxCanvasClassName, this, NULL,
|
||||
x, y, width, height, msflags, NULL, exStyle);
|
||||
x, y, width, height, msflags, NULL, exStyle);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxWindow::SetFocus(void)
|
||||
void wxWindow::SetFocus()
|
||||
{
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
if (hWnd)
|
||||
@ -489,7 +432,7 @@ void wxWindow::Enable(bool enable)
|
||||
::EnableWindow(hWnd, (BOOL)enable);
|
||||
}
|
||||
|
||||
void wxWindow::CaptureMouse(void)
|
||||
void wxWindow::CaptureMouse()
|
||||
{
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
if (hWnd && !m_winCaptured)
|
||||
@ -499,7 +442,7 @@ void wxWindow::CaptureMouse(void)
|
||||
}
|
||||
}
|
||||
|
||||
void wxWindow::ReleaseMouse(void)
|
||||
void wxWindow::ReleaseMouse()
|
||||
{
|
||||
if (m_winCaptured)
|
||||
{
|
||||
@ -814,7 +757,8 @@ void wxWindow::GetTextExtent(const wxString& string, int *x, int *y,
|
||||
HFONT was = 0;
|
||||
if (fontToUse && fontToUse->Ok())
|
||||
{
|
||||
if ((fnt=(HFONT) fontToUse->GetResourceHandle()))
|
||||
fnt = (HFONT)fontToUse->GetResourceHandle();
|
||||
if ( fnt )
|
||||
was = (HFONT) SelectObject(dc,fnt) ;
|
||||
}
|
||||
|
||||
@ -996,10 +940,11 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
}
|
||||
case WM_QUERYDRAGICON:
|
||||
{
|
||||
HICON hIcon = 0;
|
||||
if ((hIcon = (HICON) MSWOnQueryDragIcon()))
|
||||
HICON hIcon = (HICON)MSWOnQueryDragIcon();
|
||||
if ( hIcon )
|
||||
return (long)hIcon;
|
||||
else return MSWDefWindowProc(message, wParam, lParam );
|
||||
else
|
||||
return MSWDefWindowProc(message, wParam, lParam );
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1181,9 +1126,10 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
#if defined(__WIN95__)
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
if (!MSWOnNotify(wParam, lParam))
|
||||
return MSWDefWindowProc(message, wParam, lParam );
|
||||
break;
|
||||
// for some messages (TVN_ITEMEXPANDING for example), the return
|
||||
// value of WM_NOTIFY handler is important, so don't just return 0
|
||||
// if we processed the message
|
||||
return MSWOnNotify(wParam, lParam);
|
||||
}
|
||||
#endif
|
||||
case WM_MENUSELECT:
|
||||
@ -1475,7 +1421,7 @@ void wxRemoveHandleAssociation(wxWindow *win)
|
||||
|
||||
// Default destroyer - override if you destroy it in some other way
|
||||
// (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;
|
||||
}
|
||||
@ -1604,7 +1550,7 @@ bool wxWindow::MSWOnEndSession(bool endSession, long logOff)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxWindow::MSWOnDestroy(void)
|
||||
bool wxWindow::MSWOnDestroy()
|
||||
{
|
||||
// delete our drop target if we've got one
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
@ -1621,7 +1567,7 @@ bool wxWindow::MSWOnDestroy(void)
|
||||
|
||||
// Deal with child commands from buttons etc.
|
||||
|
||||
bool wxWindow::MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||
long wxWindow::MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
#if defined(__WIN95__)
|
||||
// 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;
|
||||
wxWindow *win = wxFindWinFromHandle((WXHWND) hWnd);
|
||||
|
||||
WXLPARAM result = 0;
|
||||
|
||||
if ( win )
|
||||
return win->MSWNotify(wParam, lParam);
|
||||
{
|
||||
win->MSWNotify(wParam, lParam, &result);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Rely on MSWNotify to check whether the message
|
||||
@ -1650,15 +1600,15 @@ bool wxWindow::MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow *)node->Data();
|
||||
if ( child->MSWNotify(wParam, lParam) )
|
||||
return TRUE;
|
||||
if ( child->MSWNotify(wParam, lParam, &result) )
|
||||
break;
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return result;
|
||||
#endif // Win95
|
||||
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1926,34 +1876,32 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
|
||||
lDlgCode = ::SendMessage(msg->hwnd, WM_GETDLGCODE, 0, 0);
|
||||
}
|
||||
|
||||
bool bForward;
|
||||
bool bForward = TRUE;
|
||||
if ( bProcess ) {
|
||||
switch ( msg->wParam ) {
|
||||
case VK_TAB:
|
||||
if ( lDlgCode & DLGC_WANTTAB ) // this is FALSE for Ctrl-Tab
|
||||
bProcess = FALSE;
|
||||
else
|
||||
bForward = !(::GetKeyState(VK_SHIFT) & 0x100);
|
||||
break;
|
||||
case VK_TAB:
|
||||
if ( lDlgCode & DLGC_WANTTAB ) // FALSE for Ctrl-Tab
|
||||
bProcess = FALSE;
|
||||
else
|
||||
bForward = !(::GetKeyState(VK_SHIFT) & 0x100);
|
||||
break;
|
||||
|
||||
case VK_UP:
|
||||
case VK_LEFT:
|
||||
if ( (lDlgCode & DLGC_WANTARROWS) || bCtrlDown )
|
||||
bProcess = FALSE;
|
||||
else
|
||||
bForward = FALSE;
|
||||
break;
|
||||
case VK_UP:
|
||||
case VK_LEFT:
|
||||
if ( (lDlgCode & DLGC_WANTARROWS) || bCtrlDown )
|
||||
bProcess = FALSE;
|
||||
else
|
||||
bForward = FALSE;
|
||||
break;
|
||||
|
||||
case VK_DOWN:
|
||||
case VK_RIGHT:
|
||||
if ( (lDlgCode & DLGC_WANTARROWS) || bCtrlDown )
|
||||
bProcess = FALSE;
|
||||
else
|
||||
bForward = TRUE;
|
||||
break;
|
||||
case VK_DOWN:
|
||||
case VK_RIGHT:
|
||||
if ( (lDlgCode & DLGC_WANTARROWS) || bCtrlDown )
|
||||
bProcess = FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
bProcess = FALSE;
|
||||
default:
|
||||
bProcess = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1987,7 +1935,7 @@ long wxWindow::MSWOnMDIActivate(long WXUNUSED(flag), WXHWND WXUNUSED(activate),
|
||||
return 1;
|
||||
}
|
||||
|
||||
void wxWindow::MSWDetachWindowMenu(void)
|
||||
void wxWindow::MSWDetachWindowMenu()
|
||||
{
|
||||
if (m_hMenu)
|
||||
{
|
||||
@ -2006,7 +1954,7 @@ void wxWindow::MSWDetachWindowMenu(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool wxWindow::MSWOnPaint(void)
|
||||
bool wxWindow::MSWOnPaint()
|
||||
{
|
||||
#ifdef __WIN32__
|
||||
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;
|
||||
}
|
||||
|
||||
void wxWindow::InitDialog(void)
|
||||
void wxWindow::InitDialog()
|
||||
{
|
||||
wxInitDialogEvent event(GetId());
|
||||
event.SetEventObject( this );
|
||||
@ -2682,7 +2630,8 @@ void wxGetCharSize(WXHWND wnd, int *x, int *y,wxFont *the_font)
|
||||
{
|
||||
// the_font->UseResource();
|
||||
// the_font->RealizeResource();
|
||||
if ((fnt=(HFONT) the_font->GetResourceHandle()))
|
||||
fnt = (HFONT)the_font->GetResourceHandle();
|
||||
if ( fnt )
|
||||
was = (HFONT) SelectObject(dc,fnt) ;
|
||||
}
|
||||
GetTextMetrics(dc, &tm);
|
||||
@ -2881,7 +2830,7 @@ void wxWindow::ShowCaret(bool show)
|
||||
}
|
||||
}
|
||||
|
||||
void wxWindow::DestroyCaret(void)
|
||||
void wxWindow::DestroyCaret()
|
||||
{
|
||||
m_caretEnabled = FALSE;
|
||||
}
|
||||
@ -2899,7 +2848,7 @@ void wxWindow::GetCaretPos(int *x, int *y) const
|
||||
*y = point.y;
|
||||
}
|
||||
|
||||
wxWindow *wxGetActiveWindow(void)
|
||||
wxWindow *wxGetActiveWindow()
|
||||
{
|
||||
HWND hWnd = GetActiveWindow();
|
||||
if (hWnd != 0)
|
||||
@ -3007,7 +2956,7 @@ void wxWindow::Centre(int direction)
|
||||
}
|
||||
|
||||
/* TODO (maybe)
|
||||
void wxWindow::OnPaint(void)
|
||||
void wxWindow::OnPaint()
|
||||
{
|
||||
PaintSelectionHandles();
|
||||
}
|
||||
@ -3404,7 +3353,7 @@ void wxWindow::SubclassWin(WXHWND hWnd)
|
||||
SetWindowLong((HWND) hWnd, GWL_WNDPROC, (LONG) wxWndProc);
|
||||
}
|
||||
|
||||
void wxWindow::UnsubclassWin(void)
|
||||
void wxWindow::UnsubclassWin()
|
||||
{
|
||||
wxRemoveHandleAssociation(this);
|
||||
|
||||
@ -3541,7 +3490,7 @@ bool wxWindow::IsEnabled(void) const
|
||||
|
||||
// Transfer values to controls. If returns FALSE,
|
||||
// it's an application error (pops up a dialog)
|
||||
bool wxWindow::TransferDataToWindow(void)
|
||||
bool wxWindow::TransferDataToWindow()
|
||||
{
|
||||
wxNode *node = GetChildren()->First();
|
||||
while ( node )
|
||||
@ -3561,7 +3510,7 @@ bool wxWindow::TransferDataToWindow(void)
|
||||
|
||||
// Transfer values from controls. If returns FALSE,
|
||||
// validation failed: don't quit
|
||||
bool wxWindow::TransferDataFromWindow(void)
|
||||
bool wxWindow::TransferDataFromWindow()
|
||||
{
|
||||
wxNode *node = GetChildren()->First();
|
||||
while ( node )
|
||||
@ -3577,7 +3526,7 @@ bool wxWindow::TransferDataFromWindow(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxWindow::Validate(void)
|
||||
bool wxWindow::Validate()
|
||||
{
|
||||
wxNode *node = GetChildren()->First();
|
||||
while ( node )
|
||||
@ -3594,7 +3543,7 @@ bool wxWindow::Validate(void)
|
||||
}
|
||||
|
||||
// Get the window with the focus
|
||||
wxWindow *wxWindow::FindFocus(void)
|
||||
wxWindow *wxWindow::FindFocus()
|
||||
{
|
||||
HWND hWnd = ::GetFocus();
|
||||
if ( hWnd )
|
||||
@ -3617,7 +3566,7 @@ void wxWindow::RemoveChild(wxWindow *child)
|
||||
child->m_windowParent = NULL;
|
||||
}
|
||||
|
||||
void wxWindow::DestroyChildren(void)
|
||||
void wxWindow::DestroyChildren()
|
||||
{
|
||||
if (GetChildren()) {
|
||||
wxNode *node;
|
||||
@ -3733,7 +3682,7 @@ void wxWindow::RemoveConstraintReference(wxWindow *otherWin)
|
||||
}
|
||||
|
||||
// Reset any constraints that mention this window
|
||||
void wxWindow::DeleteRelatedConstraints(void)
|
||||
void wxWindow::DeleteRelatedConstraints()
|
||||
{
|
||||
if (m_constraintsInvolvedIn)
|
||||
{
|
||||
@ -3775,7 +3724,7 @@ void wxWindow::SetSizer(wxSizer *sizer)
|
||||
* New version
|
||||
*/
|
||||
|
||||
bool wxWindow::Layout(void)
|
||||
bool wxWindow::Layout()
|
||||
{
|
||||
if (GetConstraints())
|
||||
{
|
||||
@ -3875,7 +3824,7 @@ bool wxWindow::DoPhase(int phase)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxWindow::ResetConstraints(void)
|
||||
void wxWindow::ResetConstraints()
|
||||
{
|
||||
wxLayoutConstraints *constr = GetConstraints();
|
||||
if (constr)
|
||||
@ -4137,7 +4086,7 @@ void wxWindow::OnDefaultAction(wxControl *initiatingItem)
|
||||
*/
|
||||
}
|
||||
|
||||
void wxWindow::Clear(void)
|
||||
void wxWindow::Clear()
|
||||
{
|
||||
wxClientDC dc(this);
|
||||
wxBrush brush(GetBackgroundColour(), wxSOLID);
|
||||
@ -4146,7 +4095,7 @@ void wxWindow::Clear(void)
|
||||
}
|
||||
|
||||
// Fits the panel around the items
|
||||
void wxWindow::Fit(void)
|
||||
void wxWindow::Fit()
|
||||
{
|
||||
int maxX = 0;
|
||||
int maxY = 0;
|
||||
@ -4315,7 +4264,7 @@ int y_pages = 0;
|
||||
*/
|
||||
|
||||
// Setup background and foreground colours correctly
|
||||
void wxWindow::SetupColours(void)
|
||||
void wxWindow::SetupColours()
|
||||
{
|
||||
if (GetParent())
|
||||
SetBackgroundColour(GetParent()->GetBackgroundColour());
|
||||
@ -4350,13 +4299,13 @@ void wxWindow::OnIdle(wxIdleEvent& event)
|
||||
}
|
||||
|
||||
// Raise the window to the top of the Z order
|
||||
void wxWindow::Raise(void)
|
||||
void wxWindow::Raise()
|
||||
{
|
||||
::BringWindowToTop((HWND) GetHWND());
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user