(1) Denis Pershin's patch for wxGTK (memory leaks corrections)

(2) DELETEP/DELETEA globally renamed to wxDELETE/wxDELETEA and now also NULL
    their argument


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@450 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1998-08-07 15:09:04 +00:00
parent 0e072aac7a
commit a3622daa90
47 changed files with 877 additions and 715 deletions

View File

@@ -210,10 +210,15 @@ enum ErrCode
/** @name Very common macros */ /** @name Very common macros */
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
//@{ //@{
/// delete pointer if it is not NULL /// delete pointer if it is not NULL and NULL it afterwards
#define DELETEP(p) if ( (p) != NULL ) delete (p) // (checking that it's !NULL before passing it to delete is just a
/// delete array pointer if it is not NULL // a question of style, because delete will do it itself anyhow, but it might
#define DELETEA(p) if ( (p) != NULL ) delete [] (p) // be considered as an error by some overzealous debugging implementations of
// the library, so we do it ourselves)
#define wxDELETE(p) if ( (p) != NULL ) { delete (p); p = NULL; }
// delete an array and NULL it (see comments above)
#define wxDELETEA(p) if ( (p) != NULL ) { delete [] (p); p = NULL; }
/// size of statically declared array /// size of statically declared array
#define WXSIZEOF(array) (sizeof(array)/sizeof(array[0])) #define WXSIZEOF(array) (sizeof(array)/sizeof(array[0]))

View File

@@ -315,7 +315,9 @@ WXDLLEXPORT_DATA(extern wxCursor*) wxCROSS_CURSOR;
WXDLLEXPORT_DATA(extern wxColourDatabase*) wxTheColourDatabase; WXDLLEXPORT_DATA(extern wxColourDatabase*) wxTheColourDatabase;
extern void WXDLLEXPORT wxInitializeStockObjects(); extern void WXDLLEXPORT wxInitializeStockObjects();
extern void WXDLLEXPORT wxInitializeStockLists();
extern void WXDLLEXPORT wxDeleteStockObjects(); extern void WXDLLEXPORT wxDeleteStockObjects();
extern void WXDLLEXPORT wxDeleteStockLists();
extern bool WXDLLEXPORT wxColourDisplay(); extern bool WXDLLEXPORT wxColourDisplay();
@@ -345,5 +347,14 @@ extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor);
wxIcon *icon = new wxICON(wxbuild); wxIcon *icon = new wxICON(wxbuild);
*/ */
class WXDLLEXPORT wxResourceCache: public wxList
{
DECLARE_DYNAMIC_CLASS(wxResourceCache)
public:
wxResourceCache();
wxResourceCache(const unsigned int the_key_type);
~wxResourceCache();
};
#endif #endif
// __GDICMNH__ // __GDICMNH__

View File

@@ -119,7 +119,7 @@ enum {
wxLIST_NEXT_ALL, // Searches for subsequent item by index wxLIST_NEXT_ALL, // Searches for subsequent item by index
wxLIST_NEXT_BELOW, // Searches for an item below the specified item wxLIST_NEXT_BELOW, // Searches for an item below the specified item
wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item
wxLIST_NEXT_RIGHT, // Searches for an item to the right of the specified item wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item
}; };
// Alignment flags for Arrange // always wxLIST_ALIGN_LEFT in wxGLC // Alignment flags for Arrange // always wxLIST_ALIGN_LEFT in wxGLC

View File

@@ -5,7 +5,7 @@
// Created: 01/02/97 // Created: 01/02/97
// Id: // Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef __GTKAPPH__ #ifndef __GTKAPPH__
@@ -24,7 +24,6 @@
class wxApp; class wxApp;
class wxLog; class wxLog;
class wxConfig; // it's not used #if !USE_WXCONFIG, but fwd decl doesn't harm
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// global data // global data
@@ -103,12 +102,6 @@ class wxApp: public wxEvtHandler
// user-defined classv (default implementation creates a wxLogGui object) // user-defined classv (default implementation creates a wxLogGui object)
virtual wxLog *CreateLogTarget(); virtual wxLog *CreateLogTarget();
#if USE_WXCONFIG
// override this function to create a global wxConfig object of different
// than default type (right now the default implementation returns NULL)
virtual wxConfig *CreateConfig() { return NULL; }
#endif
// GTK implementation // GTK implementation
static void CommonInit(void); static void CommonInit(void);

View File

@@ -37,7 +37,7 @@ class wxFontNameDirectory;
// global variables // global variables
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// extern wxFontNameDirectory wxTheFontNameDirectory; // defined below //extern wxFontNameDirectory *wxTheFontNameDirectory; // defined below
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxFont // wxFont
@@ -115,6 +115,6 @@ class wxFontNameDirectory: public wxObject
int nextFontId; int nextFontId;
}; };
extern wxFontNameDirectory wxTheFontNameDirectory; extern wxFontNameDirectory *wxTheFontNameDirectory;
#endif // __GTKFONTH__ #endif // __GTKFONTH__

View File

@@ -26,6 +26,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxListBox; class wxListBox;
class wxArrayInt;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// global data // global data

View File

@@ -26,6 +26,9 @@ class WXDLLEXPORT wxSystemSettings: public wxObject
public: public:
inline wxSystemSettings(void) {} inline wxSystemSettings(void) {}
inline static void Init() {}
static void Done();
// Get a system colour // Get a system colour
static wxColour GetSystemColour(int index); static wxColour GetSystemColour(int index);

View File

@@ -5,7 +5,7 @@
// Created: 01/02/97 // Created: 01/02/97
// Id: // Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef __GTKAPPH__ #ifndef __GTKAPPH__
@@ -24,7 +24,6 @@
class wxApp; class wxApp;
class wxLog; class wxLog;
class wxConfig; // it's not used #if !USE_WXCONFIG, but fwd decl doesn't harm
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// global data // global data
@@ -103,12 +102,6 @@ class wxApp: public wxEvtHandler
// user-defined classv (default implementation creates a wxLogGui object) // user-defined classv (default implementation creates a wxLogGui object)
virtual wxLog *CreateLogTarget(); virtual wxLog *CreateLogTarget();
#if USE_WXCONFIG
// override this function to create a global wxConfig object of different
// than default type (right now the default implementation returns NULL)
virtual wxConfig *CreateConfig() { return NULL; }
#endif
// GTK implementation // GTK implementation
static void CommonInit(void); static void CommonInit(void);

View File

@@ -37,7 +37,7 @@ class wxFontNameDirectory;
// global variables // global variables
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// extern wxFontNameDirectory wxTheFontNameDirectory; // defined below //extern wxFontNameDirectory *wxTheFontNameDirectory; // defined below
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxFont // wxFont
@@ -115,6 +115,6 @@ class wxFontNameDirectory: public wxObject
int nextFontId; int nextFontId;
}; };
extern wxFontNameDirectory wxTheFontNameDirectory; extern wxFontNameDirectory *wxTheFontNameDirectory;
#endif // __GTKFONTH__ #endif // __GTKFONTH__

View File

@@ -26,6 +26,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxListBox; class wxListBox;
class wxArrayInt;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// global data // global data

View File

@@ -26,6 +26,9 @@ class WXDLLEXPORT wxSystemSettings: public wxObject
public: public:
inline wxSystemSettings(void) {} inline wxSystemSettings(void) {}
inline static void Init() {}
static void Done();
// Get a system colour // Get a system colour
static wxColour GetSystemColour(int index); static wxColour GetSystemColour(int index);

View File

@@ -60,8 +60,8 @@ class WXDLLEXPORT wxIndividualLayoutConstraint: public wxObject
bool done; bool done;
public: public:
wxIndividualLayoutConstraint(void); wxIndividualLayoutConstraint();
~wxIndividualLayoutConstraint(void); ~wxIndividualLayoutConstraint();
void Set(wxRelationship rel, wxWindow *otherW, wxEdge otherE, int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN); void Set(wxRelationship rel, wxWindow *otherW, wxEdge otherE, int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN);
@@ -89,28 +89,28 @@ class WXDLLEXPORT wxIndividualLayoutConstraint: public wxObject
// //
// Dimension is unconstrained // Dimension is unconstrained
// //
inline void Unconstrained(void) { relationship = wxUnconstrained; } inline void Unconstrained() { relationship = wxUnconstrained; }
// //
// Dimension is 'as is' (use current size settings) // Dimension is 'as is' (use current size settings)
// //
inline void AsIs(void) { relationship = wxAsIs; } inline void AsIs() { relationship = wxAsIs; }
// //
// Accessors // Accessors
// //
inline wxWindow *GetOtherWindow(void) { return otherWin; } inline wxWindow *GetOtherWindow() { return otherWin; }
inline wxEdge GetMyEdge(void) { return myEdge; } inline wxEdge GetMyEdge() const { return myEdge; }
inline void SetEdge(wxEdge which) { myEdge = which; } inline void SetEdge(wxEdge which) { myEdge = which; }
inline void SetValue(int v) { value = v; } inline void SetValue(int v) { value = v; }
inline int GetMargin(void) { return margin; } inline int GetMargin() { return margin; }
inline void SetMargin(int m) { margin = m; } inline void SetMargin(int m) { margin = m; }
inline int GetValue(void) { return value; } inline int GetValue() const { return value; }
inline int GetPercent(void) { return percent; } inline int GetPercent() const { return percent; }
inline int GetOtherEdge(void) { return otherEdge; } inline int GetOtherEdge() const { return otherEdge; }
inline bool GetDone(void) { return done; } inline bool GetDone() const { return done; }
inline void SetDone(bool d) { done = d; } inline void SetDone(bool d) { done = d; }
inline wxRelationship GetRelationship(void) { return relationship; } inline wxRelationship GetRelationship() { return relationship; }
inline void SetRelationship(wxRelationship r) { relationship = r; } inline void SetRelationship(wxRelationship r) { relationship = r; }
// Reset constraint if it mentions otherWin // Reset constraint if it mentions otherWin
@@ -121,7 +121,7 @@ class WXDLLEXPORT wxIndividualLayoutConstraint: public wxObject
// Get the value of this edge or dimension, or if this // Get the value of this edge or dimension, or if this
// is not determinable, -1. // is not determinable, -1.
int GetEdge(wxEdge which, wxWindow *thisWin, wxWindow *other); int GetEdge(wxEdge which, wxWindow *thisWin, wxWindow *other) const;
}; };
class WXDLLEXPORT wxLayoutConstraints: public wxObject class WXDLLEXPORT wxLayoutConstraints: public wxObject
@@ -141,10 +141,15 @@ class WXDLLEXPORT wxLayoutConstraints: public wxObject
wxIndividualLayoutConstraint centreX; wxIndividualLayoutConstraint centreX;
wxIndividualLayoutConstraint centreY; wxIndividualLayoutConstraint centreY;
wxLayoutConstraints(void); wxLayoutConstraints();
~wxLayoutConstraints(void); ~wxLayoutConstraints();
bool SatisfyConstraints(wxWindow *win, int *noChanges); bool SatisfyConstraints(wxWindow *win, int *noChanges);
bool AreSatisfied() const
{
return left.GetDone() && top.GetDone() && right.GetDone() &&
bottom.GetDone() && centreX.GetDone() && centreY.GetDone();
}
}; };
bool WXDLLEXPORT wxOldDoLayout(wxWindow *win); bool WXDLLEXPORT wxOldDoLayout(wxWindow *win);
@@ -217,9 +222,9 @@ class WXDLLEXPORT wxSizer: public wxWindow
int sizerX; int sizerX;
int sizerY; int sizerY;
public: public:
wxSizer(void); wxSizer();
wxSizer(wxWindow *parent, wxSizerBehaviour behav = wxSizerNone); wxSizer(wxWindow *parent, wxSizerBehaviour behav = wxSizerNone);
~wxSizer(void); ~wxSizer();
bool Create(wxWindow *parent, wxSizerBehaviour behav = wxSizerNone); bool Create(wxWindow *parent, wxSizerBehaviour behav = wxSizerNone);
virtual void SetSize(int x, int y, int w, int h, int flags = wxSIZE_AUTO); virtual void SetSize(int x, int y, int w, int h, int flags = wxSIZE_AUTO);
@@ -236,14 +241,14 @@ class WXDLLEXPORT wxSizer: public wxWindow
{ Move(x, y); } { Move(x, y); }
virtual void SetBorder(int w, int h); virtual void SetBorder(int w, int h);
inline int GetBorderX(void) { return borderX ; } inline int GetBorderX() { return borderX ; }
inline int GetBorderY(void) { return borderY ; } inline int GetBorderY() { return borderY ; }
virtual void AddSizerChild(wxWindow *child); virtual void AddSizerChild(wxWindow *child);
virtual void RemoveSizerChild(wxWindow *child); virtual void RemoveSizerChild(wxWindow *child);
inline virtual void SetBehaviour(wxSizerBehaviour b) { sizerBehaviour = b; } inline virtual void SetBehaviour(wxSizerBehaviour b) { sizerBehaviour = b; }
inline virtual wxSizerBehaviour GetBehaviour(void) { return sizerBehaviour; } inline virtual wxSizerBehaviour GetBehaviour() { return sizerBehaviour; }
virtual bool LayoutPhase1(int *); virtual bool LayoutPhase1(int *);
virtual bool LayoutPhase2(int *); virtual bool LayoutPhase2(int *);
@@ -264,9 +269,9 @@ class WXDLLEXPORT wxRowColSizer: public wxSizer
int ySpacing; int ySpacing;
public: public:
// rowOrCol = TRUE to be laid out in rows, otherwise in columns. // rowOrCol = TRUE to be laid out in rows, otherwise in columns.
wxRowColSizer(void); wxRowColSizer();
wxRowColSizer(wxWindow *parent, bool rowOrCol = wxSIZER_ROWS, int rowsOrColSize = 20, wxSizerBehaviour = wxSizerShrink); wxRowColSizer(wxWindow *parent, bool rowOrCol = wxSIZER_ROWS, int rowsOrColSize = 20, wxSizerBehaviour = wxSizerShrink);
~wxRowColSizer(void); ~wxRowColSizer();
bool Create(wxWindow *parent, bool rowOrCol = wxSIZER_ROWS, int rowsOrColSize = 20, wxSizerBehaviour = wxSizerShrink); bool Create(wxWindow *parent, bool rowOrCol = wxSIZER_ROWS, int rowsOrColSize = 20, wxSizerBehaviour = wxSizerShrink);
void SetSize(int x, int y, int w, int h, int flags = wxSIZE_AUTO); void SetSize(int x, int y, int w, int h, int flags = wxSIZE_AUTO);
@@ -274,9 +279,9 @@ class WXDLLEXPORT wxRowColSizer: public wxSizer
void SetSize(int w, int h) { wxSizer::SetSize(w, h); } void SetSize(int w, int h) { wxSizer::SetSize(w, h); }
inline virtual void SetRowOrCol(bool rc) { rowOrCol = rc; } inline virtual void SetRowOrCol(bool rc) { rowOrCol = rc; }
inline virtual bool GetRowOrCol(void) { return rowOrCol; } inline virtual bool GetRowOrCol() { return rowOrCol; }
inline virtual void SetRowOrColSize(int n) { rowOrColSize = n; } inline virtual void SetRowOrColSize(int n) { rowOrColSize = n; }
inline virtual int GetRowOrColSize(void) { return rowOrColSize; } inline virtual int GetRowOrColSize() { return rowOrColSize; }
inline virtual void SetSpacing(int x, int y) { xSpacing = x; ySpacing = y; } inline virtual void SetSpacing(int x, int y) { xSpacing = x; ySpacing = y; }
inline virtual void GetSpacing(int *x, int *y) { *x = xSpacing; *y = ySpacing; } inline virtual void GetSpacing(int *x, int *y) { *x = xSpacing; *y = ySpacing; }
@@ -291,10 +296,10 @@ class WXDLLEXPORT wxSpacingSizer: public wxSizer
private: private:
protected: protected:
public: public:
wxSpacingSizer(void); wxSpacingSizer();
wxSpacingSizer(wxWindow *parent, wxRelationship rel, wxWindow *other, int spacing); wxSpacingSizer(wxWindow *parent, wxRelationship rel, wxWindow *other, int spacing);
wxSpacingSizer(wxWindow *parent); wxSpacingSizer(wxWindow *parent);
~wxSpacingSizer(void); ~wxSpacingSizer();
bool Create(wxWindow *parent, wxRelationship rel, wxWindow *other, int sp); bool Create(wxWindow *parent, wxRelationship rel, wxWindow *other, int sp);
bool Create(wxWindow *parent); bool Create(wxWindow *parent);

View File

@@ -203,7 +203,9 @@ class wxFrame;
class WXDLLEXPORT wxLogWindow : public wxLog class WXDLLEXPORT wxLogWindow : public wxLog
{ {
public: public:
wxLogWindow(const char *szTitle, bool bShow = TRUE); wxLogWindow(const char *szTitle, // the title of the frame
bool bShow = TRUE, // show window immediately?
bool bPassToOld = TRUE); // pass log messages to the old target?
~wxLogWindow(); ~wxLogWindow();
// window operations // window operations
@@ -213,15 +215,24 @@ public:
wxFrame *GetFrame() const; wxFrame *GetFrame() const;
// accessors // accessors
// the previous log target (may be NULL)
wxLog *GetOldLog() const { return m_pOldLog; } wxLog *GetOldLog() const { return m_pOldLog; }
// are we passing the messages to the previous log target?
bool IsPassingMessages() const { return m_bPassMessages; }
// we can pass the messages to the previous log target (we're in this mode by
// default: we collect all messages in the window, but also let the default
// processing take place)
void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; }
protected: protected:
virtual void DoLog(wxLogLevel level, const char *szString); virtual void DoLog(wxLogLevel level, const char *szString);
virtual void DoLogString(const char *szString); virtual void DoLogString(const char *szString);
private: private:
wxLog *m_pOldLog; // previous log target bool m_bPassMessages; // pass messages to m_pOldLog?
wxLogFrame *m_pLogFrame; // the log frame wxLog *m_pOldLog; // previous log target
wxLogFrame *m_pLogFrame; // the log frame
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97 // Created: 01/02/97
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem // Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef __MENUH__ #ifndef __MENUH__
@@ -60,7 +60,7 @@ public:
inline bool IsEnabled(int id) const { return Enabled(id); }; inline bool IsEnabled(int id) const { return Enabled(id); };
void Check(int id, bool Flag); void Check(int id, bool Flag);
bool Checked(int id) const; bool Checked(int id) const;
inline bool IsChecked(int id) const { return IsChecked(id); }; inline bool IsChecked(int id) const { return Checked(id); };
// item properties // item properties
// title // title
@@ -84,7 +84,7 @@ public:
virtual void SetParent(wxEvtHandler *parent) { m_parent = parent; } virtual void SetParent(wxEvtHandler *parent) { m_parent = parent; }
inline void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; } inline void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; }
inline wxEvtHandler *GetEventHandler(void) { return m_eventHandler; } inline wxEvtHandler *GetEventHandler() { return m_eventHandler; }
inline wxList& GetItems() const { return (wxList&) m_menuItems; } inline wxList& GetItems() const { return (wxList&) m_menuItems; }
@@ -130,9 +130,10 @@ class WXDLLEXPORT wxMenuBar: public wxEvtHandler
{ {
DECLARE_DYNAMIC_CLASS(wxMenuBar) DECLARE_DYNAMIC_CLASS(wxMenuBar)
wxMenuBar(void); public:
wxMenuBar();
wxMenuBar(int n, wxMenu *menus[], const wxString titles[]); wxMenuBar(int n, wxMenu *menus[], const wxString titles[]);
~wxMenuBar(void); ~wxMenuBar();
void Append(wxMenu *menu, const wxString& title); void Append(wxMenu *menu, const wxString& title);
// Must only be used AFTER menu has been attached to frame, // Must only be used AFTER menu has been attached to frame,
@@ -161,8 +162,11 @@ class WXDLLEXPORT wxMenuBar: public wxEvtHandler
// menu too if itemMenu is non-NULL. // menu too if itemMenu is non-NULL.
wxMenuItem *FindItemForId(int itemId, wxMenu **menuForItem = NULL) const ; wxMenuItem *FindItemForId(int itemId, wxMenu **menuForItem = NULL) const ;
int GetMenuCount() const { return m_menuCount; }
wxMenu *GetMenu(int n) const { return m_menus[n]; }
inline void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; } inline void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; }
inline wxEvtHandler *GetEventHandler(void) { return m_eventHandler; } inline wxEvtHandler *GetEventHandler() { return m_eventHandler; }
inline int GetMenuCount() const { return m_menuCount; } inline int GetMenuCount() const { return m_menuCount; }
inline wxMenu* GetMenu(int i) const { return m_menus[i]; } inline wxMenu* GetMenu(int i) const { return m_menus[i]; }

View File

@@ -5,7 +5,7 @@
// Modified by: Vadim Zeitlin for Windows version // Modified by: Vadim Zeitlin for Windows version
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem // Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef _NOTEBOOK_H #ifndef _NOTEBOOK_H
@@ -62,7 +62,7 @@ private:
// @@@ this class should really derive from wxTabCtrl, but the interface is not // @@@ this class should really derive from wxTabCtrl, but the interface is not
// exactly the same, so I can't do it right now and instead we reimplement // exactly the same, so I can't do it right now and instead we reimplement
// part of wxTabCtrl here // part of wxTabCtrl here
class wxNotebook : public wxControl class WXDLLEXPORT wxNotebook : public wxControl
{ {
public: public:
// ctors // ctors
@@ -156,6 +156,7 @@ public:
void OnSetFocus(wxFocusEvent& event); void OnSetFocus(wxFocusEvent& event);
void OnNavigationKey(wxNavigationKeyEvent& event); void OnNavigationKey(wxNavigationKeyEvent& event);
>>>>>>> 1.5
// base class virtuals // base class virtuals
// ------------------- // -------------------
virtual void Command(wxCommandEvent& event); virtual void Command(wxCommandEvent& event);

View File

@@ -187,7 +187,7 @@ void wxDataOutputStream::WriteDouble(double d)
#if USE_APPLE_IEEE #if USE_APPLE_IEEE
ConvertToIeeeExtended(d, (unsigned char *)buf); ConvertToIeeeExtended(d, (unsigned char *)buf);
#else #else
# pragma warning "wxDataStream::WriteDouble() not using IeeeExtended - will not work!" # pragma warning "wxDataStream::WriteDouble() not using IeeeExtended - will not work!"
buf[0] = '\0'; buf[0] = '\0';
#endif #endif
Write(buf, 10); Write(buf, 10);

View File

@@ -72,7 +72,7 @@ wxBaseArray::wxBaseArray(const wxBaseArray& src)
// assignment operator // assignment operator
wxBaseArray& wxBaseArray::operator=(const wxBaseArray& src) wxBaseArray& wxBaseArray::operator=(const wxBaseArray& src)
{ {
DELETEA(m_pItems); wxDELETEA(m_pItems);
m_uiSize = // not src.m_uiSize to save memory m_uiSize = // not src.m_uiSize to save memory
m_uiCount = src.m_uiCount; m_uiCount = src.m_uiCount;
@@ -117,7 +117,7 @@ void wxBaseArray::Grow()
// dtor // dtor
wxBaseArray::~wxBaseArray() wxBaseArray::~wxBaseArray()
{ {
DELETEA(m_pItems); wxDELETEA(m_pItems);
} }
// clears the list // clears the list
@@ -126,8 +126,7 @@ void wxBaseArray::Clear()
m_uiSize = m_uiSize =
m_uiCount = 0; m_uiCount = 0;
DELETEA(m_pItems); wxDELETEA(m_pItems);
m_pItems = NULL;
} }
// pre-allocates memory (frees the previous data!) // pre-allocates memory (frees the previous data!)
@@ -137,7 +136,7 @@ void wxBaseArray::Alloc(uint uiSize)
// only if old buffer was not big enough // only if old buffer was not big enough
if ( uiSize > m_uiSize ) { if ( uiSize > m_uiSize ) {
DELETEA(m_pItems); wxDELETEA(m_pItems);
m_pItems = new long[uiSize]; m_pItems = new long[uiSize];
m_uiSize = uiSize; m_uiSize = uiSize;
} }

View File

@@ -41,6 +41,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList) IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList) IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList) IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
/* /*
IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPoint, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxPoint, wxObject)
@@ -319,14 +320,15 @@ wxString wxColourDatabase::FindName (const wxColour& colour) const
} }
void void wxInitializeStockLists () {
wxInitializeStockObjects ()
{
wxTheBrushList = new wxBrushList; wxTheBrushList = new wxBrushList;
wxThePenList = new wxPenList; wxThePenList = new wxPenList;
wxTheFontList = new wxFontList; wxTheFontList = new wxFontList;
wxTheBitmapList = new wxBitmapList; wxTheBitmapList = new wxBitmapList;
}
void wxInitializeStockObjects ()
{
#ifdef __WXMOTIF__ #ifdef __WXMOTIF__
#endif #endif
#ifdef __X__ #ifdef __X__
@@ -376,44 +378,52 @@ wxInitializeStockObjects ()
void void
wxDeleteStockObjects () wxDeleteStockObjects ()
{ {
DELETEP(wxNORMAL_FONT);
DELETEP(wxSMALL_FONT);
DELETEP(wxITALIC_FONT);
DELETEP(wxSWISS_FONT);
DELETEP(wxRED_PEN); wxDELETE(wxNORMAL_FONT);
DELETEP(wxCYAN_PEN); wxDELETE(wxSMALL_FONT);
DELETEP(wxGREEN_PEN); wxDELETE(wxITALIC_FONT);
DELETEP(wxBLACK_PEN); wxDELETE(wxSWISS_FONT);
DELETEP(wxWHITE_PEN);
DELETEP(wxTRANSPARENT_PEN);
DELETEP(wxBLACK_DASHED_PEN);
DELETEP(wxGREY_PEN);
DELETEP(wxMEDIUM_GREY_PEN);
DELETEP(wxLIGHT_GREY_PEN);
DELETEP(wxBLUE_BRUSH); wxDELETE(wxRED_PEN);
DELETEP(wxGREEN_BRUSH); wxDELETE(wxCYAN_PEN);
DELETEP(wxWHITE_BRUSH); wxDELETE(wxGREEN_PEN);
DELETEP(wxBLACK_BRUSH); wxDELETE(wxBLACK_PEN);
DELETEP(wxTRANSPARENT_BRUSH); wxDELETE(wxWHITE_PEN);
DELETEP(wxCYAN_BRUSH); wxDELETE(wxTRANSPARENT_PEN);
DELETEP(wxRED_BRUSH); wxDELETE(wxBLACK_DASHED_PEN);
DELETEP(wxGREY_BRUSH); wxDELETE(wxGREY_PEN);
DELETEP(wxMEDIUM_GREY_BRUSH); wxDELETE(wxMEDIUM_GREY_PEN);
DELETEP(wxLIGHT_GREY_BRUSH); wxDELETE(wxLIGHT_GREY_PEN);
DELETEP(wxBLACK); wxDELETE(wxBLUE_BRUSH);
DELETEP(wxWHITE); wxDELETE(wxGREEN_BRUSH);
DELETEP(wxRED); wxDELETE(wxWHITE_BRUSH);
DELETEP(wxBLUE); wxDELETE(wxBLACK_BRUSH);
DELETEP(wxGREEN); wxDELETE(wxTRANSPARENT_BRUSH);
DELETEP(wxCYAN); wxDELETE(wxCYAN_BRUSH);
DELETEP(wxLIGHT_GREY); wxDELETE(wxRED_BRUSH);
wxDELETE(wxGREY_BRUSH);
wxDELETE(wxMEDIUM_GREY_BRUSH);
wxDELETE(wxLIGHT_GREY_BRUSH);
DELETEP(wxSTANDARD_CURSOR); wxDELETE(wxBLACK);
DELETEP(wxHOURGLASS_CURSOR); wxDELETE(wxWHITE);
DELETEP(wxCROSS_CURSOR); wxDELETE(wxRED);
wxDELETE(wxBLUE);
wxDELETE(wxGREEN);
wxDELETE(wxCYAN);
wxDELETE(wxLIGHT_GREY);
wxDELETE(wxSTANDARD_CURSOR);
wxDELETE(wxHOURGLASS_CURSOR);
wxDELETE(wxCROSS_CURSOR);
}
void wxDeleteStockLists() {
wxDELETE(wxTheBrushList);
wxDELETE(wxThePenList);
wxDELETE(wxTheFontList);
wxDELETE(wxTheBitmapList);
} }
wxBitmapList::wxBitmapList () wxBitmapList::wxBitmapList ()
@@ -611,3 +621,38 @@ wxSize wxGetDisplaySize()
return wxSize(x, y); return wxSize(x, y);
} }
wxResourceCache::wxResourceCache () : wxList() {
}
wxResourceCache::wxResourceCache (const unsigned int the_key_type) : wxList(the_key_type) {
}
wxResourceCache::~wxResourceCache () {
wxNode *node = First ();
while (node) {
wxGDIObject *item = (wxGDIObject *)node->Data();
if (item->IsKindOf(CLASSINFO(wxBrush))) {
wxBrush *brush = (wxBrush *)item;
delete brush;
}
if (item->IsKindOf(CLASSINFO(wxFont))) {
wxFont *font = (wxFont *)item;
delete font;
}
if (item->IsKindOf(CLASSINFO(wxBitmap))) {
wxBitmap *bitmap = (wxBitmap *)item;
delete bitmap;
}
if (item->IsKindOf(CLASSINFO(wxColour))) {
wxColour *colour = (wxColour *)item;
delete colour;
}
wxNode *next = node->Next ();
node = next;
}
}

View File

@@ -193,8 +193,8 @@ wxMsgCatalog::wxMsgCatalog()
wxMsgCatalog::~wxMsgCatalog() wxMsgCatalog::~wxMsgCatalog()
{ {
DELETEA(m_pData); wxDELETEA(m_pData);
DELETEA(m_pszName); wxDELETEA(m_pszName);
} }
class NoTransErr class NoTransErr
@@ -268,8 +268,7 @@ bool wxMsgCatalog::Load(const char *szDirPrefix, const char *szName)
// read the whole file in memory // read the whole file in memory
m_pData = new uint8[nSize]; m_pData = new uint8[nSize];
if ( fileMsg.Read(m_pData, nSize) != nSize ) { if ( fileMsg.Read(m_pData, nSize) != nSize ) {
DELETEA(m_pData); wxDELETEA(m_pData);
m_pData = NULL;
return FALSE; return FALSE;
} }
@@ -291,8 +290,7 @@ bool wxMsgCatalog::Load(const char *szDirPrefix, const char *szName)
// it's either too short or has incorrect magic number // it's either too short or has incorrect magic number
wxLogWarning("'%s' is not a valid message catalog.", strFullName.c_str()); wxLogWarning("'%s' is not a valid message catalog.", strFullName.c_str());
DELETEA(m_pData); wxDELETEA(m_pData);
m_pData = NULL;
return FALSE; return FALSE;
} }

View File

@@ -88,13 +88,13 @@ int wxSizerMarginY(wxWindow *win)
} }
wxIndividualLayoutConstraint::wxIndividualLayoutConstraint(void) wxIndividualLayoutConstraint::wxIndividualLayoutConstraint()
{ {
myEdge = wxTop; relationship = wxUnconstrained; margin = 0; value = 0; percent = 0; otherEdge = wxTop; myEdge = wxTop; relationship = wxUnconstrained; margin = 0; value = 0; percent = 0; otherEdge = wxTop;
done = FALSE; otherWin = NULL; done = FALSE; otherWin = NULL;
} }
wxIndividualLayoutConstraint::~wxIndividualLayoutConstraint(void) wxIndividualLayoutConstraint::~wxIndividualLayoutConstraint()
{ {
} }
@@ -722,7 +722,9 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
// Get the value of this edge or dimension, or if this // Get the value of this edge or dimension, or if this
// is not determinable, -1. // is not determinable, -1.
int wxIndividualLayoutConstraint::GetEdge(wxEdge which, wxWindow *thisWin, wxWindow *other) int wxIndividualLayoutConstraint::GetEdge(wxEdge which,
wxWindow *thisWin,
wxWindow *other) const
{ {
// If the edge or dimension belongs to the parent, then we // If the edge or dimension belongs to the parent, then we
// know the dimension is obtainable immediately. // know the dimension is obtainable immediately.
@@ -942,7 +944,7 @@ int wxIndividualLayoutConstraint::GetEdge(wxEdge which, wxWindow *thisWin, wxWin
return -1; return -1;
} }
wxLayoutConstraints::wxLayoutConstraints(void) wxLayoutConstraints::wxLayoutConstraints()
{ {
left.SetEdge(wxLeft); left.SetEdge(wxLeft);
top.SetEdge(wxTop); top.SetEdge(wxTop);
@@ -954,7 +956,7 @@ wxLayoutConstraints::wxLayoutConstraints(void)
height.SetEdge(wxHeight); height.SetEdge(wxHeight);
} }
wxLayoutConstraints::~wxLayoutConstraints(void) wxLayoutConstraints::~wxLayoutConstraints()
{ {
} }
@@ -1004,8 +1006,7 @@ bool wxLayoutConstraints::SatisfyConstraints(wxWindow *win, int *nChanges)
*nChanges = noChanges; *nChanges = noChanges;
return (left.GetDone() && top.GetDone() && right.GetDone() && bottom.GetDone() && return AreSatisfied();
centreX.GetDone() && centreY.GetDone());
} }
/* /*
@@ -1085,7 +1086,7 @@ bool wxOldDoLayout(wxWindow *win)
if (constr) if (constr)
{ {
int tempNoChanges = 0; int tempNoChanges = 0;
(void) constr->SatisfyConstraints(child, &tempNoChanges); (void)constr->SatisfyConstraints(child, &tempNoChanges);
noChanges += tempNoChanges; noChanges += tempNoChanges;
} }
node = node->Next(); node = node->Next();
@@ -1136,7 +1137,7 @@ bool wxOldDoLayout(wxWindow *win)
return TRUE; return TRUE;
} }
wxSizer::wxSizer(void) wxSizer::wxSizer()
{ {
sizerBehaviour = wxSizerNone; sizerBehaviour = wxSizerNone;
borderX = 2; borderX = 2;
@@ -1197,7 +1198,7 @@ bool wxSizer::Create(wxWindow *parent, wxSizerBehaviour behav)
return TRUE; return TRUE;
} }
wxSizer::~wxSizer(void) wxSizer::~wxSizer()
{ {
// Remove all children without deleting them, // Remove all children without deleting them,
// or ~wxbWindow will delete proper windows _twice_ // or ~wxbWindow will delete proper windows _twice_
@@ -1488,7 +1489,7 @@ bool wxSizer::LayoutPhase2(int *noChanges)
* wxRowColSizer * wxRowColSizer
*/ */
wxRowColSizer::wxRowColSizer(void) wxRowColSizer::wxRowColSizer()
{ {
rowOrCol = TRUE; rowOrCol = TRUE;
rowOrColSize = 20; rowOrColSize = 20;
@@ -1513,7 +1514,7 @@ bool wxRowColSizer::Create(wxWindow *parent, bool rc, int n, wxSizerBehaviour be
return TRUE; return TRUE;
} }
wxRowColSizer::~wxRowColSizer(void) wxRowColSizer::~wxRowColSizer()
{ {
} }
@@ -1677,7 +1678,7 @@ bool wxRowColSizer::LayoutPhase2(int *noChanges)
* wxSpacingSizer * wxSpacingSizer
*/ */
wxSpacingSizer::wxSpacingSizer(void) wxSpacingSizer::wxSpacingSizer()
{ {
} }
@@ -1738,7 +1739,7 @@ bool wxSpacingSizer::Create(wxWindow *parent, wxRelationship rel, wxWindow *othe
return TRUE; return TRUE;
} }
wxSpacingSizer::~wxSpacingSizer(void) wxSpacingSizer::~wxSpacingSizer()
{ {
} }

View File

@@ -646,10 +646,12 @@ void wxLogFrame::OnClear(wxCommandEvent& WXUNUSED(event))
m_pTextCtrl->Clear(); m_pTextCtrl->Clear();
} }
wxLogWindow::wxLogWindow(const char *szTitle, bool bShow) wxLogWindow::wxLogWindow(const char *szTitle, bool bShow, bool bDoPass)
{ {
m_pOldLog = wxLog::GetActiveTarget(); m_bPassMessages = bDoPass;
m_pLogFrame = new wxLogFrame(szTitle); m_pLogFrame = new wxLogFrame(szTitle);
m_pOldLog = wxLog::SetActiveTarget(this);
if ( bShow ) if ( bShow )
m_pLogFrame->Show(TRUE); m_pLogFrame->Show(TRUE);
@@ -668,7 +670,7 @@ wxFrame *wxLogWindow::GetFrame() const
void wxLogWindow::DoLog(wxLogLevel level, const char *szString) void wxLogWindow::DoLog(wxLogLevel level, const char *szString)
{ {
// first let the previous logger show it // first let the previous logger show it
if ( m_pOldLog != NULL ) { if ( m_pOldLog != NULL && m_bPassMessages ) {
// @@@ why can't we access protected wxLog method from here (we derive // @@@ why can't we access protected wxLog method from here (we derive
// from wxLog)? gcc gives "DoLog is protected in this context", what // from wxLog)? gcc gives "DoLog is protected in this context", what
// does this mean? Anyhow, the cast is harmless and let's us do what // does this mean? Anyhow, the cast is harmless and let's us do what

View File

@@ -1645,7 +1645,7 @@ void wxPostScriptDC::GetTextExtent (const wxString& string, long *x, long *y,
// Julian - we'll need to do this a different way now we've removed the // Julian - we'll need to do this a different way now we've removed the
// font directory system. Must find Stefan's original code. // font directory system. Must find Stefan's original code.
name = wxTheFontNameDirectory.GetAFMName(Family, Weight, Style); name = wxTheFontNameDirectory->GetAFMName(Family, Weight, Style);
if (!name) if (!name)
name = "unknown"; name = "unknown";

View File

@@ -1133,7 +1133,7 @@ void wxArrayString::Grow()
memcpy(pNew, m_pItems, m_nCount*sizeof(char *)); memcpy(pNew, m_pItems, m_nCount*sizeof(char *));
// delete old memory (but do not release the strings!) // delete old memory (but do not release the strings!)
DELETEA(m_pItems); wxDELETEA(m_pItems);
m_pItems = pNew; m_pItems = pNew;
} }
@@ -1163,8 +1163,7 @@ void wxArrayString::Clear()
m_nSize = m_nSize =
m_nCount = 0; m_nCount = 0;
DELETEA(m_pItems); wxDELETEA(m_pItems);
m_pItems = NULL;
} }
// dtor // dtor
@@ -1172,7 +1171,7 @@ wxArrayString::~wxArrayString()
{ {
Free(); Free();
DELETEA(m_pItems); wxDELETEA(m_pItems);
} }
// pre-allocates memory (frees the previous data!) // pre-allocates memory (frees the previous data!)
@@ -1183,7 +1182,7 @@ void wxArrayString::Alloc(size_t nSize)
// only if old buffer was not big enough // only if old buffer was not big enough
if ( nSize > m_nSize ) { if ( nSize > m_nSize ) {
Free(); Free();
DELETEA(m_pItems); wxDELETEA(m_pItems);
m_pItems = new char *[nSize]; m_pItems = new char *[nSize];
m_nSize = nSize; m_nSize = nSize;
} }

View File

@@ -19,6 +19,8 @@
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/log.h" #include "wx/log.h"
#include "wx/memory.h" #include "wx/memory.h"
#include "wx/font.h"
#include "wx/settings.h"
#include "unistd.h" #include "unistd.h"
@@ -34,6 +36,7 @@ wxApp *wxTheApp = NULL;
wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL; wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
extern wxList wxPendingDelete; extern wxList wxPendingDelete;
extern wxResourceCache *wxTheResourceCache;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// local functions // local functions
@@ -242,9 +245,16 @@ void wxApp::CommonInit(void)
(void) wxGetResource("wxWindows", "OsVersion", &wxOsVersion); (void) wxGetResource("wxWindows", "OsVersion", &wxOsVersion);
#endif #endif
*/ */
wxSystemSettings::Init();
wxTheResourceCache = new wxResourceCache(wxKEY_STRING);
wxTheFontNameDirectory = new wxFontNameDirectory;
wxTheFontNameDirectory->Initialize();
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING); wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
wxTheColourDatabase->Initialize(); wxTheColourDatabase->Initialize();
wxInitializeStockLists();
wxInitializeStockObjects(); wxInitializeStockObjects();
// For PostScript printing // For PostScript printing
@@ -261,14 +271,24 @@ void wxApp::CommonInit(void)
g_globalCursor = new wxCursor; g_globalCursor = new wxCursor;
*/ */
wxInitializeStockObjects(); // wxInitializeStockObjects();
}; };
void wxApp::CommonCleanUp(void) void wxApp::CommonCleanUp(void)
{ {
wxDELETE(wxTheColourDatabase);
wxDELETE(wxThePrintPaperDatabase);
wxDELETE(wxThePrintSetupData);
wxDELETE(wxTheFontNameDirectory);
wxDeleteStockObjects(); wxDeleteStockObjects();
wxFlushResources(); wxFlushResources();
wxDELETE(wxTheResourceCache);
wxDeleteStockLists();
wxSystemSettings::Done();
}; };
wxLog *wxApp::CreateLogTarget() wxLog *wxApp::CreateLogTarget()
@@ -311,8 +331,6 @@ int wxEntry( int argc, char *argv[] )
wxObject *test_app = app_ini(); wxObject *test_app = app_ini();
wxTheApp = (wxApp*) test_app; wxTheApp = (wxApp*) test_app;
// wxTheApp = (wxApp*)( app_ini() );
}; };
if (!wxTheApp) if (!wxTheApp)
@@ -321,8 +339,6 @@ int wxEntry( int argc, char *argv[] )
return 0; return 0;
}; };
// printf( "Programmstart.\n" );
wxTheApp->argc = argc; wxTheApp->argc = argc;
wxTheApp->argv = argv; wxTheApp->argv = argv;
@@ -360,6 +376,8 @@ int wxEntry( int argc, char *argv[] )
wxApp::CommonCleanUp(); wxApp::CommonCleanUp();
wxDELETE(wxTheApp);
#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT #if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT
// At this point we want to check if there are any memory // At this point we want to check if there are any memory
// blocks that aren't part of the wxDebugContext itself, // blocks that aren't part of the wxDebugContext itself,

View File

@@ -5,7 +5,7 @@
// Created: 01/02/97 // Created: 01/02/97
// Id: // Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -23,7 +23,7 @@
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/Xresource.h> #include <X11/Xresource.h>
wxList wxResourceCache(wxKEY_STRING); wxResourceCache *wxTheResourceCache = NULL;
XrmDatabase wxResourceDatabase; XrmDatabase wxResourceDatabase;
// Useful buffer, initialized in wxCommonInit // Useful buffer, initialized in wxCommonInit
@@ -64,7 +64,7 @@ wxBitmapList *wxTheBitmapList = NULL;
// X only font names // X only font names
wxFontNameDirectory wxTheFontNameDirectory; wxFontNameDirectory *wxTheFontNameDirectory;
// Stock objects // Stock objects
wxFont *wxNORMAL_FONT; wxFont *wxNORMAL_FONT;
@@ -398,7 +398,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxToolBar95, wxToolBarBase)
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow) IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow)
BEGIN_EVENT_TABLE(wxStatusBar, wxWindow) BEGIN_EVENT_TABLE(wxStatusBar, wxWindow)
EVT_PAINT(wxStatusBar::OnPaint) EVT_PAINT(wxStatusBar::OnPaint)
EVT_SYS_COLOUR_CHANGED(wxStatusBar::OnSysColourChanged) EVT_SYS_COLOUR_CHANGED(wxStatusBar::OnSysColourChanged)
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -548,17 +548,16 @@ IMPLEMENT_DYNAMIC_CLASS(wxGenericGrid, wxPanel)
const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; } const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; }
const wxEventTable wxEvtHandler::sm_eventTable = const wxEventTable wxEvtHandler::sm_eventTable =
{ NULL, &wxEvtHandler::sm_eventTableEntries[0] }; { NULL, &wxEvtHandler::sm_eventTableEntries[0] };
const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, NULL } }; const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, NULL } };
BEGIN_EVENT_TABLE(wxFrame, wxWindow) BEGIN_EVENT_TABLE(wxFrame, wxWindow)
EVT_ACTIVATE(wxFrame::OnActivate) EVT_SIZE(wxFrame::OnSize)
EVT_SIZE(wxFrame::OnSize) EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight) EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) EVT_IDLE(wxFrame::OnIdle)
EVT_IDLE(wxFrame::OnIdle) EVT_CLOSE(wxFrame::OnCloseWindow)
EVT_CLOSE(wxFrame::OnCloseWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxDialog, wxPanel) BEGIN_EVENT_TABLE(wxDialog, wxPanel)
@@ -589,9 +588,9 @@ BEGIN_EVENT_TABLE(wxPanel, wxWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
EVT_CHAR(wxTextCtrl::OnChar) EVT_CHAR(wxTextCtrl::OnChar)
EVT_DROP_FILES(wxTextCtrl::OnDropFiles) EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground) EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
END_EVENT_TABLE() END_EVENT_TABLE()
#ifdef wx_msw #ifdef wx_msw
@@ -613,32 +612,32 @@ BEGIN_EVENT_TABLE(wxToolBarBase, wxControl)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxToolBarSimple, wxToolBarBase) BEGIN_EVENT_TABLE(wxToolBarSimple, wxToolBarBase)
EVT_SIZE(wxToolBarSimple::OnSize) EVT_SIZE(wxToolBarSimple::OnSize)
EVT_PAINT(wxToolBarSimple::OnPaint) EVT_PAINT(wxToolBarSimple::OnPaint)
EVT_KILL_FOCUS(wxToolBarSimple::OnKillFocus) EVT_KILL_FOCUS(wxToolBarSimple::OnKillFocus)
EVT_MOUSE_EVENTS(wxToolBarSimple::OnMouseEvent) EVT_MOUSE_EVENTS(wxToolBarSimple::OnMouseEvent)
END_EVENT_TABLE() END_EVENT_TABLE()
#ifdef wx_msw #ifdef wx_msw
BEGIN_EVENT_TABLE(wxToolBarMSW, wxToolBarBase) BEGIN_EVENT_TABLE(wxToolBarMSW, wxToolBarBase)
EVT_SIZE(wxToolBarMSW::OnSize) EVT_SIZE(wxToolBarMSW::OnSize)
EVT_PAINT(wxToolBarMSW::OnPaint) EVT_PAINT(wxToolBarMSW::OnPaint)
EVT_MOUSE_EVENTS(wxToolBarMSW::OnMouseEvent) EVT_MOUSE_EVENTS(wxToolBarMSW::OnMouseEvent)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase) BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase)
EVT_SIZE(wxToolBar95::OnSize) EVT_SIZE(wxToolBar95::OnSize)
EVT_PAINT(wxToolBar95::OnPaint) EVT_PAINT(wxToolBar95::OnPaint)
EVT_KILL_FOCUS(wxToolBar95::OnKillFocus) EVT_KILL_FOCUS(wxToolBar95::OnKillFocus)
EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent) EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent)
EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged) EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged)
END_EVENT_TABLE() END_EVENT_TABLE()
#endif #endif
BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel) BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel)
EVT_SIZE(wxGenericGrid::OnSize) EVT_SIZE(wxGenericGrid::OnSize)
EVT_PAINT(wxGenericGrid::OnPaint) EVT_PAINT(wxGenericGrid::OnPaint)
EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent) EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent)
EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText) EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText)
EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll) EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll)
EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll) EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll)
@@ -650,28 +649,28 @@ END_EVENT_TABLE()
#if !defined(wx_msw) || USE_GENERIC_DIALOGS_IN_MSW #if !defined(wx_msw) || USE_GENERIC_DIALOGS_IN_MSW
BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog) BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog)
EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes) EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes)
EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo) EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo)
EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel) EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog) BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog)
EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom) EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom)
EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider) EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider)
EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider) EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider)
EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider) EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider)
EVT_PAINT(wxGenericColourDialog::OnPaint) EVT_PAINT(wxGenericColourDialog::OnPaint)
EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent) EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog) BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog)
EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont) EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_FAMILY, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_FAMILY, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont)
EVT_PAINT(wxGenericFontDialog::OnPaint) EVT_PAINT(wxGenericFontDialog::OnPaint)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog) BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog)
@@ -683,25 +682,25 @@ END_EVENT_TABLE()
#endif #endif
BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog) BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK) EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog) BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK) EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK)
END_EVENT_TABLE() END_EVENT_TABLE()
#include "wx/prntbase.h" #include "wx/prntbase.h"
BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog) BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog)
EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel) EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxPreviewControlBar, wxWindow) BEGIN_EVENT_TABLE(wxPreviewControlBar, wxWindow)
EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose) EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose)
EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint) EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint)
EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious) EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious)
EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext) EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext)
EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom) EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom)
END_EVENT_TABLE() END_EVENT_TABLE()
#endif #endif

View File

@@ -5,7 +5,7 @@
// Created: 01/02/97 // Created: 01/02/97
// Id: // Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -49,7 +49,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxDialog)
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
const wxString& defaultDir, const wxString& defaultFileName, const wxString& defaultDir, const wxString& defaultFileName,
const wxString& wildCard, const wxString& wildCard,
long style, const wxPoint& pos ) long style, const wxPoint& pos )
{ {
m_needParent = FALSE; m_needParent = FALSE;
@@ -102,34 +102,34 @@ char *wxFileSelector(const char *title,
const char *defaultExtension, const char *filter, int flags, const char *defaultExtension, const char *filter, int flags,
wxWindow *parent, int x, int y) wxWindow *parent, int x, int y)
{ {
wxString filter2(""); wxString filter2("");
if ( defaultExtension && !filter ) if ( defaultExtension && !filter )
filter2 = wxString("*.") + wxString(defaultExtension) ; filter2 = wxString("*.") + wxString(defaultExtension) ;
else if ( filter ) else if ( filter )
filter2 = filter; filter2 = filter;
wxString defaultDirString; wxString defaultDirString;
if (defaultDir) if (defaultDir)
defaultDirString = defaultDir; defaultDirString = defaultDir;
else else
defaultDirString = ""; defaultDirString = "";
wxString defaultFilenameString; wxString defaultFilenameString;
if (defaultFileName) if (defaultFileName)
defaultFilenameString = defaultFileName; defaultFilenameString = defaultFileName;
else else
defaultFilenameString = ""; defaultFilenameString = "";
wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString, wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString,
filter2, flags, wxPoint(x, y)); filter2, flags, wxPoint(x, y));
if ( fileDialog.ShowModal() == wxID_OK ) if ( fileDialog.ShowModal() == wxID_OK )
{ {
strcpy(wxBuffer, (const char *)fileDialog.GetPath()); strcpy(wxBuffer, (const char *)fileDialog.GetPath());
return wxBuffer; return wxBuffer;
} }
else else
return NULL; return NULL;
}; };
char* wxLoadFileSelector(const char *what, const char *extension, const char *default_name, char* wxLoadFileSelector(const char *what, const char *extension, const char *default_name,

View File

@@ -31,7 +31,7 @@ static char *wx_font_weight [] = {
"wxDEFAULT", "wxNORMAL", "wxBOLD", "wxLIGHT", "wxDEFAULT", "wxNORMAL", "wxBOLD", "wxLIGHT",
}; };
extern wxFontNameDirectory wxTheFontNameDirectory; extern wxFontNameDirectory *wxTheFontNameDirectory;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxFont // wxFont
@@ -116,13 +116,13 @@ wxFont::wxFont(int PointSize, int FontIdOrFamily, int Style, int Weight,
if ((M_FONTDATA->m_faceName = (Face) ? copystring(Face) : (char*)NULL) ) if ((M_FONTDATA->m_faceName = (Face) ? copystring(Face) : (char*)NULL) )
{ {
M_FONTDATA->m_fontId = wxTheFontNameDirectory.FindOrCreateFontId( Face, FontIdOrFamily ); M_FONTDATA->m_fontId = wxTheFontNameDirectory->FindOrCreateFontId( Face, FontIdOrFamily );
M_FONTDATA->m_family = wxTheFontNameDirectory.GetFamily( FontIdOrFamily ); M_FONTDATA->m_family = wxTheFontNameDirectory->GetFamily( FontIdOrFamily );
} }
else else
{ {
M_FONTDATA->m_fontId = FontIdOrFamily; M_FONTDATA->m_fontId = FontIdOrFamily;
M_FONTDATA->m_family = wxTheFontNameDirectory.GetFamily( FontIdOrFamily ); M_FONTDATA->m_family = wxTheFontNameDirectory->GetFamily( FontIdOrFamily );
}; };
M_FONTDATA->m_style = Style; M_FONTDATA->m_style = Style;
M_FONTDATA->m_weight = Weight; M_FONTDATA->m_weight = Weight;
@@ -137,9 +137,9 @@ wxFont::wxFont(int PointSize, const char *Face, int Family, int Style,
{ {
m_refData = new wxFontRefData(); m_refData = new wxFontRefData();
M_FONTDATA->m_fontId = wxTheFontNameDirectory.FindOrCreateFontId( Face, Family ); M_FONTDATA->m_fontId = wxTheFontNameDirectory->FindOrCreateFontId( Face, Family );
M_FONTDATA->m_faceName = (Face) ? copystring(Face) : (char*)NULL; M_FONTDATA->m_faceName = (Face) ? copystring(Face) : (char*)NULL;
M_FONTDATA->m_family = wxTheFontNameDirectory.GetFamily( M_FONTDATA->m_fontId ); M_FONTDATA->m_family = wxTheFontNameDirectory->GetFamily( M_FONTDATA->m_fontId );
M_FONTDATA->m_style = Style; M_FONTDATA->m_style = Style;
M_FONTDATA->m_weight = Weight; M_FONTDATA->m_weight = Weight;
M_FONTDATA->m_pointSize = PointSize; M_FONTDATA->m_pointSize = PointSize;
@@ -193,13 +193,13 @@ int wxFont::GetPointSize(void) const
wxString wxFont::GetFaceString(void) const wxString wxFont::GetFaceString(void) const
{ {
wxString s = wxTheFontNameDirectory.GetFontName( M_FONTDATA->m_fontId ); wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s; return s;
}; };
wxString wxFont::GetFaceName(void) const wxString wxFont::GetFaceName(void) const
{ {
wxString s = wxTheFontNameDirectory.GetFontName( M_FONTDATA->m_fontId ); wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s; return s;
}; };
@@ -288,7 +288,7 @@ static GdkFont *wxLoadQueryFont(int point_size, int fontid, int style,
int weight, bool WXUNUSED(underlined)) int weight, bool WXUNUSED(underlined))
{ {
char buffer[512]; char buffer[512];
char *name = wxTheFontNameDirectory.GetScreenName( fontid, weight, style ); char *name = wxTheFontNameDirectory->GetScreenName( fontid, weight, style );
if (!name) if (!name)
name = "-*-*-*-*-*-*-*-%d-*-*-*-*-*-*"; name = "-*-*-*-*-*-*-*-%d-*-*-*-*-*-*";
@@ -698,7 +698,6 @@ wxFontNameDirectory::wxFontNameDirectory(void)
{ {
table = new wxHashTable(wxKEY_INTEGER, 20); table = new wxHashTable(wxKEY_INTEGER, 20);
nextFontId = -1; nextFontId = -1;
Initialize();
} }
wxFontNameDirectory::~wxFontNameDirectory() wxFontNameDirectory::~wxFontNameDirectory()

View File

@@ -5,7 +5,7 @@
// Created: 01/02/97 // Created: 01/02/97
// Id: // Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -51,6 +51,7 @@ static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox
} }
event.SetEventObject( listbox ); event.SetEventObject( listbox );
listbox->GetEventHandler()->ProcessEvent( event ); listbox->GetEventHandler()->ProcessEvent( event );
if (event.m_commandString) delete[] event.m_commandString ; if (event.m_commandString) delete[] event.m_commandString ;
}; };

View File

@@ -5,7 +5,7 @@
// Created: 01/02/97 // Created: 01/02/97
// Id: // Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__

View File

@@ -205,31 +205,38 @@ wxString wxRadioBox::GetLabel(void) const
void wxRadioBox::SetLabel( const wxString& WXUNUSED(label) ) void wxRadioBox::SetLabel( const wxString& WXUNUSED(label) )
{ {
wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
}; };
void wxRadioBox::SetLabel( int WXUNUSED(item), const wxString& WXUNUSED(label) ) void wxRadioBox::SetLabel( int WXUNUSED(item), const wxString& WXUNUSED(label) )
{ {
wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
}; };
void wxRadioBox::SetLabel( int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap) ) void wxRadioBox::SetLabel( int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap) )
{ {
wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
}; };
wxString wxRadioBox::GetLabel( int WXUNUSED(item) ) const wxString wxRadioBox::GetLabel( int WXUNUSED(item) ) const
{ {
wxFAIL_MSG("wxRadioBox::GetLabel not implemented.");
return ""; return "";
}; };
void wxRadioBox::Enable( bool WXUNUSED(enable) ) void wxRadioBox::Enable( bool WXUNUSED(enable) )
{ {
wxFAIL_MSG("wxRadioBox::Enable not implemented.");
}; };
void wxRadioBox::Enable( int WXUNUSED(item), bool WXUNUSED(enable) ) void wxRadioBox::Enable( int WXUNUSED(item), bool WXUNUSED(enable) )
{ {
wxFAIL_MSG("wxRadioBox::Enable not implemented.");
}; };
void wxRadioBox::Show( int WXUNUSED(item), bool WXUNUSED(show) ) void wxRadioBox::Show( int WXUNUSED(item), bool WXUNUSED(show) )
{ {
wxFAIL_MSG("wxRadioBox::Show not implemented.");
}; };
wxString wxRadioBox::GetStringSelection(void) const wxString wxRadioBox::GetStringSelection(void) const
@@ -275,5 +282,6 @@ int wxRadioBox::GetNumberOfRowsOrCols(void) const
void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) ) void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
{ {
wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented.");
}; };

View File

@@ -58,6 +58,16 @@ wxColour *g_systemBtnShadowColour = NULL;
wxColour *g_systemBtnHighlightColour = NULL; wxColour *g_systemBtnHighlightColour = NULL;
wxColour *g_systemHighlightColour = NULL; wxColour *g_systemHighlightColour = NULL;
wxFont *g_systemFont = NULL;
void wxSystemSettings::Done() {
wxDELETE(g_systemBtnFaceColour);
wxDELETE(g_systemBtnShadowColour);
wxDELETE(g_systemBtnHighlightColour);
wxDELETE(g_systemHighlightColour);
wxDELETE(g_systemFont);
}
wxColour wxSystemSettings::GetSystemColour( int index ) wxColour wxSystemSettings::GetSystemColour( int index )
{ {
switch (index) switch (index)
@@ -141,8 +151,6 @@ wxColour wxSystemSettings::GetSystemColour( int index )
return *wxWHITE; return *wxWHITE;
}; };
wxFont *g_systemFont = NULL;
wxFont wxSystemSettings::GetSystemFont( int index ) wxFont wxSystemSettings::GetSystemFont( int index )
{ {
switch (index) switch (index)

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97 // Created: 01/02/97
// RCS-ID: // RCS-ID:
// Copyright: (c) Robert Roebling // Copyright: (c) Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -40,7 +40,7 @@ wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
m_deleteSecondBitmap = FALSE; m_deleteSecondBitmap = FALSE;
}; };
wxToolBarTool::~wxToolBarTool(void) wxToolBarTool::~wxToolBarTool()
{ {
}; };
@@ -64,7 +64,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxToolBar,wxControl)
BEGIN_EVENT_TABLE(wxToolBar, wxControl) BEGIN_EVENT_TABLE(wxToolBar, wxControl)
END_EVENT_TABLE() END_EVENT_TABLE()
wxToolBar::wxToolBar(void) wxToolBar::wxToolBar()
{ {
}; };
@@ -75,7 +75,7 @@ wxToolBar::wxToolBar( wxWindow *parent, wxWindowID id,
Create( parent, id, pos, size, style, name ); Create( parent, id, pos, size, style, name );
}; };
wxToolBar::~wxToolBar(void) wxToolBar::~wxToolBar()
{ {
}; };

View File

@@ -5,7 +5,7 @@
// Created: 01/02/97 // Created: 01/02/97
// Id: // Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -31,6 +31,7 @@
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/Xresource.h> #include <X11/Xresource.h>
#include "wx/log.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// constants // constants
@@ -48,7 +49,7 @@
// glabal data (data.cpp) // glabal data (data.cpp)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
extern wxList wxResourceCache; extern wxResourceCache *wxTheResourceCache;
extern XrmDatabase wxResourceDatabase; extern XrmDatabase wxResourceDatabase;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -58,21 +59,21 @@ extern XrmDatabase wxResourceDatabase;
static char *GetResourcePath(char *buf, char *name, bool create) static char *GetResourcePath(char *buf, char *name, bool create)
{ {
if (create && FileExists(name)) { if (create && FileExists(name)) {
strcpy(buf, name); strcpy(buf, name);
return buf; // Exists so ... return buf; // Exists so ...
} }
if (*name == '/') if (*name == '/')
strcpy(buf, name); strcpy(buf, name);
else { else {
// Put in standard place for resource files if not absolute // Put in standard place for resource files if not absolute
strcpy(buf, DEFAULT_XRESOURCE_DIR); strcpy(buf, DEFAULT_XRESOURCE_DIR);
strcat(buf, "/"); strcat(buf, "/");
strcat(buf, FileNameFromPath(name)); strcat(buf, FileNameFromPath(name));
} }
if (create) { if (create) {
// Touch the file to create it // Touch the file to create it
FILE *fd = fopen(buf, "w"); FILE *fd = fopen(buf, "w");
if (fd) fclose(fd); if (fd) fclose(fd);
} }
return buf; return buf;
} }
@@ -91,15 +92,15 @@ static char *GetIniFile(char *dest, const char *filename)
{ {
if ((home = wxGetUserHome(wxString())) != NULL) if ((home = wxGetUserHome(wxString())) != NULL)
{ {
strcpy(dest, home); strcpy(dest, home);
if (dest[strlen(dest) - 1] != '/') strcat(dest, "/"); if (dest[strlen(dest) - 1] != '/') strcat(dest, "/");
if (filename == NULL) if (filename == NULL)
{ {
if ((filename = getenv("XENVIRONMENT")) == NULL) filename = ".Xdefaults"; if ((filename = getenv("XENVIRONMENT")) == NULL) filename = ".Xdefaults";
} }
else else
if (*filename != '.') strcat(dest, "."); if (*filename != '.') strcat(dest, ".");
strcat(dest, filename); strcat(dest, filename);
} }
else else
{ {
@@ -123,36 +124,36 @@ static void wxXMergeDatabases(void)
// Get application defaults file, if any // Get application defaults file, if any
if ((applicationDB = XrmGetFileDatabase(name))) if ((applicationDB = XrmGetFileDatabase(name)))
(void)XrmMergeDatabases(applicationDB, &wxResourceDatabase); (void)XrmMergeDatabases(applicationDB, &wxResourceDatabase);
// Merge server defaults, created by xrdb, loaded as a property of the root // Merge server defaults, created by xrdb, loaded as a property of the root
// window when the server initializes and loaded into the display // window when the server initializes and loaded into the display
// structure on XOpenDisplay; // structure on XOpenDisplay;
// if not defined, use .Xdefaults // if not defined, use .Xdefaults
if (XResourceManagerString(GDK_DISPLAY()) != NULL) { if (XResourceManagerString(GDK_DISPLAY()) != NULL) {
serverDB = XrmGetStringDatabase(XResourceManagerString(GDK_DISPLAY())); serverDB = XrmGetStringDatabase(XResourceManagerString(GDK_DISPLAY()));
} else { } else {
(void)GetIniFile(filename, NULL); (void)GetIniFile(filename, NULL);
serverDB = XrmGetFileDatabase(filename); serverDB = XrmGetFileDatabase(filename);
} }
if (serverDB) if (serverDB)
XrmMergeDatabases(serverDB, &wxResourceDatabase); XrmMergeDatabases(serverDB, &wxResourceDatabase);
// Open XENVIRONMENT file, or if not defined, the .Xdefaults, // Open XENVIRONMENT file, or if not defined, the .Xdefaults,
// and merge into existing database // and merge into existing database
if ((environment = getenv("XENVIRONMENT")) == NULL) { if ((environment = getenv("XENVIRONMENT")) == NULL) {
size_t len; size_t len;
environment = GetIniFile(filename, NULL); environment = GetIniFile(filename, NULL);
len = strlen(environment); len = strlen(environment);
#if !defined(SVR4) || defined(__sgi) #if !defined(SVR4) || defined(__sgi)
(void)gethostname(environment + len, 1024 - len); (void)gethostname(environment + len, 1024 - len);
#else #else
(void)sysinfo(SI_HOSTNAME, environment + len, 1024 - len); (void)sysinfo(SI_HOSTNAME, environment + len, 1024 - len);
#endif #endif
} }
if ((homeDB = XrmGetFileDatabase(environment))) if ((homeDB = XrmGetFileDatabase(environment)))
XrmMergeDatabases(homeDB, &wxResourceDatabase); XrmMergeDatabases(homeDB, &wxResourceDatabase);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -163,31 +164,32 @@ void wxFlushResources(void)
{ {
char nameBuffer[512]; char nameBuffer[512];
wxNode *node = wxResourceCache.First(); wxNode *node = wxTheResourceCache->First();
while (node) { while (node) {
char *file = node->key.string; char *file = node->key.string;
// If file doesn't exist, create it first. // If file doesn't exist, create it first.
(void)GetResourcePath(nameBuffer, file, TRUE); (void)GetResourcePath(nameBuffer, file, TRUE);
XrmDatabase database = (XrmDatabase)node->Data(); XrmDatabase database = (XrmDatabase)node->Data();
XrmPutFileDatabase(database, nameBuffer); XrmPutFileDatabase(database, nameBuffer);
XrmDestroyDatabase(database); XrmDestroyDatabase(database);
wxNode *next = node->Next(); wxNode *next = node->Next();
delete node; // delete node;
node = next; node = next;
} }
} }
void wxDeleteResources(const char *file) void wxDeleteResources(const char *file)
{ {
wxLogTrace(wxTraceResAlloc, "Delete: Number = %d", wxTheResourceCache->Number());
char buffer[500]; char buffer[500];
(void)GetIniFile(buffer, file); (void)GetIniFile(buffer, file);
wxNode *node = wxResourceCache.Find(buffer); wxNode *node = wxTheResourceCache->Find(buffer);
if (node) { if (node) {
XrmDatabase database = (XrmDatabase)node->Data(); XrmDatabase database = (XrmDatabase)node->Data();
XrmDestroyDatabase(database); XrmDestroyDatabase(database);
delete node; // delete node;
} }
} }
@@ -204,12 +206,13 @@ bool wxWriteResource(const wxString& section, const wxString& entry, const wxStr
(void)GetIniFile(buffer, file); (void)GetIniFile(buffer, file);
XrmDatabase database; XrmDatabase database;
wxNode *node = wxResourceCache.Find(buffer); wxNode *node = wxTheResourceCache->Find(buffer);
if (node) if (node)
database = (XrmDatabase)node->Data(); database = (XrmDatabase)node->Data();
else { else {
database = XrmGetFileDatabase(buffer); database = XrmGetFileDatabase(buffer);
wxResourceCache.Append(buffer, (wxObject *)database); wxLogTrace(wxTraceResAlloc, "Write: Number = %d", wxTheResourceCache->Number());
wxTheResourceCache->Append(buffer, (wxObject *)database);
} }
char resName[300]; char resName[300];
strcpy(resName, !section.IsNull() ? WXSTRINGCAST section : "wxWindows"); strcpy(resName, !section.IsNull() ? WXSTRINGCAST section : "wxWindows");
@@ -243,24 +246,25 @@ bool wxWriteResource(const wxString& section, const wxString& entry, int value,
bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file ) bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file )
{ {
if (!wxResourceDatabase) if (!wxResourceDatabase)
wxXMergeDatabases(); wxXMergeDatabases();
XrmDatabase database; XrmDatabase database;
if (file) { if (file) {
char buffer[500]; char buffer[500];
// Is this right? Trying to get it to look in the user's // Is this right? Trying to get it to look in the user's
// home directory instead of current directory -- JACS // home directory instead of current directory -- JACS
(void)GetIniFile(buffer, file); (void)GetIniFile(buffer, file);
wxNode *node = wxResourceCache.Find(buffer); wxNode *node = wxTheResourceCache->Find(buffer);
if (node) if (node)
database = (XrmDatabase)node->Data(); database = (XrmDatabase)node->Data();
else { else {
database = XrmGetFileDatabase(buffer); database = XrmGetFileDatabase(buffer);
wxResourceCache.Append(buffer, (wxObject *)database); wxLogTrace(wxTraceResAlloc, "Get: Number = %d", wxTheResourceCache->Number());
} wxTheResourceCache->Append(buffer, (wxObject *)database);
}
} else } else
database = wxResourceDatabase; database = wxResourceDatabase;
XrmValue xvalue; XrmValue xvalue;
char *str_type[20]; char *str_type[20];
@@ -272,15 +276,15 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value,
bool success = XrmGetResource(database, buf, "*", str_type, &xvalue); bool success = XrmGetResource(database, buf, "*", str_type, &xvalue);
// Try different combinations of upper/lower case, just in case... // Try different combinations of upper/lower case, just in case...
if (!success) { if (!success) {
buf[0] = (isupper(buf[0]) ? tolower(buf[0]) : toupper(buf[0])); buf[0] = (isupper(buf[0]) ? tolower(buf[0]) : toupper(buf[0]));
success = XrmGetResource(database, buf, "*", str_type, &xvalue); success = XrmGetResource(database, buf, "*", str_type, &xvalue);
} }
if (success) { if (success) {
if (*value) if (*value)
delete[] *value; delete[] *value;
*value = new char[xvalue.size + 1]; *value = new char[xvalue.size + 1];
strncpy(*value, xvalue.addr, (int)xvalue.size); strncpy(*value, xvalue.addr, (int)xvalue.size);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
}; };
@@ -290,11 +294,11 @@ bool wxGetResource(const wxString& section, const wxString& entry, float *value,
char *s = NULL; char *s = NULL;
bool succ = wxGetResource(section, entry, &s, file); bool succ = wxGetResource(section, entry, &s, file);
if (succ) { if (succ) {
*value = (float)strtod(s, NULL); *value = (float)strtod(s, NULL);
delete[]s; delete[]s;
return TRUE; return TRUE;
} else } else
return FALSE; return FALSE;
}; };
bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file ) bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file )
@@ -302,11 +306,11 @@ bool wxGetResource(const wxString& section, const wxString& entry, long *value,
char *s = NULL; char *s = NULL;
bool succ = wxGetResource(section, entry, &s, file); bool succ = wxGetResource(section, entry, &s, file);
if (succ) { if (succ) {
*value = strtol(s, NULL, 10); *value = strtol(s, NULL, 10);
delete[]s; delete[]s;
return TRUE; return TRUE;
} else } else
return FALSE; return FALSE;
}; };
bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file ) bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file )
@@ -314,19 +318,19 @@ bool wxGetResource(const wxString& section, const wxString& entry, int *value, c
char *s = NULL; char *s = NULL;
bool succ = wxGetResource(section, entry, &s, file); bool succ = wxGetResource(section, entry, &s, file);
if (succ) { if (succ) {
// Handle True, False here // Handle True, False here
// True, Yes, Enables, Set or Activated // True, Yes, Enables, Set or Activated
if (*s == 'T' || *s == 'Y' || *s == 'E' || *s == 'S' || *s == 'A') if (*s == 'T' || *s == 'Y' || *s == 'E' || *s == 'S' || *s == 'A')
*value = TRUE; *value = TRUE;
// False, No, Disabled, Reset, Cleared, Deactivated // False, No, Disabled, Reset, Cleared, Deactivated
else if (*s == 'F' || *s == 'N' || *s == 'D' || *s == 'R' || *s == 'C') else if (*s == 'F' || *s == 'N' || *s == 'D' || *s == 'R' || *s == 'C')
*value = FALSE; *value = FALSE;
// Handle as Integer // Handle as Integer
else else
*value = (int)strtol(s, NULL, 10); *value = (int)strtol(s, NULL, 10);
delete[]s; delete[]s;
return TRUE; return TRUE;
} else } else
return FALSE; return FALSE;
}; };

View File

@@ -753,6 +753,7 @@ wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxString &name )
{ {
m_cursor = NULL;
Create( parent, id, pos, size, style, name ); Create( parent, id, pos, size, style, name );
}; };
@@ -864,7 +865,7 @@ wxWindow::~wxWindow(void)
if (m_widget) gtk_widget_destroy( m_widget ); if (m_widget) gtk_widget_destroy( m_widget );
// delete m_cursor; wxDELETE(m_cursor);
DeleteRelatedConstraints(); DeleteRelatedConstraints();
if (m_constraints) if (m_constraints)
@@ -918,7 +919,8 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
m_windowValidator = NULL; m_windowValidator = NULL;
m_windowId = id; m_windowId = id;
m_sizeSet = FALSE; m_sizeSet = FALSE;
m_cursor = new wxCursor( wxCURSOR_ARROW ); if (m_cursor == NULL)
m_cursor = new wxCursor( wxCURSOR_ARROW );
m_font = *wxSWISS_FONT; m_font = *wxSWISS_FONT;
m_backgroundColour = wxWHITE; m_backgroundColour = wxWHITE;
m_foregroundColour = wxBLACK; m_foregroundColour = wxBLACK;
@@ -1561,7 +1563,11 @@ wxWindowID wxWindow::GetId(void)
void wxWindow::SetCursor( const wxCursor &cursor ) void wxWindow::SetCursor( const wxCursor &cursor )
{ {
if (*m_cursor == cursor) return; wxASSERT(m_cursor != NULL);
if (m_cursor != NULL)
if (*m_cursor == cursor)
return;
(*m_cursor) = cursor; (*m_cursor) = cursor;
if (m_widget->window) if (m_widget->window)
gdk_window_set_cursor( m_widget->window, m_cursor->GetCursor() ); gdk_window_set_cursor( m_widget->window, m_cursor->GetCursor() );

View File

@@ -19,6 +19,8 @@
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/log.h" #include "wx/log.h"
#include "wx/memory.h" #include "wx/memory.h"
#include "wx/font.h"
#include "wx/settings.h"
#include "unistd.h" #include "unistd.h"
@@ -34,6 +36,7 @@ wxApp *wxTheApp = NULL;
wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL; wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
extern wxList wxPendingDelete; extern wxList wxPendingDelete;
extern wxResourceCache *wxTheResourceCache;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// local functions // local functions
@@ -242,9 +245,16 @@ void wxApp::CommonInit(void)
(void) wxGetResource("wxWindows", "OsVersion", &wxOsVersion); (void) wxGetResource("wxWindows", "OsVersion", &wxOsVersion);
#endif #endif
*/ */
wxSystemSettings::Init();
wxTheResourceCache = new wxResourceCache(wxKEY_STRING);
wxTheFontNameDirectory = new wxFontNameDirectory;
wxTheFontNameDirectory->Initialize();
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING); wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
wxTheColourDatabase->Initialize(); wxTheColourDatabase->Initialize();
wxInitializeStockLists();
wxInitializeStockObjects(); wxInitializeStockObjects();
// For PostScript printing // For PostScript printing
@@ -261,14 +271,24 @@ void wxApp::CommonInit(void)
g_globalCursor = new wxCursor; g_globalCursor = new wxCursor;
*/ */
wxInitializeStockObjects(); // wxInitializeStockObjects();
}; };
void wxApp::CommonCleanUp(void) void wxApp::CommonCleanUp(void)
{ {
wxDELETE(wxTheColourDatabase);
wxDELETE(wxThePrintPaperDatabase);
wxDELETE(wxThePrintSetupData);
wxDELETE(wxTheFontNameDirectory);
wxDeleteStockObjects(); wxDeleteStockObjects();
wxFlushResources(); wxFlushResources();
wxDELETE(wxTheResourceCache);
wxDeleteStockLists();
wxSystemSettings::Done();
}; };
wxLog *wxApp::CreateLogTarget() wxLog *wxApp::CreateLogTarget()
@@ -311,8 +331,6 @@ int wxEntry( int argc, char *argv[] )
wxObject *test_app = app_ini(); wxObject *test_app = app_ini();
wxTheApp = (wxApp*) test_app; wxTheApp = (wxApp*) test_app;
// wxTheApp = (wxApp*)( app_ini() );
}; };
if (!wxTheApp) if (!wxTheApp)
@@ -321,8 +339,6 @@ int wxEntry( int argc, char *argv[] )
return 0; return 0;
}; };
// printf( "Programmstart.\n" );
wxTheApp->argc = argc; wxTheApp->argc = argc;
wxTheApp->argv = argv; wxTheApp->argv = argv;
@@ -360,6 +376,8 @@ int wxEntry( int argc, char *argv[] )
wxApp::CommonCleanUp(); wxApp::CommonCleanUp();
wxDELETE(wxTheApp);
#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT #if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT
// At this point we want to check if there are any memory // At this point we want to check if there are any memory
// blocks that aren't part of the wxDebugContext itself, // blocks that aren't part of the wxDebugContext itself,

View File

@@ -5,7 +5,7 @@
// Created: 01/02/97 // Created: 01/02/97
// Id: // Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -23,7 +23,7 @@
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/Xresource.h> #include <X11/Xresource.h>
wxList wxResourceCache(wxKEY_STRING); wxResourceCache *wxTheResourceCache = NULL;
XrmDatabase wxResourceDatabase; XrmDatabase wxResourceDatabase;
// Useful buffer, initialized in wxCommonInit // Useful buffer, initialized in wxCommonInit
@@ -64,7 +64,7 @@ wxBitmapList *wxTheBitmapList = NULL;
// X only font names // X only font names
wxFontNameDirectory wxTheFontNameDirectory; wxFontNameDirectory *wxTheFontNameDirectory;
// Stock objects // Stock objects
wxFont *wxNORMAL_FONT; wxFont *wxNORMAL_FONT;
@@ -398,7 +398,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxToolBar95, wxToolBarBase)
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow) IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow)
BEGIN_EVENT_TABLE(wxStatusBar, wxWindow) BEGIN_EVENT_TABLE(wxStatusBar, wxWindow)
EVT_PAINT(wxStatusBar::OnPaint) EVT_PAINT(wxStatusBar::OnPaint)
EVT_SYS_COLOUR_CHANGED(wxStatusBar::OnSysColourChanged) EVT_SYS_COLOUR_CHANGED(wxStatusBar::OnSysColourChanged)
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -548,17 +548,16 @@ IMPLEMENT_DYNAMIC_CLASS(wxGenericGrid, wxPanel)
const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; } const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; }
const wxEventTable wxEvtHandler::sm_eventTable = const wxEventTable wxEvtHandler::sm_eventTable =
{ NULL, &wxEvtHandler::sm_eventTableEntries[0] }; { NULL, &wxEvtHandler::sm_eventTableEntries[0] };
const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, NULL } }; const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, NULL } };
BEGIN_EVENT_TABLE(wxFrame, wxWindow) BEGIN_EVENT_TABLE(wxFrame, wxWindow)
EVT_ACTIVATE(wxFrame::OnActivate) EVT_SIZE(wxFrame::OnSize)
EVT_SIZE(wxFrame::OnSize) EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight) EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) EVT_IDLE(wxFrame::OnIdle)
EVT_IDLE(wxFrame::OnIdle) EVT_CLOSE(wxFrame::OnCloseWindow)
EVT_CLOSE(wxFrame::OnCloseWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxDialog, wxPanel) BEGIN_EVENT_TABLE(wxDialog, wxPanel)
@@ -589,9 +588,9 @@ BEGIN_EVENT_TABLE(wxPanel, wxWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
EVT_CHAR(wxTextCtrl::OnChar) EVT_CHAR(wxTextCtrl::OnChar)
EVT_DROP_FILES(wxTextCtrl::OnDropFiles) EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground) EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
END_EVENT_TABLE() END_EVENT_TABLE()
#ifdef wx_msw #ifdef wx_msw
@@ -613,32 +612,32 @@ BEGIN_EVENT_TABLE(wxToolBarBase, wxControl)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxToolBarSimple, wxToolBarBase) BEGIN_EVENT_TABLE(wxToolBarSimple, wxToolBarBase)
EVT_SIZE(wxToolBarSimple::OnSize) EVT_SIZE(wxToolBarSimple::OnSize)
EVT_PAINT(wxToolBarSimple::OnPaint) EVT_PAINT(wxToolBarSimple::OnPaint)
EVT_KILL_FOCUS(wxToolBarSimple::OnKillFocus) EVT_KILL_FOCUS(wxToolBarSimple::OnKillFocus)
EVT_MOUSE_EVENTS(wxToolBarSimple::OnMouseEvent) EVT_MOUSE_EVENTS(wxToolBarSimple::OnMouseEvent)
END_EVENT_TABLE() END_EVENT_TABLE()
#ifdef wx_msw #ifdef wx_msw
BEGIN_EVENT_TABLE(wxToolBarMSW, wxToolBarBase) BEGIN_EVENT_TABLE(wxToolBarMSW, wxToolBarBase)
EVT_SIZE(wxToolBarMSW::OnSize) EVT_SIZE(wxToolBarMSW::OnSize)
EVT_PAINT(wxToolBarMSW::OnPaint) EVT_PAINT(wxToolBarMSW::OnPaint)
EVT_MOUSE_EVENTS(wxToolBarMSW::OnMouseEvent) EVT_MOUSE_EVENTS(wxToolBarMSW::OnMouseEvent)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase) BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase)
EVT_SIZE(wxToolBar95::OnSize) EVT_SIZE(wxToolBar95::OnSize)
EVT_PAINT(wxToolBar95::OnPaint) EVT_PAINT(wxToolBar95::OnPaint)
EVT_KILL_FOCUS(wxToolBar95::OnKillFocus) EVT_KILL_FOCUS(wxToolBar95::OnKillFocus)
EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent) EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent)
EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged) EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged)
END_EVENT_TABLE() END_EVENT_TABLE()
#endif #endif
BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel) BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel)
EVT_SIZE(wxGenericGrid::OnSize) EVT_SIZE(wxGenericGrid::OnSize)
EVT_PAINT(wxGenericGrid::OnPaint) EVT_PAINT(wxGenericGrid::OnPaint)
EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent) EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent)
EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText) EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText)
EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll) EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll)
EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll) EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll)
@@ -650,28 +649,28 @@ END_EVENT_TABLE()
#if !defined(wx_msw) || USE_GENERIC_DIALOGS_IN_MSW #if !defined(wx_msw) || USE_GENERIC_DIALOGS_IN_MSW
BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog) BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog)
EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes) EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes)
EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo) EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo)
EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel) EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog) BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog)
EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom) EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom)
EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider) EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider)
EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider) EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider)
EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider) EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider)
EVT_PAINT(wxGenericColourDialog::OnPaint) EVT_PAINT(wxGenericColourDialog::OnPaint)
EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent) EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog) BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog)
EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont) EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_FAMILY, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_FAMILY, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont)
EVT_PAINT(wxGenericFontDialog::OnPaint) EVT_PAINT(wxGenericFontDialog::OnPaint)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog) BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog)
@@ -683,25 +682,25 @@ END_EVENT_TABLE()
#endif #endif
BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog) BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK) EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog) BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK) EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK)
END_EVENT_TABLE() END_EVENT_TABLE()
#include "wx/prntbase.h" #include "wx/prntbase.h"
BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog) BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog)
EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel) EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxPreviewControlBar, wxWindow) BEGIN_EVENT_TABLE(wxPreviewControlBar, wxWindow)
EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose) EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose)
EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint) EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint)
EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious) EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious)
EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext) EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext)
EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom) EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom)
END_EVENT_TABLE() END_EVENT_TABLE()
#endif #endif

View File

@@ -5,7 +5,7 @@
// Created: 01/02/97 // Created: 01/02/97
// Id: // Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -49,7 +49,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxDialog)
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
const wxString& defaultDir, const wxString& defaultFileName, const wxString& defaultDir, const wxString& defaultFileName,
const wxString& wildCard, const wxString& wildCard,
long style, const wxPoint& pos ) long style, const wxPoint& pos )
{ {
m_needParent = FALSE; m_needParent = FALSE;
@@ -102,34 +102,34 @@ char *wxFileSelector(const char *title,
const char *defaultExtension, const char *filter, int flags, const char *defaultExtension, const char *filter, int flags,
wxWindow *parent, int x, int y) wxWindow *parent, int x, int y)
{ {
wxString filter2(""); wxString filter2("");
if ( defaultExtension && !filter ) if ( defaultExtension && !filter )
filter2 = wxString("*.") + wxString(defaultExtension) ; filter2 = wxString("*.") + wxString(defaultExtension) ;
else if ( filter ) else if ( filter )
filter2 = filter; filter2 = filter;
wxString defaultDirString; wxString defaultDirString;
if (defaultDir) if (defaultDir)
defaultDirString = defaultDir; defaultDirString = defaultDir;
else else
defaultDirString = ""; defaultDirString = "";
wxString defaultFilenameString; wxString defaultFilenameString;
if (defaultFileName) if (defaultFileName)
defaultFilenameString = defaultFileName; defaultFilenameString = defaultFileName;
else else
defaultFilenameString = ""; defaultFilenameString = "";
wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString, wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString,
filter2, flags, wxPoint(x, y)); filter2, flags, wxPoint(x, y));
if ( fileDialog.ShowModal() == wxID_OK ) if ( fileDialog.ShowModal() == wxID_OK )
{ {
strcpy(wxBuffer, (const char *)fileDialog.GetPath()); strcpy(wxBuffer, (const char *)fileDialog.GetPath());
return wxBuffer; return wxBuffer;
} }
else else
return NULL; return NULL;
}; };
char* wxLoadFileSelector(const char *what, const char *extension, const char *default_name, char* wxLoadFileSelector(const char *what, const char *extension, const char *default_name,

View File

@@ -31,7 +31,7 @@ static char *wx_font_weight [] = {
"wxDEFAULT", "wxNORMAL", "wxBOLD", "wxLIGHT", "wxDEFAULT", "wxNORMAL", "wxBOLD", "wxLIGHT",
}; };
extern wxFontNameDirectory wxTheFontNameDirectory; extern wxFontNameDirectory *wxTheFontNameDirectory;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxFont // wxFont
@@ -116,13 +116,13 @@ wxFont::wxFont(int PointSize, int FontIdOrFamily, int Style, int Weight,
if ((M_FONTDATA->m_faceName = (Face) ? copystring(Face) : (char*)NULL) ) if ((M_FONTDATA->m_faceName = (Face) ? copystring(Face) : (char*)NULL) )
{ {
M_FONTDATA->m_fontId = wxTheFontNameDirectory.FindOrCreateFontId( Face, FontIdOrFamily ); M_FONTDATA->m_fontId = wxTheFontNameDirectory->FindOrCreateFontId( Face, FontIdOrFamily );
M_FONTDATA->m_family = wxTheFontNameDirectory.GetFamily( FontIdOrFamily ); M_FONTDATA->m_family = wxTheFontNameDirectory->GetFamily( FontIdOrFamily );
} }
else else
{ {
M_FONTDATA->m_fontId = FontIdOrFamily; M_FONTDATA->m_fontId = FontIdOrFamily;
M_FONTDATA->m_family = wxTheFontNameDirectory.GetFamily( FontIdOrFamily ); M_FONTDATA->m_family = wxTheFontNameDirectory->GetFamily( FontIdOrFamily );
}; };
M_FONTDATA->m_style = Style; M_FONTDATA->m_style = Style;
M_FONTDATA->m_weight = Weight; M_FONTDATA->m_weight = Weight;
@@ -137,9 +137,9 @@ wxFont::wxFont(int PointSize, const char *Face, int Family, int Style,
{ {
m_refData = new wxFontRefData(); m_refData = new wxFontRefData();
M_FONTDATA->m_fontId = wxTheFontNameDirectory.FindOrCreateFontId( Face, Family ); M_FONTDATA->m_fontId = wxTheFontNameDirectory->FindOrCreateFontId( Face, Family );
M_FONTDATA->m_faceName = (Face) ? copystring(Face) : (char*)NULL; M_FONTDATA->m_faceName = (Face) ? copystring(Face) : (char*)NULL;
M_FONTDATA->m_family = wxTheFontNameDirectory.GetFamily( M_FONTDATA->m_fontId ); M_FONTDATA->m_family = wxTheFontNameDirectory->GetFamily( M_FONTDATA->m_fontId );
M_FONTDATA->m_style = Style; M_FONTDATA->m_style = Style;
M_FONTDATA->m_weight = Weight; M_FONTDATA->m_weight = Weight;
M_FONTDATA->m_pointSize = PointSize; M_FONTDATA->m_pointSize = PointSize;
@@ -193,13 +193,13 @@ int wxFont::GetPointSize(void) const
wxString wxFont::GetFaceString(void) const wxString wxFont::GetFaceString(void) const
{ {
wxString s = wxTheFontNameDirectory.GetFontName( M_FONTDATA->m_fontId ); wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s; return s;
}; };
wxString wxFont::GetFaceName(void) const wxString wxFont::GetFaceName(void) const
{ {
wxString s = wxTheFontNameDirectory.GetFontName( M_FONTDATA->m_fontId ); wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s; return s;
}; };
@@ -288,7 +288,7 @@ static GdkFont *wxLoadQueryFont(int point_size, int fontid, int style,
int weight, bool WXUNUSED(underlined)) int weight, bool WXUNUSED(underlined))
{ {
char buffer[512]; char buffer[512];
char *name = wxTheFontNameDirectory.GetScreenName( fontid, weight, style ); char *name = wxTheFontNameDirectory->GetScreenName( fontid, weight, style );
if (!name) if (!name)
name = "-*-*-*-*-*-*-*-%d-*-*-*-*-*-*"; name = "-*-*-*-*-*-*-*-%d-*-*-*-*-*-*";
@@ -698,7 +698,6 @@ wxFontNameDirectory::wxFontNameDirectory(void)
{ {
table = new wxHashTable(wxKEY_INTEGER, 20); table = new wxHashTable(wxKEY_INTEGER, 20);
nextFontId = -1; nextFontId = -1;
Initialize();
} }
wxFontNameDirectory::~wxFontNameDirectory() wxFontNameDirectory::~wxFontNameDirectory()

View File

@@ -5,7 +5,7 @@
// Created: 01/02/97 // Created: 01/02/97
// Id: // Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -51,6 +51,7 @@ static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox
} }
event.SetEventObject( listbox ); event.SetEventObject( listbox );
listbox->GetEventHandler()->ProcessEvent( event ); listbox->GetEventHandler()->ProcessEvent( event );
if (event.m_commandString) delete[] event.m_commandString ; if (event.m_commandString) delete[] event.m_commandString ;
}; };

View File

@@ -5,7 +5,7 @@
// Created: 01/02/97 // Created: 01/02/97
// Id: // Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__

View File

@@ -205,31 +205,38 @@ wxString wxRadioBox::GetLabel(void) const
void wxRadioBox::SetLabel( const wxString& WXUNUSED(label) ) void wxRadioBox::SetLabel( const wxString& WXUNUSED(label) )
{ {
wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
}; };
void wxRadioBox::SetLabel( int WXUNUSED(item), const wxString& WXUNUSED(label) ) void wxRadioBox::SetLabel( int WXUNUSED(item), const wxString& WXUNUSED(label) )
{ {
wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
}; };
void wxRadioBox::SetLabel( int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap) ) void wxRadioBox::SetLabel( int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap) )
{ {
wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
}; };
wxString wxRadioBox::GetLabel( int WXUNUSED(item) ) const wxString wxRadioBox::GetLabel( int WXUNUSED(item) ) const
{ {
wxFAIL_MSG("wxRadioBox::GetLabel not implemented.");
return ""; return "";
}; };
void wxRadioBox::Enable( bool WXUNUSED(enable) ) void wxRadioBox::Enable( bool WXUNUSED(enable) )
{ {
wxFAIL_MSG("wxRadioBox::Enable not implemented.");
}; };
void wxRadioBox::Enable( int WXUNUSED(item), bool WXUNUSED(enable) ) void wxRadioBox::Enable( int WXUNUSED(item), bool WXUNUSED(enable) )
{ {
wxFAIL_MSG("wxRadioBox::Enable not implemented.");
}; };
void wxRadioBox::Show( int WXUNUSED(item), bool WXUNUSED(show) ) void wxRadioBox::Show( int WXUNUSED(item), bool WXUNUSED(show) )
{ {
wxFAIL_MSG("wxRadioBox::Show not implemented.");
}; };
wxString wxRadioBox::GetStringSelection(void) const wxString wxRadioBox::GetStringSelection(void) const
@@ -275,5 +282,6 @@ int wxRadioBox::GetNumberOfRowsOrCols(void) const
void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) ) void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
{ {
wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented.");
}; };

View File

@@ -58,6 +58,16 @@ wxColour *g_systemBtnShadowColour = NULL;
wxColour *g_systemBtnHighlightColour = NULL; wxColour *g_systemBtnHighlightColour = NULL;
wxColour *g_systemHighlightColour = NULL; wxColour *g_systemHighlightColour = NULL;
wxFont *g_systemFont = NULL;
void wxSystemSettings::Done() {
wxDELETE(g_systemBtnFaceColour);
wxDELETE(g_systemBtnShadowColour);
wxDELETE(g_systemBtnHighlightColour);
wxDELETE(g_systemHighlightColour);
wxDELETE(g_systemFont);
}
wxColour wxSystemSettings::GetSystemColour( int index ) wxColour wxSystemSettings::GetSystemColour( int index )
{ {
switch (index) switch (index)
@@ -141,8 +151,6 @@ wxColour wxSystemSettings::GetSystemColour( int index )
return *wxWHITE; return *wxWHITE;
}; };
wxFont *g_systemFont = NULL;
wxFont wxSystemSettings::GetSystemFont( int index ) wxFont wxSystemSettings::GetSystemFont( int index )
{ {
switch (index) switch (index)

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97 // Created: 01/02/97
// RCS-ID: // RCS-ID:
// Copyright: (c) Robert Roebling // Copyright: (c) Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -40,7 +40,7 @@ wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
m_deleteSecondBitmap = FALSE; m_deleteSecondBitmap = FALSE;
}; };
wxToolBarTool::~wxToolBarTool(void) wxToolBarTool::~wxToolBarTool()
{ {
}; };
@@ -64,7 +64,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxToolBar,wxControl)
BEGIN_EVENT_TABLE(wxToolBar, wxControl) BEGIN_EVENT_TABLE(wxToolBar, wxControl)
END_EVENT_TABLE() END_EVENT_TABLE()
wxToolBar::wxToolBar(void) wxToolBar::wxToolBar()
{ {
}; };
@@ -75,7 +75,7 @@ wxToolBar::wxToolBar( wxWindow *parent, wxWindowID id,
Create( parent, id, pos, size, style, name ); Create( parent, id, pos, size, style, name );
}; };
wxToolBar::~wxToolBar(void) wxToolBar::~wxToolBar()
{ {
}; };

View File

@@ -5,7 +5,7 @@
// Created: 01/02/97 // Created: 01/02/97
// Id: // Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -31,6 +31,7 @@
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/Xresource.h> #include <X11/Xresource.h>
#include "wx/log.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// constants // constants
@@ -48,7 +49,7 @@
// glabal data (data.cpp) // glabal data (data.cpp)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
extern wxList wxResourceCache; extern wxResourceCache *wxTheResourceCache;
extern XrmDatabase wxResourceDatabase; extern XrmDatabase wxResourceDatabase;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -58,21 +59,21 @@ extern XrmDatabase wxResourceDatabase;
static char *GetResourcePath(char *buf, char *name, bool create) static char *GetResourcePath(char *buf, char *name, bool create)
{ {
if (create && FileExists(name)) { if (create && FileExists(name)) {
strcpy(buf, name); strcpy(buf, name);
return buf; // Exists so ... return buf; // Exists so ...
} }
if (*name == '/') if (*name == '/')
strcpy(buf, name); strcpy(buf, name);
else { else {
// Put in standard place for resource files if not absolute // Put in standard place for resource files if not absolute
strcpy(buf, DEFAULT_XRESOURCE_DIR); strcpy(buf, DEFAULT_XRESOURCE_DIR);
strcat(buf, "/"); strcat(buf, "/");
strcat(buf, FileNameFromPath(name)); strcat(buf, FileNameFromPath(name));
} }
if (create) { if (create) {
// Touch the file to create it // Touch the file to create it
FILE *fd = fopen(buf, "w"); FILE *fd = fopen(buf, "w");
if (fd) fclose(fd); if (fd) fclose(fd);
} }
return buf; return buf;
} }
@@ -91,15 +92,15 @@ static char *GetIniFile(char *dest, const char *filename)
{ {
if ((home = wxGetUserHome(wxString())) != NULL) if ((home = wxGetUserHome(wxString())) != NULL)
{ {
strcpy(dest, home); strcpy(dest, home);
if (dest[strlen(dest) - 1] != '/') strcat(dest, "/"); if (dest[strlen(dest) - 1] != '/') strcat(dest, "/");
if (filename == NULL) if (filename == NULL)
{ {
if ((filename = getenv("XENVIRONMENT")) == NULL) filename = ".Xdefaults"; if ((filename = getenv("XENVIRONMENT")) == NULL) filename = ".Xdefaults";
} }
else else
if (*filename != '.') strcat(dest, "."); if (*filename != '.') strcat(dest, ".");
strcat(dest, filename); strcat(dest, filename);
} }
else else
{ {
@@ -123,36 +124,36 @@ static void wxXMergeDatabases(void)
// Get application defaults file, if any // Get application defaults file, if any
if ((applicationDB = XrmGetFileDatabase(name))) if ((applicationDB = XrmGetFileDatabase(name)))
(void)XrmMergeDatabases(applicationDB, &wxResourceDatabase); (void)XrmMergeDatabases(applicationDB, &wxResourceDatabase);
// Merge server defaults, created by xrdb, loaded as a property of the root // Merge server defaults, created by xrdb, loaded as a property of the root
// window when the server initializes and loaded into the display // window when the server initializes and loaded into the display
// structure on XOpenDisplay; // structure on XOpenDisplay;
// if not defined, use .Xdefaults // if not defined, use .Xdefaults
if (XResourceManagerString(GDK_DISPLAY()) != NULL) { if (XResourceManagerString(GDK_DISPLAY()) != NULL) {
serverDB = XrmGetStringDatabase(XResourceManagerString(GDK_DISPLAY())); serverDB = XrmGetStringDatabase(XResourceManagerString(GDK_DISPLAY()));
} else { } else {
(void)GetIniFile(filename, NULL); (void)GetIniFile(filename, NULL);
serverDB = XrmGetFileDatabase(filename); serverDB = XrmGetFileDatabase(filename);
} }
if (serverDB) if (serverDB)
XrmMergeDatabases(serverDB, &wxResourceDatabase); XrmMergeDatabases(serverDB, &wxResourceDatabase);
// Open XENVIRONMENT file, or if not defined, the .Xdefaults, // Open XENVIRONMENT file, or if not defined, the .Xdefaults,
// and merge into existing database // and merge into existing database
if ((environment = getenv("XENVIRONMENT")) == NULL) { if ((environment = getenv("XENVIRONMENT")) == NULL) {
size_t len; size_t len;
environment = GetIniFile(filename, NULL); environment = GetIniFile(filename, NULL);
len = strlen(environment); len = strlen(environment);
#if !defined(SVR4) || defined(__sgi) #if !defined(SVR4) || defined(__sgi)
(void)gethostname(environment + len, 1024 - len); (void)gethostname(environment + len, 1024 - len);
#else #else
(void)sysinfo(SI_HOSTNAME, environment + len, 1024 - len); (void)sysinfo(SI_HOSTNAME, environment + len, 1024 - len);
#endif #endif
} }
if ((homeDB = XrmGetFileDatabase(environment))) if ((homeDB = XrmGetFileDatabase(environment)))
XrmMergeDatabases(homeDB, &wxResourceDatabase); XrmMergeDatabases(homeDB, &wxResourceDatabase);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -163,31 +164,32 @@ void wxFlushResources(void)
{ {
char nameBuffer[512]; char nameBuffer[512];
wxNode *node = wxResourceCache.First(); wxNode *node = wxTheResourceCache->First();
while (node) { while (node) {
char *file = node->key.string; char *file = node->key.string;
// If file doesn't exist, create it first. // If file doesn't exist, create it first.
(void)GetResourcePath(nameBuffer, file, TRUE); (void)GetResourcePath(nameBuffer, file, TRUE);
XrmDatabase database = (XrmDatabase)node->Data(); XrmDatabase database = (XrmDatabase)node->Data();
XrmPutFileDatabase(database, nameBuffer); XrmPutFileDatabase(database, nameBuffer);
XrmDestroyDatabase(database); XrmDestroyDatabase(database);
wxNode *next = node->Next(); wxNode *next = node->Next();
delete node; // delete node;
node = next; node = next;
} }
} }
void wxDeleteResources(const char *file) void wxDeleteResources(const char *file)
{ {
wxLogTrace(wxTraceResAlloc, "Delete: Number = %d", wxTheResourceCache->Number());
char buffer[500]; char buffer[500];
(void)GetIniFile(buffer, file); (void)GetIniFile(buffer, file);
wxNode *node = wxResourceCache.Find(buffer); wxNode *node = wxTheResourceCache->Find(buffer);
if (node) { if (node) {
XrmDatabase database = (XrmDatabase)node->Data(); XrmDatabase database = (XrmDatabase)node->Data();
XrmDestroyDatabase(database); XrmDestroyDatabase(database);
delete node; // delete node;
} }
} }
@@ -204,12 +206,13 @@ bool wxWriteResource(const wxString& section, const wxString& entry, const wxStr
(void)GetIniFile(buffer, file); (void)GetIniFile(buffer, file);
XrmDatabase database; XrmDatabase database;
wxNode *node = wxResourceCache.Find(buffer); wxNode *node = wxTheResourceCache->Find(buffer);
if (node) if (node)
database = (XrmDatabase)node->Data(); database = (XrmDatabase)node->Data();
else { else {
database = XrmGetFileDatabase(buffer); database = XrmGetFileDatabase(buffer);
wxResourceCache.Append(buffer, (wxObject *)database); wxLogTrace(wxTraceResAlloc, "Write: Number = %d", wxTheResourceCache->Number());
wxTheResourceCache->Append(buffer, (wxObject *)database);
} }
char resName[300]; char resName[300];
strcpy(resName, !section.IsNull() ? WXSTRINGCAST section : "wxWindows"); strcpy(resName, !section.IsNull() ? WXSTRINGCAST section : "wxWindows");
@@ -243,24 +246,25 @@ bool wxWriteResource(const wxString& section, const wxString& entry, int value,
bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file ) bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file )
{ {
if (!wxResourceDatabase) if (!wxResourceDatabase)
wxXMergeDatabases(); wxXMergeDatabases();
XrmDatabase database; XrmDatabase database;
if (file) { if (file) {
char buffer[500]; char buffer[500];
// Is this right? Trying to get it to look in the user's // Is this right? Trying to get it to look in the user's
// home directory instead of current directory -- JACS // home directory instead of current directory -- JACS
(void)GetIniFile(buffer, file); (void)GetIniFile(buffer, file);
wxNode *node = wxResourceCache.Find(buffer); wxNode *node = wxTheResourceCache->Find(buffer);
if (node) if (node)
database = (XrmDatabase)node->Data(); database = (XrmDatabase)node->Data();
else { else {
database = XrmGetFileDatabase(buffer); database = XrmGetFileDatabase(buffer);
wxResourceCache.Append(buffer, (wxObject *)database); wxLogTrace(wxTraceResAlloc, "Get: Number = %d", wxTheResourceCache->Number());
} wxTheResourceCache->Append(buffer, (wxObject *)database);
}
} else } else
database = wxResourceDatabase; database = wxResourceDatabase;
XrmValue xvalue; XrmValue xvalue;
char *str_type[20]; char *str_type[20];
@@ -272,15 +276,15 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value,
bool success = XrmGetResource(database, buf, "*", str_type, &xvalue); bool success = XrmGetResource(database, buf, "*", str_type, &xvalue);
// Try different combinations of upper/lower case, just in case... // Try different combinations of upper/lower case, just in case...
if (!success) { if (!success) {
buf[0] = (isupper(buf[0]) ? tolower(buf[0]) : toupper(buf[0])); buf[0] = (isupper(buf[0]) ? tolower(buf[0]) : toupper(buf[0]));
success = XrmGetResource(database, buf, "*", str_type, &xvalue); success = XrmGetResource(database, buf, "*", str_type, &xvalue);
} }
if (success) { if (success) {
if (*value) if (*value)
delete[] *value; delete[] *value;
*value = new char[xvalue.size + 1]; *value = new char[xvalue.size + 1];
strncpy(*value, xvalue.addr, (int)xvalue.size); strncpy(*value, xvalue.addr, (int)xvalue.size);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
}; };
@@ -290,11 +294,11 @@ bool wxGetResource(const wxString& section, const wxString& entry, float *value,
char *s = NULL; char *s = NULL;
bool succ = wxGetResource(section, entry, &s, file); bool succ = wxGetResource(section, entry, &s, file);
if (succ) { if (succ) {
*value = (float)strtod(s, NULL); *value = (float)strtod(s, NULL);
delete[]s; delete[]s;
return TRUE; return TRUE;
} else } else
return FALSE; return FALSE;
}; };
bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file ) bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file )
@@ -302,11 +306,11 @@ bool wxGetResource(const wxString& section, const wxString& entry, long *value,
char *s = NULL; char *s = NULL;
bool succ = wxGetResource(section, entry, &s, file); bool succ = wxGetResource(section, entry, &s, file);
if (succ) { if (succ) {
*value = strtol(s, NULL, 10); *value = strtol(s, NULL, 10);
delete[]s; delete[]s;
return TRUE; return TRUE;
} else } else
return FALSE; return FALSE;
}; };
bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file ) bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file )
@@ -314,19 +318,19 @@ bool wxGetResource(const wxString& section, const wxString& entry, int *value, c
char *s = NULL; char *s = NULL;
bool succ = wxGetResource(section, entry, &s, file); bool succ = wxGetResource(section, entry, &s, file);
if (succ) { if (succ) {
// Handle True, False here // Handle True, False here
// True, Yes, Enables, Set or Activated // True, Yes, Enables, Set or Activated
if (*s == 'T' || *s == 'Y' || *s == 'E' || *s == 'S' || *s == 'A') if (*s == 'T' || *s == 'Y' || *s == 'E' || *s == 'S' || *s == 'A')
*value = TRUE; *value = TRUE;
// False, No, Disabled, Reset, Cleared, Deactivated // False, No, Disabled, Reset, Cleared, Deactivated
else if (*s == 'F' || *s == 'N' || *s == 'D' || *s == 'R' || *s == 'C') else if (*s == 'F' || *s == 'N' || *s == 'D' || *s == 'R' || *s == 'C')
*value = FALSE; *value = FALSE;
// Handle as Integer // Handle as Integer
else else
*value = (int)strtol(s, NULL, 10); *value = (int)strtol(s, NULL, 10);
delete[]s; delete[]s;
return TRUE; return TRUE;
} else } else
return FALSE; return FALSE;
}; };

View File

@@ -753,6 +753,7 @@ wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxString &name )
{ {
m_cursor = NULL;
Create( parent, id, pos, size, style, name ); Create( parent, id, pos, size, style, name );
}; };
@@ -864,7 +865,7 @@ wxWindow::~wxWindow(void)
if (m_widget) gtk_widget_destroy( m_widget ); if (m_widget) gtk_widget_destroy( m_widget );
// delete m_cursor; wxDELETE(m_cursor);
DeleteRelatedConstraints(); DeleteRelatedConstraints();
if (m_constraints) if (m_constraints)
@@ -918,7 +919,8 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
m_windowValidator = NULL; m_windowValidator = NULL;
m_windowId = id; m_windowId = id;
m_sizeSet = FALSE; m_sizeSet = FALSE;
m_cursor = new wxCursor( wxCURSOR_ARROW ); if (m_cursor == NULL)
m_cursor = new wxCursor( wxCURSOR_ARROW );
m_font = *wxSWISS_FONT; m_font = *wxSWISS_FONT;
m_backgroundColour = wxWHITE; m_backgroundColour = wxWHITE;
m_foregroundColour = wxBLACK; m_foregroundColour = wxBLACK;
@@ -1561,7 +1563,11 @@ wxWindowID wxWindow::GetId(void)
void wxWindow::SetCursor( const wxCursor &cursor ) void wxWindow::SetCursor( const wxCursor &cursor )
{ {
if (*m_cursor == cursor) return; wxASSERT(m_cursor != NULL);
if (m_cursor != NULL)
if (*m_cursor == cursor)
return;
(*m_cursor) = cursor; (*m_cursor) = cursor;
if (m_widget->window) if (m_widget->window)
gdk_window_set_cursor( m_widget->window, m_cursor->GetCursor() ); gdk_window_set_cursor( m_widget->window, m_cursor->GetCursor() );

View File

@@ -1011,4 +1011,3 @@ void wxFrame::PositionToolBar(void)
} }
} }
} }

View File

@@ -6,7 +6,7 @@
// Created: 04/01/98 // Created: 04/01/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem // Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -4600,3 +4600,5 @@ const char *wxGetMessageName(int message)
} }
} }
#endif //WXDEBUG #endif //WXDEBUG
#include "../common/wincmn.cpp"