/** @name Very common macros */
// ----------------------------------------------------------------------------
//@{
-/// delete pointer if it is not NULL
-#define DELETEP(p) if ( (p) != NULL ) delete (p)
-/// delete array pointer if it is not NULL
-#define DELETEA(p) if ( (p) != NULL ) delete [] (p)
+/// delete pointer if it is not NULL and NULL it afterwards
+// (checking that it's !NULL before passing it to delete is just a
+// a question of style, because delete will do it itself anyhow, but it might
+// 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
#define WXSIZEOF(array) (sizeof(array)/sizeof(array[0]))
WXDLLEXPORT_DATA(extern wxColourDatabase*) wxTheColourDatabase;
extern void WXDLLEXPORT wxInitializeStockObjects();
+extern void WXDLLEXPORT wxInitializeStockLists();
extern void WXDLLEXPORT wxDeleteStockObjects();
+extern void WXDLLEXPORT wxDeleteStockLists();
extern bool WXDLLEXPORT wxColourDisplay();
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
// __GDICMNH__
#define wxLC_NO_HEADER 0x0800 // not supported in wxGLC
#define wxLC_NO_SORT_HEADER 0x1000 // not supported in wxGLC
#define wxLC_SINGLE_SEL 0x2000
-#define wxLC_SORT_ASCENDING 0x4000
+#define wxLC_SORT_ASCENDING 0x4000
#define wxLC_SORT_DESCENDING 0x8000 // not supported in wxGLC
#define wxLC_MASK_TYPE (wxLC_ICON | wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT)
#define wxLIST_STATE_DONTCARE 0x0000
#define wxLIST_STATE_DROPHILITED 0x0001 // not supported in wxGLC
#define wxLIST_STATE_FOCUSED 0x0002
-#define wxLIST_STATE_SELECTED 0x0004
+#define wxLIST_STATE_SELECTED 0x0004
#define wxLIST_STATE_CUT 0x0008 // not supported in wxGLC
// Hit test flags, used in HitTest // wxGLC suppots 20 and 80
wxLIST_NEXT_ALL, // Searches for subsequent item by index
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_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
int m_xpos,m_ypos;
int m_width,m_height;
wxColour *m_colour;
-
+
public:
wxListItemData(void);
wxListItemData( const wxListItem &info );
int m_width;
int m_xpos,m_ypos;
int m_height;
-
+
public:
wxListHeaderData(void);
wxListHeaderData( const wxListItem &info );
public:
wxListHeaderWindow( void );
- wxListHeaderWindow( wxWindow *win, wxWindowID id, wxListMainWindow *owner,
+ wxListHeaderWindow( wxWindow *win, wxWindowID id, wxListMainWindow *owner,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = "columntitles" );
void DoDrawRect( wxPaintDC *dc, int x, int y, int w, int h );
void OnPaint( wxPaintEvent &event );
void OnMouse( wxMouseEvent &event );
void OnSetFocus( wxFocusEvent &event );
-
+
DECLARE_EVENT_TABLE()
};
{
private:
wxListMainWindow *m_owner;
-
+
public:
wxListRenameTimer( wxListMainWindow *owner );
void Notify();
class wxListTextCtrl: public wxTextCtrl
{
DECLARE_DYNAMIC_CLASS(wxListTextCtrl);
-
+
private:
bool *m_accept;
wxString *m_res;
public:
wxListTextCtrl(void) : wxTextCtrl() {};
- wxListTextCtrl( wxWindow *parent, const char *value = "",
+ wxListTextCtrl( wxWindow *parent, const char *value = "",
bool *accept, wxString *res, wxListMainWindow *owner,
int x = -1, int y = -1, int w = -1, int h = -1, int style = 0, char *name = "rawtext" ) :
- wxTextCtrl( parent, value, x, y, w, h, style, name )
+ wxTextCtrl( parent, value, x, y, w, h, style, name )
{
m_res = res;
m_accept = accept;
public:
long m_mode;
wxList m_lines;
- wxList m_columns;
+ wxList m_columns;
wxListLineData *m_current;
int m_visibleLines;
wxBrush *m_hilightBrush;
int m_dragCount;
public:
- wxListMainWindow(void);
- wxListMainWindow( wxWindow *parent, wxWindowID id,
+ wxListMainWindow(void);
+ wxListMainWindow( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = "listctrl" );
~wxListMainWindow(void);
void GetColumn( int col, wxListItem &item );
int GetColumnWidth( int vol );
int GetColumnCount( void );
- int GetCountPerPage( void );
+ int GetCountPerPage( void );
void SetItem( wxListItem &item );
void GetItem( wxListItem &item );
- void SetItemState( long item, long state, long stateMask );
+ void SetItemState( long item, long state, long stateMask );
int GetItemState( long item, long stateMask );
int GetItemCount( void );
void GetItemRect( long index, wxRectangle &rect );
void InsertColumn( long col, wxListItem &item );
void SortItems( wxListCtrlCompare fn, long data );
virtual bool OnListNotify( wxListEvent &event );
-
+
DECLARE_EVENT_TABLE()
};
class wxListCtrl: public wxControl
{
DECLARE_DYNAMIC_CLASS(wxListCtrl);
-
+
public:
-
+
wxListCtrl(void);
- wxListCtrl( wxWindow *parent, wxWindowID id,
+ wxListCtrl( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = "listctrl" );
~wxListCtrl(void);
- bool Create( wxWindow *parent, wxWindowID id,
+ bool Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = "listctrl" );
void OnSize( wxSizeEvent &event );
void SetItemText( long item, const wxString& str );
long GetItemData( long item );
bool SetItemData( long item, long data );
- bool GetItemRect( long item, wxRectangle& rect, int code = wxLIST_RECT_BOUNDS );
+ bool GetItemRect( long item, wxRectangle& rect, int code = wxLIST_RECT_BOUNDS );
bool GetItemPosition( long item, wxPoint& pos );
bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC
int GetItemCount(void);
{ m_mainWin->SetDropTarget( dropTarget ); };
wxDropTarget *GetDropTarget() const
{ return m_mainWin->GetDropTarget(); };
-
+
void OnIdle( wxIdleEvent &event );
protected:
-
+
// wxListTextCtrl m_textCtrl;
- wxImageList *m_imageListNormal;
- wxImageList *m_imageListSmall;
+ wxImageList *m_imageListNormal;
+ wxImageList *m_imageListSmall;
wxImageList *m_imageListState; // what's that ?
wxListHeaderWindow *m_headerWin;
wxListMainWindow *m_mainWin;
-
+
DECLARE_EVENT_TABLE()
};
// Created: 01/02/97
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __GTKAPPH__
class wxApp;
class wxLog;
-class wxConfig; // it's not used #if !USE_WXCONFIG, but fwd decl doesn't harm
//-----------------------------------------------------------------------------
// global data
DECLARE_DYNAMIC_CLASS(wxApp)
public:
-
+
wxApp(void);
~wxApp(void);
-
+
static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; }
static wxAppInitializerFunction GetInitializerFunction(void) { return m_appInitFn; }
-
+
virtual bool OnInit(void);
virtual bool OnInitGui(void);
virtual int OnRun(void);
virtual int OnExit(void);
-
+
wxWindow *GetTopWindow(void);
void SetTopWindow( wxWindow *win );
virtual int MainLoop(void);
inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; }
inline bool GetWantDebugOutput(void) { return m_wantDebugOutput; }
- void OnIdle( wxIdleEvent &event );
+ void OnIdle( wxIdleEvent &event );
bool SendIdleEvents(void);
bool SendIdleEvents( wxWindow* win );
-
+
inline wxString GetAppName(void) const {
if (m_appName != "")
return m_appName;
inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
inline bool GetExitOnFrameDelete(void) const { return m_exitOnFrameDelete; }
-
- void SetPrintMode(int WXUNUSED(mode) ) {};
+
+ void SetPrintMode(int WXUNUSED(mode) ) {};
int GetPrintMode(void) const { return wxPRINT_POSTSCRIPT; };
-
+
// override this function to create default log target of arbitrary
// user-defined classv (default implementation creates a wxLogGui object)
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
static void CommonInit(void);
- static void CommonCleanUp(void);
-
+ static void CommonCleanUp(void);
+
bool ProcessIdle(void);
void DeletePendingObjects(void);
-
+
bool m_initialized;
bool m_exitOnFrameDelete;
bool m_wantDebugOutput;
wxWindow *m_topWindow;
gint m_idleTag;
-
+
int argc;
char **argv;
-
+
static wxAppInitializerFunction m_appInitFn;
private:
// global variables
//-----------------------------------------------------------------------------
-// extern wxFontNameDirectory wxTheFontNameDirectory; // defined below
+//extern wxFontNameDirectory *wxTheFontNameDirectory; // defined below
//-----------------------------------------------------------------------------
// wxFont
int nextFontId;
};
-extern wxFontNameDirectory wxTheFontNameDirectory;
+extern wxFontNameDirectory *wxTheFontNameDirectory;
#endif // __GTKFONTH__
//-----------------------------------------------------------------------------
class wxListBox;
+class wxArrayInt;
//-----------------------------------------------------------------------------
// global data
public:
inline wxSystemSettings(void) {}
+ inline static void Init() {}
+ static void Done();
+
// Get a system colour
static wxColour GetSystemColour(int index);
// Created: 01/02/97
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __GTKAPPH__
class wxApp;
class wxLog;
-class wxConfig; // it's not used #if !USE_WXCONFIG, but fwd decl doesn't harm
//-----------------------------------------------------------------------------
// global data
DECLARE_DYNAMIC_CLASS(wxApp)
public:
-
+
wxApp(void);
~wxApp(void);
-
+
static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; }
static wxAppInitializerFunction GetInitializerFunction(void) { return m_appInitFn; }
-
+
virtual bool OnInit(void);
virtual bool OnInitGui(void);
virtual int OnRun(void);
virtual int OnExit(void);
-
+
wxWindow *GetTopWindow(void);
void SetTopWindow( wxWindow *win );
virtual int MainLoop(void);
inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; }
inline bool GetWantDebugOutput(void) { return m_wantDebugOutput; }
- void OnIdle( wxIdleEvent &event );
+ void OnIdle( wxIdleEvent &event );
bool SendIdleEvents(void);
bool SendIdleEvents( wxWindow* win );
-
+
inline wxString GetAppName(void) const {
if (m_appName != "")
return m_appName;
inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
inline bool GetExitOnFrameDelete(void) const { return m_exitOnFrameDelete; }
-
- void SetPrintMode(int WXUNUSED(mode) ) {};
+
+ void SetPrintMode(int WXUNUSED(mode) ) {};
int GetPrintMode(void) const { return wxPRINT_POSTSCRIPT; };
-
+
// override this function to create default log target of arbitrary
// user-defined classv (default implementation creates a wxLogGui object)
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
static void CommonInit(void);
- static void CommonCleanUp(void);
-
+ static void CommonCleanUp(void);
+
bool ProcessIdle(void);
void DeletePendingObjects(void);
-
+
bool m_initialized;
bool m_exitOnFrameDelete;
bool m_wantDebugOutput;
wxWindow *m_topWindow;
gint m_idleTag;
-
+
int argc;
char **argv;
-
+
static wxAppInitializerFunction m_appInitFn;
private:
// global variables
//-----------------------------------------------------------------------------
-// extern wxFontNameDirectory wxTheFontNameDirectory; // defined below
+//extern wxFontNameDirectory *wxTheFontNameDirectory; // defined below
//-----------------------------------------------------------------------------
// wxFont
int nextFontId;
};
-extern wxFontNameDirectory wxTheFontNameDirectory;
+extern wxFontNameDirectory *wxTheFontNameDirectory;
#endif // __GTKFONTH__
//-----------------------------------------------------------------------------
class wxListBox;
+class wxArrayInt;
//-----------------------------------------------------------------------------
// global data
public:
inline wxSystemSettings(void) {}
+ inline static void Init() {}
+ static void Done();
+
// Get a system colour
static wxColour GetSystemColour(int index);
bool done;
public:
- wxIndividualLayoutConstraint(void);
- ~wxIndividualLayoutConstraint(void);
+ wxIndividualLayoutConstraint();
+ ~wxIndividualLayoutConstraint();
void Set(wxRelationship rel, wxWindow *otherW, wxEdge otherE, int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN);
//
// Dimension is unconstrained
//
- inline void Unconstrained(void) { relationship = wxUnconstrained; }
+ inline void Unconstrained() { relationship = wxUnconstrained; }
//
// Dimension is 'as is' (use current size settings)
//
- inline void AsIs(void) { relationship = wxAsIs; }
+ inline void AsIs() { relationship = wxAsIs; }
//
// Accessors
//
- inline wxWindow *GetOtherWindow(void) { return otherWin; }
- inline wxEdge GetMyEdge(void) { return myEdge; }
+ inline wxWindow *GetOtherWindow() { return otherWin; }
+ inline wxEdge GetMyEdge() const { return myEdge; }
inline void SetEdge(wxEdge which) { myEdge = which; }
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 int GetValue(void) { return value; }
- inline int GetPercent(void) { return percent; }
- inline int GetOtherEdge(void) { return otherEdge; }
- inline bool GetDone(void) { return done; }
+ inline int GetValue() const { return value; }
+ inline int GetPercent() const { return percent; }
+ inline int GetOtherEdge() const { return otherEdge; }
+ inline bool GetDone() const { return done; }
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; }
// Reset constraint if it mentions otherWin
// Get the value of this edge or dimension, or if this
// 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
wxIndividualLayoutConstraint centreX;
wxIndividualLayoutConstraint centreY;
- wxLayoutConstraints(void);
- ~wxLayoutConstraints(void);
+ wxLayoutConstraints();
+ ~wxLayoutConstraints();
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);
int sizerX;
int sizerY;
public:
- wxSizer(void);
+ wxSizer();
wxSizer(wxWindow *parent, wxSizerBehaviour behav = wxSizerNone);
- ~wxSizer(void);
+ ~wxSizer();
bool Create(wxWindow *parent, wxSizerBehaviour behav = wxSizerNone);
virtual void SetSize(int x, int y, int w, int h, int flags = wxSIZE_AUTO);
{ Move(x, y); }
virtual void SetBorder(int w, int h);
- inline int GetBorderX(void) { return borderX ; }
- inline int GetBorderY(void) { return borderY ; }
+ inline int GetBorderX() { return borderX ; }
+ inline int GetBorderY() { return borderY ; }
virtual void AddSizerChild(wxWindow *child);
virtual void RemoveSizerChild(wxWindow *child);
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 LayoutPhase2(int *);
int ySpacing;
public:
// 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(void);
+ ~wxRowColSizer();
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 w, int h) { wxSizer::SetSize(w, h); }
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 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 GetSpacing(int *x, int *y) { *x = xSpacing; *y = ySpacing; }
private:
protected:
public:
- wxSpacingSizer(void);
+ wxSpacingSizer();
wxSpacingSizer(wxWindow *parent, wxRelationship rel, wxWindow *other, int spacing);
wxSpacingSizer(wxWindow *parent);
- ~wxSpacingSizer(void);
+ ~wxSpacingSizer();
bool Create(wxWindow *parent, wxRelationship rel, wxWindow *other, int sp);
bool Create(wxWindow *parent);
class WXDLLEXPORT wxLogWindow : public wxLog
{
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();
// window operations
wxFrame *GetFrame() const;
// accessors
+ // the previous log target (may be NULL)
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:
virtual void DoLog(wxLogLevel level, const char *szString);
virtual void DoLogString(const char *szString);
private:
- wxLog *m_pOldLog; // previous log target
- wxLogFrame *m_pLogFrame; // the log frame
+ bool m_bPassMessages; // pass messages to m_pOldLog?
+ wxLog *m_pOldLog; // previous log target
+ wxLogFrame *m_pLogFrame; // the log frame
};
// ----------------------------------------------------------------------------
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
-// Licence: wxWindows license
+// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __MENUH__
inline bool IsEnabled(int id) const { return Enabled(id); };
void Check(int id, bool Flag);
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
// title
virtual void SetParent(wxEvtHandler *parent) { m_parent = parent; }
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; }
{
DECLARE_DYNAMIC_CLASS(wxMenuBar)
- wxMenuBar(void);
+public:
+ wxMenuBar();
wxMenuBar(int n, wxMenu *menus[], const wxString titles[]);
- ~wxMenuBar(void);
+ ~wxMenuBar();
void Append(wxMenu *menu, const wxString& title);
// Must only be used AFTER menu has been attached to frame,
// menu too if itemMenu is non-NULL.
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 wxEvtHandler *GetEventHandler(void) { return m_eventHandler; }
+ inline wxEvtHandler *GetEventHandler() { return m_eventHandler; }
inline int GetMenuCount() const { return m_menuCount; }
inline wxMenu* GetMenu(int i) const { return m_menus[i]; }
// Modified by: Vadim Zeitlin for Windows version
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
-// Licence: wxWindows license
+// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef _NOTEBOOK_H
// @@@ 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
// part of wxTabCtrl here
-class wxNotebook : public wxControl
+class WXDLLEXPORT wxNotebook : public wxControl
{
public:
// ctors
void OnSetFocus(wxFocusEvent& event);
void OnNavigationKey(wxNavigationKeyEvent& event);
+>>>>>>> 1.5
// base class virtuals
// -------------------
virtual void Command(wxCommandEvent& event);
wx_string = string;
delete string;
- return wx_string;
+ return wx_string;
}
wxDataOutputStream::wxDataOutputStream(wxOutputStream& s)
#if USE_APPLE_IEEE
ConvertToIeeeExtended(d, (unsigned char *)buf);
#else
-# pragma warning "wxDataStream::WriteDouble() not using IeeeExtended - will not work!"
+# pragma warning "wxDataStream::WriteDouble() not using IeeeExtended - will not work!"
buf[0] = '\0';
#endif
Write(buf, 10);
// assignment operator
wxBaseArray& wxBaseArray::operator=(const wxBaseArray& src)
{
- DELETEA(m_pItems);
+ wxDELETEA(m_pItems);
m_uiSize = // not src.m_uiSize to save memory
m_uiCount = src.m_uiCount;
// dtor
wxBaseArray::~wxBaseArray()
{
- DELETEA(m_pItems);
+ wxDELETEA(m_pItems);
}
// clears the list
m_uiSize =
m_uiCount = 0;
- DELETEA(m_pItems);
- m_pItems = NULL;
+ wxDELETEA(m_pItems);
}
// pre-allocates memory (frees the previous data!)
// only if old buffer was not big enough
if ( uiSize > m_uiSize ) {
- DELETEA(m_pItems);
+ wxDELETEA(m_pItems);
m_pItems = new long[uiSize];
m_uiSize = uiSize;
}
IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
+IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
/*
IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPoint, wxObject)
}
-void
-wxInitializeStockObjects ()
-{
+void wxInitializeStockLists () {
wxTheBrushList = new wxBrushList;
wxThePenList = new wxPenList;
wxTheFontList = new wxFontList;
wxTheBitmapList = new wxBitmapList;
+}
+void wxInitializeStockObjects ()
+{
#ifdef __WXMOTIF__
#endif
#ifdef __X__
void
wxDeleteStockObjects ()
{
- DELETEP(wxNORMAL_FONT);
- DELETEP(wxSMALL_FONT);
- DELETEP(wxITALIC_FONT);
- DELETEP(wxSWISS_FONT);
-
- DELETEP(wxRED_PEN);
- DELETEP(wxCYAN_PEN);
- DELETEP(wxGREEN_PEN);
- DELETEP(wxBLACK_PEN);
- DELETEP(wxWHITE_PEN);
- DELETEP(wxTRANSPARENT_PEN);
- DELETEP(wxBLACK_DASHED_PEN);
- DELETEP(wxGREY_PEN);
- DELETEP(wxMEDIUM_GREY_PEN);
- DELETEP(wxLIGHT_GREY_PEN);
-
- DELETEP(wxBLUE_BRUSH);
- DELETEP(wxGREEN_BRUSH);
- DELETEP(wxWHITE_BRUSH);
- DELETEP(wxBLACK_BRUSH);
- DELETEP(wxTRANSPARENT_BRUSH);
- DELETEP(wxCYAN_BRUSH);
- DELETEP(wxRED_BRUSH);
- DELETEP(wxGREY_BRUSH);
- DELETEP(wxMEDIUM_GREY_BRUSH);
- DELETEP(wxLIGHT_GREY_BRUSH);
-
- DELETEP(wxBLACK);
- DELETEP(wxWHITE);
- DELETEP(wxRED);
- DELETEP(wxBLUE);
- DELETEP(wxGREEN);
- DELETEP(wxCYAN);
- DELETEP(wxLIGHT_GREY);
-
- DELETEP(wxSTANDARD_CURSOR);
- DELETEP(wxHOURGLASS_CURSOR);
- DELETEP(wxCROSS_CURSOR);
+
+ wxDELETE(wxNORMAL_FONT);
+ wxDELETE(wxSMALL_FONT);
+ wxDELETE(wxITALIC_FONT);
+ wxDELETE(wxSWISS_FONT);
+
+ wxDELETE(wxRED_PEN);
+ wxDELETE(wxCYAN_PEN);
+ wxDELETE(wxGREEN_PEN);
+ wxDELETE(wxBLACK_PEN);
+ wxDELETE(wxWHITE_PEN);
+ wxDELETE(wxTRANSPARENT_PEN);
+ wxDELETE(wxBLACK_DASHED_PEN);
+ wxDELETE(wxGREY_PEN);
+ wxDELETE(wxMEDIUM_GREY_PEN);
+ wxDELETE(wxLIGHT_GREY_PEN);
+
+ wxDELETE(wxBLUE_BRUSH);
+ wxDELETE(wxGREEN_BRUSH);
+ wxDELETE(wxWHITE_BRUSH);
+ wxDELETE(wxBLACK_BRUSH);
+ wxDELETE(wxTRANSPARENT_BRUSH);
+ wxDELETE(wxCYAN_BRUSH);
+ wxDELETE(wxRED_BRUSH);
+ wxDELETE(wxGREY_BRUSH);
+ wxDELETE(wxMEDIUM_GREY_BRUSH);
+ wxDELETE(wxLIGHT_GREY_BRUSH);
+
+ wxDELETE(wxBLACK);
+ wxDELETE(wxWHITE);
+ 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 ()
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;
+ }
+}
+
wxMsgCatalog::~wxMsgCatalog()
{
- DELETEA(m_pData);
- DELETEA(m_pszName);
+ wxDELETEA(m_pData);
+ wxDELETEA(m_pszName);
}
class NoTransErr
// read the whole file in memory
m_pData = new uint8[nSize];
if ( fileMsg.Read(m_pData, nSize) != nSize ) {
- DELETEA(m_pData);
- m_pData = NULL;
+ wxDELETEA(m_pData);
return FALSE;
}
// it's either too short or has incorrect magic number
wxLogWarning("'%s' is not a valid message catalog.", strFullName.c_str());
- DELETEA(m_pData);
- m_pData = NULL;
+ wxDELETEA(m_pData);
return FALSE;
}
}
-wxIndividualLayoutConstraint::wxIndividualLayoutConstraint(void)
+wxIndividualLayoutConstraint::wxIndividualLayoutConstraint()
{
myEdge = wxTop; relationship = wxUnconstrained; margin = 0; value = 0; percent = 0; otherEdge = wxTop;
done = FALSE; otherWin = NULL;
}
-wxIndividualLayoutConstraint::~wxIndividualLayoutConstraint(void)
+wxIndividualLayoutConstraint::~wxIndividualLayoutConstraint()
{
}
// Get the value of this edge or dimension, or if this
// 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
// know the dimension is obtainable immediately.
return -1;
}
-wxLayoutConstraints::wxLayoutConstraints(void)
+wxLayoutConstraints::wxLayoutConstraints()
{
left.SetEdge(wxLeft);
top.SetEdge(wxTop);
height.SetEdge(wxHeight);
}
-wxLayoutConstraints::~wxLayoutConstraints(void)
+wxLayoutConstraints::~wxLayoutConstraints()
{
}
*nChanges = noChanges;
- return (left.GetDone() && top.GetDone() && right.GetDone() && bottom.GetDone() &&
- centreX.GetDone() && centreY.GetDone());
+ return AreSatisfied();
}
/*
if (constr)
{
int tempNoChanges = 0;
- (void) constr->SatisfyConstraints(child, &tempNoChanges);
+ (void)constr->SatisfyConstraints(child, &tempNoChanges);
noChanges += tempNoChanges;
}
node = node->Next();
return TRUE;
}
-wxSizer::wxSizer(void)
+wxSizer::wxSizer()
{
sizerBehaviour = wxSizerNone;
borderX = 2;
return TRUE;
}
-wxSizer::~wxSizer(void)
+wxSizer::~wxSizer()
{
// Remove all children without deleting them,
// or ~wxbWindow will delete proper windows _twice_
* wxRowColSizer
*/
-wxRowColSizer::wxRowColSizer(void)
+wxRowColSizer::wxRowColSizer()
{
rowOrCol = TRUE;
rowOrColSize = 20;
return TRUE;
}
-wxRowColSizer::~wxRowColSizer(void)
+wxRowColSizer::~wxRowColSizer()
{
}
* wxSpacingSizer
*/
-wxSpacingSizer::wxSpacingSizer(void)
+wxSpacingSizer::wxSpacingSizer()
{
}
return TRUE;
}
-wxSpacingSizer::~wxSpacingSizer(void)
+wxSpacingSizer::~wxSpacingSizer()
{
}
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_pOldLog = wxLog::SetActiveTarget(this);
if ( bShow )
m_pLogFrame->Show(TRUE);
void wxLogWindow::DoLog(wxLogLevel level, const char *szString)
{
// 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
// 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
// Julian - we'll need to do this a different way now we've removed the
// font directory system. Must find Stefan's original code.
- name = wxTheFontNameDirectory.GetAFMName(Family, Weight, Style);
+ name = wxTheFontNameDirectory->GetAFMName(Family, Weight, Style);
if (!name)
name = "unknown";
memcpy(pNew, m_pItems, m_nCount*sizeof(char *));
// delete old memory (but do not release the strings!)
- DELETEA(m_pItems);
+ wxDELETEA(m_pItems);
m_pItems = pNew;
}
m_nSize =
m_nCount = 0;
- DELETEA(m_pItems);
- m_pItems = NULL;
+ wxDELETEA(m_pItems);
}
// dtor
{
Free();
- DELETEA(m_pItems);
+ wxDELETEA(m_pItems);
}
// pre-allocates memory (frees the previous data!)
// only if old buffer was not big enough
if ( nSize > m_nSize ) {
Free();
- DELETEA(m_pItems);
+ wxDELETEA(m_pItems);
m_pItems = new char *[nSize];
m_nSize = nSize;
}
#include "wx/intl.h"
#include "wx/log.h"
#include "wx/memory.h"
+#include "wx/font.h"
+#include "wx/settings.h"
#include "unistd.h"
wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
extern wxList wxPendingDelete;
+extern wxResourceCache *wxTheResourceCache;
//-----------------------------------------------------------------------------
// local functions
(void) wxGetResource("wxWindows", "OsVersion", &wxOsVersion);
#endif
*/
+ wxSystemSettings::Init();
+ wxTheResourceCache = new wxResourceCache(wxKEY_STRING);
+
+ wxTheFontNameDirectory = new wxFontNameDirectory;
+ wxTheFontNameDirectory->Initialize();
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
wxTheColourDatabase->Initialize();
+
+ wxInitializeStockLists();
wxInitializeStockObjects();
// For PostScript printing
g_globalCursor = new wxCursor;
*/
- wxInitializeStockObjects();
+// wxInitializeStockObjects();
};
void wxApp::CommonCleanUp(void)
{
+ wxDELETE(wxTheColourDatabase);
+ wxDELETE(wxThePrintPaperDatabase);
+ wxDELETE(wxThePrintSetupData);
+ wxDELETE(wxTheFontNameDirectory);
wxDeleteStockObjects();
wxFlushResources();
+
+ wxDELETE(wxTheResourceCache);
+
+ wxDeleteStockLists();
+
+ wxSystemSettings::Done();
};
wxLog *wxApp::CreateLogTarget()
wxObject *test_app = app_ini();
wxTheApp = (wxApp*) test_app;
-
-// wxTheApp = (wxApp*)( app_ini() );
};
if (!wxTheApp)
return 0;
};
-// printf( "Programmstart.\n" );
-
wxTheApp->argc = argc;
wxTheApp->argv = argv;
wxTheApp->OnExit();
wxApp::CommonCleanUp();
+
+ wxDELETE(wxTheApp);
#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT
// At this point we want to check if there are any memory
// Created: 01/02/97
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include <X11/Xutil.h>
#include <X11/Xresource.h>
-wxList wxResourceCache(wxKEY_STRING);
+wxResourceCache *wxTheResourceCache = NULL;
XrmDatabase wxResourceDatabase;
// Useful buffer, initialized in wxCommonInit
// X only font names
-wxFontNameDirectory wxTheFontNameDirectory;
+wxFontNameDirectory *wxTheFontNameDirectory;
// Stock objects
wxFont *wxNORMAL_FONT;
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow)
BEGIN_EVENT_TABLE(wxStatusBar, wxWindow)
- EVT_PAINT(wxStatusBar::OnPaint)
+ EVT_PAINT(wxStatusBar::OnPaint)
EVT_SYS_COLOUR_CHANGED(wxStatusBar::OnSysColourChanged)
END_EVENT_TABLE()
const wxEventTable *wxEvtHandler::GetEventTable() const { return &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 } };
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
- EVT_ACTIVATE(wxFrame::OnActivate)
- EVT_SIZE(wxFrame::OnSize)
- EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
- EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
- EVT_IDLE(wxFrame::OnIdle)
- EVT_CLOSE(wxFrame::OnCloseWindow)
+ EVT_SIZE(wxFrame::OnSize)
+ EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
+ EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
+ EVT_IDLE(wxFrame::OnIdle)
+ EVT_CLOSE(wxFrame::OnCloseWindow)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxDialog, wxPanel)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
- EVT_CHAR(wxTextCtrl::OnChar)
- EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
- EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
+ EVT_CHAR(wxTextCtrl::OnChar)
+ EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
+ EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
END_EVENT_TABLE()
#ifdef wx_msw
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxToolBarSimple, wxToolBarBase)
- EVT_SIZE(wxToolBarSimple::OnSize)
- EVT_PAINT(wxToolBarSimple::OnPaint)
- EVT_KILL_FOCUS(wxToolBarSimple::OnKillFocus)
- EVT_MOUSE_EVENTS(wxToolBarSimple::OnMouseEvent)
+ EVT_SIZE(wxToolBarSimple::OnSize)
+ EVT_PAINT(wxToolBarSimple::OnPaint)
+ EVT_KILL_FOCUS(wxToolBarSimple::OnKillFocus)
+ EVT_MOUSE_EVENTS(wxToolBarSimple::OnMouseEvent)
END_EVENT_TABLE()
#ifdef wx_msw
BEGIN_EVENT_TABLE(wxToolBarMSW, wxToolBarBase)
- EVT_SIZE(wxToolBarMSW::OnSize)
- EVT_PAINT(wxToolBarMSW::OnPaint)
- EVT_MOUSE_EVENTS(wxToolBarMSW::OnMouseEvent)
+ EVT_SIZE(wxToolBarMSW::OnSize)
+ EVT_PAINT(wxToolBarMSW::OnPaint)
+ EVT_MOUSE_EVENTS(wxToolBarMSW::OnMouseEvent)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase)
- EVT_SIZE(wxToolBar95::OnSize)
- EVT_PAINT(wxToolBar95::OnPaint)
- EVT_KILL_FOCUS(wxToolBar95::OnKillFocus)
- EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent)
+ EVT_SIZE(wxToolBar95::OnSize)
+ EVT_PAINT(wxToolBar95::OnPaint)
+ EVT_KILL_FOCUS(wxToolBar95::OnKillFocus)
+ EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent)
EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged)
END_EVENT_TABLE()
#endif
BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel)
- EVT_SIZE(wxGenericGrid::OnSize)
- EVT_PAINT(wxGenericGrid::OnPaint)
- EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent)
+ EVT_SIZE(wxGenericGrid::OnSize)
+ EVT_PAINT(wxGenericGrid::OnPaint)
+ EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent)
EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText)
EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll)
EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll)
#if !defined(wx_msw) || USE_GENERIC_DIALOGS_IN_MSW
BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog)
- EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes)
- EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo)
- EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel)
+ EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes)
+ EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo)
+ EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog)
- EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom)
- EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider)
- EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider)
- EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider)
- EVT_PAINT(wxGenericColourDialog::OnPaint)
- EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent)
+ EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom)
+ EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider)
+ EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider)
+ EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider)
+ EVT_PAINT(wxGenericColourDialog::OnPaint)
+ EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog)
- EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont)
- EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont)
- EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont)
- EVT_CHOICE(wxID_FONT_FAMILY, wxGenericFontDialog::OnChangeFont)
- EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont)
- EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont)
- EVT_PAINT(wxGenericFontDialog::OnPaint)
+ EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont)
+ EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont)
+ EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont)
+ EVT_CHOICE(wxID_FONT_FAMILY, wxGenericFontDialog::OnChangeFont)
+ EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont)
+ EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont)
+ EVT_PAINT(wxGenericFontDialog::OnPaint)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog)
#endif
BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog)
- EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK)
+ EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog)
- EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK)
+ EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK)
END_EVENT_TABLE()
#include "wx/prntbase.h"
BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog)
- EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
+ EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxPreviewControlBar, wxWindow)
- EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose)
- EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint)
- EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious)
- EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext)
- EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom)
+ EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose)
+ EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint)
+ EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious)
+ EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext)
+ EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom)
END_EVENT_TABLE()
#endif
// Created: 01/02/97
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxDialog)
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
- const wxString& defaultDir, const wxString& defaultFileName,
- const wxString& wildCard,
+ const wxString& defaultDir, const wxString& defaultFileName,
+ const wxString& wildCard,
long style, const wxPoint& pos )
{
m_needParent = FALSE;
-
+
PreCreation( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, "filedialog" );
m_message = message;
m_path = "";
m_wildCard = wildCard;
m_dialogStyle = style;
m_filterIndex = 1;
-
+
m_widget = gtk_file_selection_new( "File selection" );
int x = (gdk_screen_width () - 400) / 2;
m_path.Append(m_fileName);
if(m_path.Length()>1) gtk_file_selection_set_filename(sel,m_path);
-
- gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked",
+
+ gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked",
GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this );
- gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked",
+ gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked",
GTK_SIGNAL_FUNC(gtk_filedialog_cancel_callback), (gpointer*)this );
};
};
return ret;
};
-
+
char *wxFileSelector(const char *title,
const char *defaultDir, const char *defaultFileName,
const char *defaultExtension, const char *filter, int flags,
wxWindow *parent, int x, int y)
{
- wxString filter2("");
- if ( defaultExtension && !filter )
- filter2 = wxString("*.") + wxString(defaultExtension) ;
- else if ( filter )
- filter2 = filter;
-
- wxString defaultDirString;
- if (defaultDir)
- defaultDirString = defaultDir;
- else
- defaultDirString = "";
-
- wxString defaultFilenameString;
- if (defaultFileName)
- defaultFilenameString = defaultFileName;
- else
- defaultFilenameString = "";
-
- wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString,
- filter2, flags, wxPoint(x, y));
-
- if ( fileDialog.ShowModal() == wxID_OK )
- {
- strcpy(wxBuffer, (const char *)fileDialog.GetPath());
- return wxBuffer;
- }
- else
- return NULL;
+ wxString filter2("");
+ if ( defaultExtension && !filter )
+ filter2 = wxString("*.") + wxString(defaultExtension) ;
+ else if ( filter )
+ filter2 = filter;
+
+ wxString defaultDirString;
+ if (defaultDir)
+ defaultDirString = defaultDir;
+ else
+ defaultDirString = "";
+
+ wxString defaultFilenameString;
+ if (defaultFileName)
+ defaultFilenameString = defaultFileName;
+ else
+ defaultFilenameString = "";
+
+ wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString,
+ filter2, flags, wxPoint(x, y));
+
+ if ( fileDialog.ShowModal() == wxID_OK )
+ {
+ strcpy(wxBuffer, (const char *)fileDialog.GetPath());
+ return wxBuffer;
+ }
+ else
+ 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,
wxWindow *parent )
{
char *ext = (char *)extension;
-
+
char prompt[50];
wxString str = _("Load %s file");
sprintf(prompt, str, what);
return wxFileSelector (prompt, NULL, default_name, ext, wild, 0, parent);
};
-char* wxSaveFileSelector(const char *what, const char *extension, const char *default_name,
+char* wxSaveFileSelector(const char *what, const char *extension, const char *default_name,
wxWindow *parent )
{
char *ext = (char *)extension;
-
+
char prompt[50];
wxString str = _("Save %s file");
sprintf(prompt, str, what);
"wxDEFAULT", "wxNORMAL", "wxBOLD", "wxLIGHT",
};
-extern wxFontNameDirectory wxTheFontNameDirectory;
+extern wxFontNameDirectory *wxTheFontNameDirectory;
//-----------------------------------------------------------------------------
// wxFont
if ((M_FONTDATA->m_faceName = (Face) ? copystring(Face) : (char*)NULL) )
{
- M_FONTDATA->m_fontId = wxTheFontNameDirectory.FindOrCreateFontId( Face, FontIdOrFamily );
- M_FONTDATA->m_family = wxTheFontNameDirectory.GetFamily( FontIdOrFamily );
+ M_FONTDATA->m_fontId = wxTheFontNameDirectory->FindOrCreateFontId( Face, FontIdOrFamily );
+ M_FONTDATA->m_family = wxTheFontNameDirectory->GetFamily( FontIdOrFamily );
}
else
{
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_weight = Weight;
{
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_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_weight = Weight;
M_FONTDATA->m_pointSize = PointSize;
wxString wxFont::GetFaceString(void) const
{
- wxString s = wxTheFontNameDirectory.GetFontName( M_FONTDATA->m_fontId );
+ wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s;
};
wxString wxFont::GetFaceName(void) const
{
- wxString s = wxTheFontNameDirectory.GetFontName( M_FONTDATA->m_fontId );
+ wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s;
};
int weight, bool WXUNUSED(underlined))
{
char buffer[512];
- char *name = wxTheFontNameDirectory.GetScreenName( fontid, weight, style );
+ char *name = wxTheFontNameDirectory->GetScreenName( fontid, weight, style );
if (!name)
name = "-*-*-*-*-*-*-*-%d-*-*-*-*-*-*";
{
table = new wxHashTable(wxKEY_INTEGER, 20);
nextFontId = -1;
- Initialize();
}
wxFontNameDirectory::~wxFontNameDirectory()
// Created: 01/02/97
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
}
event.SetEventObject( listbox );
+
listbox->GetEventHandler()->ProcessEvent( event );
if (event.m_commandString) delete[] event.m_commandString ;
};
// Created: 01/02/97
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
//-----------------------------------------------------------------------------
static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
-{
+{
if ((win->m_x == alloc->x) &&
(win->m_y == alloc->y) &&
(win->m_width == alloc->width) &&
{
return;
};
-
+
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
};
long style, const wxString& name )
{
wxFrame::Create( parent, id, title, pos, size, style, name );
-
+
OnCreateClient();
-
+
return TRUE;
};
void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height )
{
wxFrame::GtkOnSize( x, y, width, height );
-
+
if (m_mdiMenuBar)
{
int x = 0;
int y = 0;
GetClientSize( &x, &y );
- m_mdiMenuBar->SetSize( 1, 1, x-2, 26 );
+ m_mdiMenuBar->SetSize( 1, 1, x-2, 26 );
}
};
int x = 0;
int y = 0;
GetClientSize( &x, &y );
- m_mdiMenuBar->SetSize( 1, 1, x-2, 26 );
+ m_mdiMenuBar->SetSize( 1, 1, x-2, 26 );
m_mdiMenuBar->Show( TRUE );
}
};
void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
{
m_menuBar = menu_bar;
-
+
if (m_menuBar)
{
wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent;
-
+
if (m_menuBar->m_parent != this)
{
wxNode *node = m_menuBar->m_menus.First();
SetInvokingWindow( menu, this );
node = node->Next();
};
-
+
m_menuBar->m_parent = mdi_frame;
}
mdi_frame->SetMDIMenuBar( m_menuBar );
bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
{
m_needParent = TRUE;
-
+
PreCreation( parent, -1, wxPoint(10,10), wxSize(100,100), style, "wxMDIClientWindow" );
m_widget = gtk_notebook_new();
-
+
gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page",
GTK_SIGNAL_FUNC(gtk_page_change_callback), (gpointer)this );
-
+
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
-
+
PostCreation();
-
+
Show( TRUE );
-
+
return TRUE;
};
wxFAIL_MSG("wxNotebook::AddChild: Child has to be wxMDIChildFrame");
return;
};
-
+
m_children.Append( child );
-
+
wxString s;
wxMDIChildFrame* mdi_child = (wxMDIChildFrame*) child;
s = mdi_child->m_title;
if (s.IsNull()) s = "MDI child";
-
+
GtkWidget *label_widget;
label_widget = gtk_label_new( s );
gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 );
-
+
gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), child->m_widget, label_widget );
-
+
mdi_child->m_page = (GtkNotebookPage*) (g_list_last(GTK_NOTEBOOK(m_widget)->children)->data);
-
+
gtk_notebook_set_page( GTK_NOTEBOOK(m_widget), m_children.Number()-1 );
gtk_page_change_callback( NULL, mdi_child->m_page, 0, this );
void wxRadioBox::SetLabel( const wxString& WXUNUSED(label) )
{
+ wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
};
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) )
{
+ wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
};
wxString wxRadioBox::GetLabel( int WXUNUSED(item) ) const
{
+ wxFAIL_MSG("wxRadioBox::GetLabel not implemented.");
return "";
};
void wxRadioBox::Enable( bool WXUNUSED(enable) )
{
+ wxFAIL_MSG("wxRadioBox::Enable not implemented.");
};
void wxRadioBox::Enable( int WXUNUSED(item), bool WXUNUSED(enable) )
{
+ wxFAIL_MSG("wxRadioBox::Enable not implemented.");
};
void wxRadioBox::Show( int WXUNUSED(item), bool WXUNUSED(show) )
{
+ wxFAIL_MSG("wxRadioBox::Show not implemented.");
};
wxString wxRadioBox::GetStringSelection(void) const
void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
{
+ wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented.");
};
wxColour *g_systemBtnHighlightColour = 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 )
{
switch (index)
return *wxWHITE;
};
-wxFont *g_systemFont = NULL;
-
wxFont wxSystemSettings::GetSystemFont( int index )
{
switch (index)
// Author: Robert Roebling
// Modified by:
// Created: 01/02/97
-// RCS-ID:
+// RCS-ID:
// Copyright: (c) Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool,wxObject)
-
-wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
+
+wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
const wxBitmap& bitmap1, const wxBitmap& bitmap2,
bool toggle, wxObject *clientData,
const wxString& shortHelpString, const wxString& longHelpString )
m_deleteSecondBitmap = FALSE;
};
-wxToolBarTool::~wxToolBarTool(void)
+wxToolBarTool::~wxToolBarTool()
{
};
static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *tool )
{
if (!tool->m_enabled) return;
-
+
if (tool->m_isToggle) tool->m_toggleState = !tool->m_toggleState;
-
+
tool->m_owner->OnLeftClick( tool->m_index, tool->m_toggleState );
};
BEGIN_EVENT_TABLE(wxToolBar, wxControl)
END_EVENT_TABLE()
-wxToolBar::wxToolBar(void)
+wxToolBar::wxToolBar()
{
};
-wxToolBar::wxToolBar( wxWindow *parent, wxWindowID id,
+wxToolBar::wxToolBar( wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name )
{
Create( parent, id, pos, size, style, name );
};
-wxToolBar::~wxToolBar(void)
+wxToolBar::~wxToolBar()
{
};
-bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
+bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name )
{
m_needParent = TRUE;
-
+
PreCreation( parent, id, pos, size, style, name );
m_tools.DeleteContents( TRUE );
-
+
m_widget = gtk_handle_box_new();
-
+
m_toolbar = GTK_TOOLBAR( gtk_toolbar_new( GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS ) );
-
+
gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) );
-
+
gtk_widget_show( GTK_WIDGET(m_toolbar) );
-
+
PostCreation();
-
+
Show( TRUE );
-
+
return TRUE;
};
GetEventHandler()->ProcessEvent(event);
};
-wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
+wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
const wxBitmap& pushedBitmap, bool toggle,
float WXUNUSED(xPos), float WXUNUSED(yPos), wxObject *clientData,
const wxString& helpString1, const wxString& helpString2 )
{
if (!bitmap.Ok()) return NULL;
-
- wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap, toggle,
+
+ wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap, toggle,
clientData, helpString1, helpString2 );
-
+
GdkPixmap *pixmap = bitmap.GetPixmap();
-
+
GdkBitmap *mask = NULL;
if (bitmap.GetMask()) mask = bitmap.GetMask()->GetBitmap();
-
+
GtkWidget *tool_pixmap = gtk_pixmap_new( pixmap, mask );
gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 );
-
+
GtkToolbarChildType ctype = GTK_TOOLBAR_CHILD_BUTTON;
if (toggle) ctype = GTK_TOOLBAR_CHILD_TOGGLEBUTTON;
-
- gtk_toolbar_append_element( m_toolbar,
+
+ gtk_toolbar_append_element( m_toolbar,
ctype, NULL, NULL, helpString1, "", tool_pixmap, (GtkSignalFunc)gtk_toolbar_callback, (gpointer)tool );
-
- m_tools.Append( tool );
-
+
+ m_tools.Append( tool );
+
return tool;
};
// Created: 01/02/97
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include <X11/Xutil.h>
#include <X11/Xresource.h>
+#include "wx/log.h"
//-----------------------------------------------------------------------------
// constants
// glabal data (data.cpp)
//-----------------------------------------------------------------------------
-extern wxList wxResourceCache;
+extern wxResourceCache *wxTheResourceCache;
extern XrmDatabase wxResourceDatabase;
//-----------------------------------------------------------------------------
static char *GetResourcePath(char *buf, char *name, bool create)
{
if (create && FileExists(name)) {
- strcpy(buf, name);
- return buf; // Exists so ...
+ strcpy(buf, name);
+ return buf; // Exists so ...
}
if (*name == '/')
- strcpy(buf, name);
+ strcpy(buf, name);
else {
- // Put in standard place for resource files if not absolute
- strcpy(buf, DEFAULT_XRESOURCE_DIR);
- strcat(buf, "/");
- strcat(buf, FileNameFromPath(name));
+ // Put in standard place for resource files if not absolute
+ strcpy(buf, DEFAULT_XRESOURCE_DIR);
+ strcat(buf, "/");
+ strcat(buf, FileNameFromPath(name));
}
if (create) {
- // Touch the file to create it
- FILE *fd = fopen(buf, "w");
- if (fd) fclose(fd);
+ // Touch the file to create it
+ FILE *fd = fopen(buf, "w");
+ if (fd) fclose(fd);
}
return buf;
}
static char *GetIniFile(char *dest, const char *filename)
{
char *home = NULL;
- if (filename && wxIsAbsolutePath(filename))
+ if (filename && wxIsAbsolutePath(filename))
{
strcpy(dest, filename);
- }
+ }
else
{
- if ((home = wxGetUserHome(wxString())) != NULL)
+ if ((home = wxGetUserHome(wxString())) != NULL)
{
- strcpy(dest, home);
- if (dest[strlen(dest) - 1] != '/') strcat(dest, "/");
- if (filename == NULL)
- {
- if ((filename = getenv("XENVIRONMENT")) == NULL) filename = ".Xdefaults";
- }
- else
- if (*filename != '.') strcat(dest, ".");
- strcat(dest, filename);
+ strcpy(dest, home);
+ if (dest[strlen(dest) - 1] != '/') strcat(dest, "/");
+ if (filename == NULL)
+ {
+ if ((filename = getenv("XENVIRONMENT")) == NULL) filename = ".Xdefaults";
+ }
+ else
+ if (*filename != '.') strcat(dest, ".");
+ strcat(dest, filename);
}
- else
+ else
{
- dest[0] = '\0';
+ dest[0] = '\0';
}
}
return dest;
(void)strcpy(name, "/usr/lib/X11/app-defaults/");
(void)strcat(name, classname ? classname : "wxWindows");
- // Get application defaults file, if any
+ // Get application defaults file, if any
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
// window when the server initializes and loaded into the display
// structure on XOpenDisplay;
// if not defined, use .Xdefaults
if (XResourceManagerString(GDK_DISPLAY()) != NULL) {
- serverDB = XrmGetStringDatabase(XResourceManagerString(GDK_DISPLAY()));
+ serverDB = XrmGetStringDatabase(XResourceManagerString(GDK_DISPLAY()));
} else {
- (void)GetIniFile(filename, NULL);
- serverDB = XrmGetFileDatabase(filename);
+ (void)GetIniFile(filename, NULL);
+ serverDB = XrmGetFileDatabase(filename);
}
if (serverDB)
- XrmMergeDatabases(serverDB, &wxResourceDatabase);
+ XrmMergeDatabases(serverDB, &wxResourceDatabase);
// Open XENVIRONMENT file, or if not defined, the .Xdefaults,
// and merge into existing database
if ((environment = getenv("XENVIRONMENT")) == NULL) {
- size_t len;
- environment = GetIniFile(filename, NULL);
- len = strlen(environment);
+ size_t len;
+ environment = GetIniFile(filename, NULL);
+ len = strlen(environment);
#if !defined(SVR4) || defined(__sgi)
- (void)gethostname(environment + len, 1024 - len);
+ (void)gethostname(environment + len, 1024 - len);
#else
- (void)sysinfo(SI_HOSTNAME, environment + len, 1024 - len);
+ (void)sysinfo(SI_HOSTNAME, environment + len, 1024 - len);
#endif
}
if ((homeDB = XrmGetFileDatabase(environment)))
- XrmMergeDatabases(homeDB, &wxResourceDatabase);
+ XrmMergeDatabases(homeDB, &wxResourceDatabase);
}
//-----------------------------------------------------------------------------
{
char nameBuffer[512];
- wxNode *node = wxResourceCache.First();
+ wxNode *node = wxTheResourceCache->First();
while (node) {
- char *file = node->key.string;
- // If file doesn't exist, create it first.
- (void)GetResourcePath(nameBuffer, file, TRUE);
-
- XrmDatabase database = (XrmDatabase)node->Data();
- XrmPutFileDatabase(database, nameBuffer);
- XrmDestroyDatabase(database);
- wxNode *next = node->Next();
- delete node;
- node = next;
+ char *file = node->key.string;
+ // If file doesn't exist, create it first.
+ (void)GetResourcePath(nameBuffer, file, TRUE);
+
+ XrmDatabase database = (XrmDatabase)node->Data();
+ XrmPutFileDatabase(database, nameBuffer);
+ XrmDestroyDatabase(database);
+ wxNode *next = node->Next();
+// delete node;
+ node = next;
}
}
void wxDeleteResources(const char *file)
{
+ wxLogTrace(wxTraceResAlloc, "Delete: Number = %d", wxTheResourceCache->Number());
char buffer[500];
(void)GetIniFile(buffer, file);
- wxNode *node = wxResourceCache.Find(buffer);
+ wxNode *node = wxTheResourceCache->Find(buffer);
if (node) {
- XrmDatabase database = (XrmDatabase)node->Data();
- XrmDestroyDatabase(database);
- delete node;
+ XrmDatabase database = (XrmDatabase)node->Data();
+ XrmDestroyDatabase(database);
+// delete node;
}
}
(void)GetIniFile(buffer, file);
XrmDatabase database;
- wxNode *node = wxResourceCache.Find(buffer);
+ wxNode *node = wxTheResourceCache->Find(buffer);
if (node)
- database = (XrmDatabase)node->Data();
+ database = (XrmDatabase)node->Data();
else {
- database = XrmGetFileDatabase(buffer);
- wxResourceCache.Append(buffer, (wxObject *)database);
+ database = XrmGetFileDatabase(buffer);
+ wxLogTrace(wxTraceResAlloc, "Write: Number = %d", wxTheResourceCache->Number());
+ wxTheResourceCache->Append(buffer, (wxObject *)database);
}
char resName[300];
strcpy(resName, !section.IsNull() ? WXSTRINGCAST section : "wxWindows");
bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file )
{
if (!wxResourceDatabase)
- wxXMergeDatabases();
+ wxXMergeDatabases();
XrmDatabase database;
if (file) {
- char buffer[500];
- // Is this right? Trying to get it to look in the user's
- // home directory instead of current directory -- JACS
- (void)GetIniFile(buffer, file);
-
- wxNode *node = wxResourceCache.Find(buffer);
- if (node)
- database = (XrmDatabase)node->Data();
- else {
- database = XrmGetFileDatabase(buffer);
- wxResourceCache.Append(buffer, (wxObject *)database);
- }
+ char buffer[500];
+ // Is this right? Trying to get it to look in the user's
+ // home directory instead of current directory -- JACS
+ (void)GetIniFile(buffer, file);
+
+ wxNode *node = wxTheResourceCache->Find(buffer);
+ if (node)
+ database = (XrmDatabase)node->Data();
+ else {
+ database = XrmGetFileDatabase(buffer);
+ wxLogTrace(wxTraceResAlloc, "Get: Number = %d", wxTheResourceCache->Number());
+ wxTheResourceCache->Append(buffer, (wxObject *)database);
+ }
} else
- database = wxResourceDatabase;
+ database = wxResourceDatabase;
XrmValue xvalue;
char *str_type[20];
bool success = XrmGetResource(database, buf, "*", str_type, &xvalue);
// Try different combinations of upper/lower case, just in case...
if (!success) {
- buf[0] = (isupper(buf[0]) ? tolower(buf[0]) : toupper(buf[0]));
- success = XrmGetResource(database, buf, "*", str_type, &xvalue);
+ buf[0] = (isupper(buf[0]) ? tolower(buf[0]) : toupper(buf[0]));
+ success = XrmGetResource(database, buf, "*", str_type, &xvalue);
}
if (success) {
- if (*value)
- delete[] *value;
- *value = new char[xvalue.size + 1];
- strncpy(*value, xvalue.addr, (int)xvalue.size);
- return TRUE;
+ if (*value)
+ delete[] *value;
+ *value = new char[xvalue.size + 1];
+ strncpy(*value, xvalue.addr, (int)xvalue.size);
+ return TRUE;
}
return FALSE;
};
char *s = NULL;
bool succ = wxGetResource(section, entry, &s, file);
if (succ) {
- *value = (float)strtod(s, NULL);
- delete[]s;
- return TRUE;
+ *value = (float)strtod(s, NULL);
+ delete[]s;
+ return TRUE;
} else
- return FALSE;
+ return FALSE;
};
bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file )
char *s = NULL;
bool succ = wxGetResource(section, entry, &s, file);
if (succ) {
- *value = strtol(s, NULL, 10);
- delete[]s;
- return TRUE;
+ *value = strtol(s, NULL, 10);
+ delete[]s;
+ return TRUE;
} else
- return FALSE;
+ return FALSE;
};
bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file )
char *s = NULL;
bool succ = wxGetResource(section, entry, &s, file);
if (succ) {
- // Handle True, False here
- // True, Yes, Enables, Set or Activated
- if (*s == 'T' || *s == 'Y' || *s == 'E' || *s == 'S' || *s == 'A')
- *value = TRUE;
- // False, No, Disabled, Reset, Cleared, Deactivated
- else if (*s == 'F' || *s == 'N' || *s == 'D' || *s == 'R' || *s == 'C')
- *value = FALSE;
- // Handle as Integer
- else
- *value = (int)strtol(s, NULL, 10);
- delete[]s;
- return TRUE;
+ // Handle True, False here
+ // True, Yes, Enables, Set or Activated
+ if (*s == 'T' || *s == 'Y' || *s == 'E' || *s == 'S' || *s == 'A')
+ *value = TRUE;
+ // False, No, Disabled, Reset, Cleared, Deactivated
+ else if (*s == 'F' || *s == 'N' || *s == 'D' || *s == 'R' || *s == 'C')
+ *value = FALSE;
+ // Handle as Integer
+ else
+ *value = (int)strtol(s, NULL, 10);
+ delete[]s;
+ return TRUE;
} else
- return FALSE;
+ return FALSE;
};
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
+ m_cursor = NULL;
Create( parent, id, pos, size, style, name );
};
if (m_widget) gtk_widget_destroy( m_widget );
-// delete m_cursor;
+ wxDELETE(m_cursor);
DeleteRelatedConstraints();
if (m_constraints)
m_windowValidator = NULL;
m_windowId = id;
m_sizeSet = FALSE;
- m_cursor = new wxCursor( wxCURSOR_ARROW );
+ if (m_cursor == NULL)
+ m_cursor = new wxCursor( wxCURSOR_ARROW );
m_font = *wxSWISS_FONT;
m_backgroundColour = wxWHITE;
m_foregroundColour = wxBLACK;
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;
if (m_widget->window)
gdk_window_set_cursor( m_widget->window, m_cursor->GetCursor() );
#include "wx/intl.h"
#include "wx/log.h"
#include "wx/memory.h"
+#include "wx/font.h"
+#include "wx/settings.h"
#include "unistd.h"
wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
extern wxList wxPendingDelete;
+extern wxResourceCache *wxTheResourceCache;
//-----------------------------------------------------------------------------
// local functions
(void) wxGetResource("wxWindows", "OsVersion", &wxOsVersion);
#endif
*/
+ wxSystemSettings::Init();
+ wxTheResourceCache = new wxResourceCache(wxKEY_STRING);
+
+ wxTheFontNameDirectory = new wxFontNameDirectory;
+ wxTheFontNameDirectory->Initialize();
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
wxTheColourDatabase->Initialize();
+
+ wxInitializeStockLists();
wxInitializeStockObjects();
// For PostScript printing
g_globalCursor = new wxCursor;
*/
- wxInitializeStockObjects();
+// wxInitializeStockObjects();
};
void wxApp::CommonCleanUp(void)
{
+ wxDELETE(wxTheColourDatabase);
+ wxDELETE(wxThePrintPaperDatabase);
+ wxDELETE(wxThePrintSetupData);
+ wxDELETE(wxTheFontNameDirectory);
wxDeleteStockObjects();
wxFlushResources();
+
+ wxDELETE(wxTheResourceCache);
+
+ wxDeleteStockLists();
+
+ wxSystemSettings::Done();
};
wxLog *wxApp::CreateLogTarget()
wxObject *test_app = app_ini();
wxTheApp = (wxApp*) test_app;
-
-// wxTheApp = (wxApp*)( app_ini() );
};
if (!wxTheApp)
return 0;
};
-// printf( "Programmstart.\n" );
-
wxTheApp->argc = argc;
wxTheApp->argv = argv;
wxTheApp->OnExit();
wxApp::CommonCleanUp();
+
+ wxDELETE(wxTheApp);
#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT
// At this point we want to check if there are any memory
// Created: 01/02/97
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include <X11/Xutil.h>
#include <X11/Xresource.h>
-wxList wxResourceCache(wxKEY_STRING);
+wxResourceCache *wxTheResourceCache = NULL;
XrmDatabase wxResourceDatabase;
// Useful buffer, initialized in wxCommonInit
// X only font names
-wxFontNameDirectory wxTheFontNameDirectory;
+wxFontNameDirectory *wxTheFontNameDirectory;
// Stock objects
wxFont *wxNORMAL_FONT;
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow)
BEGIN_EVENT_TABLE(wxStatusBar, wxWindow)
- EVT_PAINT(wxStatusBar::OnPaint)
+ EVT_PAINT(wxStatusBar::OnPaint)
EVT_SYS_COLOUR_CHANGED(wxStatusBar::OnSysColourChanged)
END_EVENT_TABLE()
const wxEventTable *wxEvtHandler::GetEventTable() const { return &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 } };
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
- EVT_ACTIVATE(wxFrame::OnActivate)
- EVT_SIZE(wxFrame::OnSize)
- EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
- EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
- EVT_IDLE(wxFrame::OnIdle)
- EVT_CLOSE(wxFrame::OnCloseWindow)
+ EVT_SIZE(wxFrame::OnSize)
+ EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
+ EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
+ EVT_IDLE(wxFrame::OnIdle)
+ EVT_CLOSE(wxFrame::OnCloseWindow)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxDialog, wxPanel)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
- EVT_CHAR(wxTextCtrl::OnChar)
- EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
- EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
+ EVT_CHAR(wxTextCtrl::OnChar)
+ EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
+ EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
END_EVENT_TABLE()
#ifdef wx_msw
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxToolBarSimple, wxToolBarBase)
- EVT_SIZE(wxToolBarSimple::OnSize)
- EVT_PAINT(wxToolBarSimple::OnPaint)
- EVT_KILL_FOCUS(wxToolBarSimple::OnKillFocus)
- EVT_MOUSE_EVENTS(wxToolBarSimple::OnMouseEvent)
+ EVT_SIZE(wxToolBarSimple::OnSize)
+ EVT_PAINT(wxToolBarSimple::OnPaint)
+ EVT_KILL_FOCUS(wxToolBarSimple::OnKillFocus)
+ EVT_MOUSE_EVENTS(wxToolBarSimple::OnMouseEvent)
END_EVENT_TABLE()
#ifdef wx_msw
BEGIN_EVENT_TABLE(wxToolBarMSW, wxToolBarBase)
- EVT_SIZE(wxToolBarMSW::OnSize)
- EVT_PAINT(wxToolBarMSW::OnPaint)
- EVT_MOUSE_EVENTS(wxToolBarMSW::OnMouseEvent)
+ EVT_SIZE(wxToolBarMSW::OnSize)
+ EVT_PAINT(wxToolBarMSW::OnPaint)
+ EVT_MOUSE_EVENTS(wxToolBarMSW::OnMouseEvent)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase)
- EVT_SIZE(wxToolBar95::OnSize)
- EVT_PAINT(wxToolBar95::OnPaint)
- EVT_KILL_FOCUS(wxToolBar95::OnKillFocus)
- EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent)
+ EVT_SIZE(wxToolBar95::OnSize)
+ EVT_PAINT(wxToolBar95::OnPaint)
+ EVT_KILL_FOCUS(wxToolBar95::OnKillFocus)
+ EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent)
EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged)
END_EVENT_TABLE()
#endif
BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel)
- EVT_SIZE(wxGenericGrid::OnSize)
- EVT_PAINT(wxGenericGrid::OnPaint)
- EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent)
+ EVT_SIZE(wxGenericGrid::OnSize)
+ EVT_PAINT(wxGenericGrid::OnPaint)
+ EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent)
EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText)
EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll)
EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll)
#if !defined(wx_msw) || USE_GENERIC_DIALOGS_IN_MSW
BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog)
- EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes)
- EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo)
- EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel)
+ EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes)
+ EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo)
+ EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog)
- EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom)
- EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider)
- EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider)
- EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider)
- EVT_PAINT(wxGenericColourDialog::OnPaint)
- EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent)
+ EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom)
+ EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider)
+ EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider)
+ EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider)
+ EVT_PAINT(wxGenericColourDialog::OnPaint)
+ EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog)
- EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont)
- EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont)
- EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont)
- EVT_CHOICE(wxID_FONT_FAMILY, wxGenericFontDialog::OnChangeFont)
- EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont)
- EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont)
- EVT_PAINT(wxGenericFontDialog::OnPaint)
+ EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont)
+ EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont)
+ EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont)
+ EVT_CHOICE(wxID_FONT_FAMILY, wxGenericFontDialog::OnChangeFont)
+ EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont)
+ EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont)
+ EVT_PAINT(wxGenericFontDialog::OnPaint)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog)
#endif
BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog)
- EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK)
+ EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog)
- EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK)
+ EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK)
END_EVENT_TABLE()
#include "wx/prntbase.h"
BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog)
- EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
+ EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxPreviewControlBar, wxWindow)
- EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose)
- EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint)
- EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious)
- EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext)
- EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom)
+ EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose)
+ EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint)
+ EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious)
+ EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext)
+ EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom)
END_EVENT_TABLE()
#endif
// Created: 01/02/97
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxDialog)
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
- const wxString& defaultDir, const wxString& defaultFileName,
- const wxString& wildCard,
+ const wxString& defaultDir, const wxString& defaultFileName,
+ const wxString& wildCard,
long style, const wxPoint& pos )
{
m_needParent = FALSE;
-
+
PreCreation( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, "filedialog" );
m_message = message;
m_path = "";
m_wildCard = wildCard;
m_dialogStyle = style;
m_filterIndex = 1;
-
+
m_widget = gtk_file_selection_new( "File selection" );
int x = (gdk_screen_width () - 400) / 2;
m_path.Append(m_fileName);
if(m_path.Length()>1) gtk_file_selection_set_filename(sel,m_path);
-
- gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked",
+
+ gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked",
GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this );
- gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked",
+ gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked",
GTK_SIGNAL_FUNC(gtk_filedialog_cancel_callback), (gpointer*)this );
};
};
return ret;
};
-
+
char *wxFileSelector(const char *title,
const char *defaultDir, const char *defaultFileName,
const char *defaultExtension, const char *filter, int flags,
wxWindow *parent, int x, int y)
{
- wxString filter2("");
- if ( defaultExtension && !filter )
- filter2 = wxString("*.") + wxString(defaultExtension) ;
- else if ( filter )
- filter2 = filter;
-
- wxString defaultDirString;
- if (defaultDir)
- defaultDirString = defaultDir;
- else
- defaultDirString = "";
-
- wxString defaultFilenameString;
- if (defaultFileName)
- defaultFilenameString = defaultFileName;
- else
- defaultFilenameString = "";
-
- wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString,
- filter2, flags, wxPoint(x, y));
-
- if ( fileDialog.ShowModal() == wxID_OK )
- {
- strcpy(wxBuffer, (const char *)fileDialog.GetPath());
- return wxBuffer;
- }
- else
- return NULL;
+ wxString filter2("");
+ if ( defaultExtension && !filter )
+ filter2 = wxString("*.") + wxString(defaultExtension) ;
+ else if ( filter )
+ filter2 = filter;
+
+ wxString defaultDirString;
+ if (defaultDir)
+ defaultDirString = defaultDir;
+ else
+ defaultDirString = "";
+
+ wxString defaultFilenameString;
+ if (defaultFileName)
+ defaultFilenameString = defaultFileName;
+ else
+ defaultFilenameString = "";
+
+ wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString,
+ filter2, flags, wxPoint(x, y));
+
+ if ( fileDialog.ShowModal() == wxID_OK )
+ {
+ strcpy(wxBuffer, (const char *)fileDialog.GetPath());
+ return wxBuffer;
+ }
+ else
+ 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,
wxWindow *parent )
{
char *ext = (char *)extension;
-
+
char prompt[50];
wxString str = _("Load %s file");
sprintf(prompt, str, what);
return wxFileSelector (prompt, NULL, default_name, ext, wild, 0, parent);
};
-char* wxSaveFileSelector(const char *what, const char *extension, const char *default_name,
+char* wxSaveFileSelector(const char *what, const char *extension, const char *default_name,
wxWindow *parent )
{
char *ext = (char *)extension;
-
+
char prompt[50];
wxString str = _("Save %s file");
sprintf(prompt, str, what);
"wxDEFAULT", "wxNORMAL", "wxBOLD", "wxLIGHT",
};
-extern wxFontNameDirectory wxTheFontNameDirectory;
+extern wxFontNameDirectory *wxTheFontNameDirectory;
//-----------------------------------------------------------------------------
// wxFont
if ((M_FONTDATA->m_faceName = (Face) ? copystring(Face) : (char*)NULL) )
{
- M_FONTDATA->m_fontId = wxTheFontNameDirectory.FindOrCreateFontId( Face, FontIdOrFamily );
- M_FONTDATA->m_family = wxTheFontNameDirectory.GetFamily( FontIdOrFamily );
+ M_FONTDATA->m_fontId = wxTheFontNameDirectory->FindOrCreateFontId( Face, FontIdOrFamily );
+ M_FONTDATA->m_family = wxTheFontNameDirectory->GetFamily( FontIdOrFamily );
}
else
{
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_weight = Weight;
{
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_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_weight = Weight;
M_FONTDATA->m_pointSize = PointSize;
wxString wxFont::GetFaceString(void) const
{
- wxString s = wxTheFontNameDirectory.GetFontName( M_FONTDATA->m_fontId );
+ wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s;
};
wxString wxFont::GetFaceName(void) const
{
- wxString s = wxTheFontNameDirectory.GetFontName( M_FONTDATA->m_fontId );
+ wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId );
return s;
};
int weight, bool WXUNUSED(underlined))
{
char buffer[512];
- char *name = wxTheFontNameDirectory.GetScreenName( fontid, weight, style );
+ char *name = wxTheFontNameDirectory->GetScreenName( fontid, weight, style );
if (!name)
name = "-*-*-*-*-*-*-*-%d-*-*-*-*-*-*";
{
table = new wxHashTable(wxKEY_INTEGER, 20);
nextFontId = -1;
- Initialize();
}
wxFontNameDirectory::~wxFontNameDirectory()
// Created: 01/02/97
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
}
event.SetEventObject( listbox );
+
listbox->GetEventHandler()->ProcessEvent( event );
if (event.m_commandString) delete[] event.m_commandString ;
};
// Created: 01/02/97
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
//-----------------------------------------------------------------------------
static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
-{
+{
if ((win->m_x == alloc->x) &&
(win->m_y == alloc->y) &&
(win->m_width == alloc->width) &&
{
return;
};
-
+
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
};
long style, const wxString& name )
{
wxFrame::Create( parent, id, title, pos, size, style, name );
-
+
OnCreateClient();
-
+
return TRUE;
};
void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height )
{
wxFrame::GtkOnSize( x, y, width, height );
-
+
if (m_mdiMenuBar)
{
int x = 0;
int y = 0;
GetClientSize( &x, &y );
- m_mdiMenuBar->SetSize( 1, 1, x-2, 26 );
+ m_mdiMenuBar->SetSize( 1, 1, x-2, 26 );
}
};
int x = 0;
int y = 0;
GetClientSize( &x, &y );
- m_mdiMenuBar->SetSize( 1, 1, x-2, 26 );
+ m_mdiMenuBar->SetSize( 1, 1, x-2, 26 );
m_mdiMenuBar->Show( TRUE );
}
};
void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
{
m_menuBar = menu_bar;
-
+
if (m_menuBar)
{
wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent;
-
+
if (m_menuBar->m_parent != this)
{
wxNode *node = m_menuBar->m_menus.First();
SetInvokingWindow( menu, this );
node = node->Next();
};
-
+
m_menuBar->m_parent = mdi_frame;
}
mdi_frame->SetMDIMenuBar( m_menuBar );
bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
{
m_needParent = TRUE;
-
+
PreCreation( parent, -1, wxPoint(10,10), wxSize(100,100), style, "wxMDIClientWindow" );
m_widget = gtk_notebook_new();
-
+
gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page",
GTK_SIGNAL_FUNC(gtk_page_change_callback), (gpointer)this );
-
+
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
-
+
PostCreation();
-
+
Show( TRUE );
-
+
return TRUE;
};
wxFAIL_MSG("wxNotebook::AddChild: Child has to be wxMDIChildFrame");
return;
};
-
+
m_children.Append( child );
-
+
wxString s;
wxMDIChildFrame* mdi_child = (wxMDIChildFrame*) child;
s = mdi_child->m_title;
if (s.IsNull()) s = "MDI child";
-
+
GtkWidget *label_widget;
label_widget = gtk_label_new( s );
gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 );
-
+
gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), child->m_widget, label_widget );
-
+
mdi_child->m_page = (GtkNotebookPage*) (g_list_last(GTK_NOTEBOOK(m_widget)->children)->data);
-
+
gtk_notebook_set_page( GTK_NOTEBOOK(m_widget), m_children.Number()-1 );
gtk_page_change_callback( NULL, mdi_child->m_page, 0, this );
void wxRadioBox::SetLabel( const wxString& WXUNUSED(label) )
{
+ wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
};
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) )
{
+ wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
};
wxString wxRadioBox::GetLabel( int WXUNUSED(item) ) const
{
+ wxFAIL_MSG("wxRadioBox::GetLabel not implemented.");
return "";
};
void wxRadioBox::Enable( bool WXUNUSED(enable) )
{
+ wxFAIL_MSG("wxRadioBox::Enable not implemented.");
};
void wxRadioBox::Enable( int WXUNUSED(item), bool WXUNUSED(enable) )
{
+ wxFAIL_MSG("wxRadioBox::Enable not implemented.");
};
void wxRadioBox::Show( int WXUNUSED(item), bool WXUNUSED(show) )
{
+ wxFAIL_MSG("wxRadioBox::Show not implemented.");
};
wxString wxRadioBox::GetStringSelection(void) const
void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
{
+ wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented.");
};
wxColour *g_systemBtnHighlightColour = 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 )
{
switch (index)
return *wxWHITE;
};
-wxFont *g_systemFont = NULL;
-
wxFont wxSystemSettings::GetSystemFont( int index )
{
switch (index)
// Author: Robert Roebling
// Modified by:
// Created: 01/02/97
-// RCS-ID:
+// RCS-ID:
// Copyright: (c) Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool,wxObject)
-
-wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
+
+wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
const wxBitmap& bitmap1, const wxBitmap& bitmap2,
bool toggle, wxObject *clientData,
const wxString& shortHelpString, const wxString& longHelpString )
m_deleteSecondBitmap = FALSE;
};
-wxToolBarTool::~wxToolBarTool(void)
+wxToolBarTool::~wxToolBarTool()
{
};
static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *tool )
{
if (!tool->m_enabled) return;
-
+
if (tool->m_isToggle) tool->m_toggleState = !tool->m_toggleState;
-
+
tool->m_owner->OnLeftClick( tool->m_index, tool->m_toggleState );
};
BEGIN_EVENT_TABLE(wxToolBar, wxControl)
END_EVENT_TABLE()
-wxToolBar::wxToolBar(void)
+wxToolBar::wxToolBar()
{
};
-wxToolBar::wxToolBar( wxWindow *parent, wxWindowID id,
+wxToolBar::wxToolBar( wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name )
{
Create( parent, id, pos, size, style, name );
};
-wxToolBar::~wxToolBar(void)
+wxToolBar::~wxToolBar()
{
};
-bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
+bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name )
{
m_needParent = TRUE;
-
+
PreCreation( parent, id, pos, size, style, name );
m_tools.DeleteContents( TRUE );
-
+
m_widget = gtk_handle_box_new();
-
+
m_toolbar = GTK_TOOLBAR( gtk_toolbar_new( GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS ) );
-
+
gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) );
-
+
gtk_widget_show( GTK_WIDGET(m_toolbar) );
-
+
PostCreation();
-
+
Show( TRUE );
-
+
return TRUE;
};
GetEventHandler()->ProcessEvent(event);
};
-wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
+wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
const wxBitmap& pushedBitmap, bool toggle,
float WXUNUSED(xPos), float WXUNUSED(yPos), wxObject *clientData,
const wxString& helpString1, const wxString& helpString2 )
{
if (!bitmap.Ok()) return NULL;
-
- wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap, toggle,
+
+ wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap, toggle,
clientData, helpString1, helpString2 );
-
+
GdkPixmap *pixmap = bitmap.GetPixmap();
-
+
GdkBitmap *mask = NULL;
if (bitmap.GetMask()) mask = bitmap.GetMask()->GetBitmap();
-
+
GtkWidget *tool_pixmap = gtk_pixmap_new( pixmap, mask );
gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 );
-
+
GtkToolbarChildType ctype = GTK_TOOLBAR_CHILD_BUTTON;
if (toggle) ctype = GTK_TOOLBAR_CHILD_TOGGLEBUTTON;
-
- gtk_toolbar_append_element( m_toolbar,
+
+ gtk_toolbar_append_element( m_toolbar,
ctype, NULL, NULL, helpString1, "", tool_pixmap, (GtkSignalFunc)gtk_toolbar_callback, (gpointer)tool );
-
- m_tools.Append( tool );
-
+
+ m_tools.Append( tool );
+
return tool;
};
// Created: 01/02/97
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include <X11/Xutil.h>
#include <X11/Xresource.h>
+#include "wx/log.h"
//-----------------------------------------------------------------------------
// constants
// glabal data (data.cpp)
//-----------------------------------------------------------------------------
-extern wxList wxResourceCache;
+extern wxResourceCache *wxTheResourceCache;
extern XrmDatabase wxResourceDatabase;
//-----------------------------------------------------------------------------
static char *GetResourcePath(char *buf, char *name, bool create)
{
if (create && FileExists(name)) {
- strcpy(buf, name);
- return buf; // Exists so ...
+ strcpy(buf, name);
+ return buf; // Exists so ...
}
if (*name == '/')
- strcpy(buf, name);
+ strcpy(buf, name);
else {
- // Put in standard place for resource files if not absolute
- strcpy(buf, DEFAULT_XRESOURCE_DIR);
- strcat(buf, "/");
- strcat(buf, FileNameFromPath(name));
+ // Put in standard place for resource files if not absolute
+ strcpy(buf, DEFAULT_XRESOURCE_DIR);
+ strcat(buf, "/");
+ strcat(buf, FileNameFromPath(name));
}
if (create) {
- // Touch the file to create it
- FILE *fd = fopen(buf, "w");
- if (fd) fclose(fd);
+ // Touch the file to create it
+ FILE *fd = fopen(buf, "w");
+ if (fd) fclose(fd);
}
return buf;
}
static char *GetIniFile(char *dest, const char *filename)
{
char *home = NULL;
- if (filename && wxIsAbsolutePath(filename))
+ if (filename && wxIsAbsolutePath(filename))
{
strcpy(dest, filename);
- }
+ }
else
{
- if ((home = wxGetUserHome(wxString())) != NULL)
+ if ((home = wxGetUserHome(wxString())) != NULL)
{
- strcpy(dest, home);
- if (dest[strlen(dest) - 1] != '/') strcat(dest, "/");
- if (filename == NULL)
- {
- if ((filename = getenv("XENVIRONMENT")) == NULL) filename = ".Xdefaults";
- }
- else
- if (*filename != '.') strcat(dest, ".");
- strcat(dest, filename);
+ strcpy(dest, home);
+ if (dest[strlen(dest) - 1] != '/') strcat(dest, "/");
+ if (filename == NULL)
+ {
+ if ((filename = getenv("XENVIRONMENT")) == NULL) filename = ".Xdefaults";
+ }
+ else
+ if (*filename != '.') strcat(dest, ".");
+ strcat(dest, filename);
}
- else
+ else
{
- dest[0] = '\0';
+ dest[0] = '\0';
}
}
return dest;
(void)strcpy(name, "/usr/lib/X11/app-defaults/");
(void)strcat(name, classname ? classname : "wxWindows");
- // Get application defaults file, if any
+ // Get application defaults file, if any
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
// window when the server initializes and loaded into the display
// structure on XOpenDisplay;
// if not defined, use .Xdefaults
if (XResourceManagerString(GDK_DISPLAY()) != NULL) {
- serverDB = XrmGetStringDatabase(XResourceManagerString(GDK_DISPLAY()));
+ serverDB = XrmGetStringDatabase(XResourceManagerString(GDK_DISPLAY()));
} else {
- (void)GetIniFile(filename, NULL);
- serverDB = XrmGetFileDatabase(filename);
+ (void)GetIniFile(filename, NULL);
+ serverDB = XrmGetFileDatabase(filename);
}
if (serverDB)
- XrmMergeDatabases(serverDB, &wxResourceDatabase);
+ XrmMergeDatabases(serverDB, &wxResourceDatabase);
// Open XENVIRONMENT file, or if not defined, the .Xdefaults,
// and merge into existing database
if ((environment = getenv("XENVIRONMENT")) == NULL) {
- size_t len;
- environment = GetIniFile(filename, NULL);
- len = strlen(environment);
+ size_t len;
+ environment = GetIniFile(filename, NULL);
+ len = strlen(environment);
#if !defined(SVR4) || defined(__sgi)
- (void)gethostname(environment + len, 1024 - len);
+ (void)gethostname(environment + len, 1024 - len);
#else
- (void)sysinfo(SI_HOSTNAME, environment + len, 1024 - len);
+ (void)sysinfo(SI_HOSTNAME, environment + len, 1024 - len);
#endif
}
if ((homeDB = XrmGetFileDatabase(environment)))
- XrmMergeDatabases(homeDB, &wxResourceDatabase);
+ XrmMergeDatabases(homeDB, &wxResourceDatabase);
}
//-----------------------------------------------------------------------------
{
char nameBuffer[512];
- wxNode *node = wxResourceCache.First();
+ wxNode *node = wxTheResourceCache->First();
while (node) {
- char *file = node->key.string;
- // If file doesn't exist, create it first.
- (void)GetResourcePath(nameBuffer, file, TRUE);
-
- XrmDatabase database = (XrmDatabase)node->Data();
- XrmPutFileDatabase(database, nameBuffer);
- XrmDestroyDatabase(database);
- wxNode *next = node->Next();
- delete node;
- node = next;
+ char *file = node->key.string;
+ // If file doesn't exist, create it first.
+ (void)GetResourcePath(nameBuffer, file, TRUE);
+
+ XrmDatabase database = (XrmDatabase)node->Data();
+ XrmPutFileDatabase(database, nameBuffer);
+ XrmDestroyDatabase(database);
+ wxNode *next = node->Next();
+// delete node;
+ node = next;
}
}
void wxDeleteResources(const char *file)
{
+ wxLogTrace(wxTraceResAlloc, "Delete: Number = %d", wxTheResourceCache->Number());
char buffer[500];
(void)GetIniFile(buffer, file);
- wxNode *node = wxResourceCache.Find(buffer);
+ wxNode *node = wxTheResourceCache->Find(buffer);
if (node) {
- XrmDatabase database = (XrmDatabase)node->Data();
- XrmDestroyDatabase(database);
- delete node;
+ XrmDatabase database = (XrmDatabase)node->Data();
+ XrmDestroyDatabase(database);
+// delete node;
}
}
(void)GetIniFile(buffer, file);
XrmDatabase database;
- wxNode *node = wxResourceCache.Find(buffer);
+ wxNode *node = wxTheResourceCache->Find(buffer);
if (node)
- database = (XrmDatabase)node->Data();
+ database = (XrmDatabase)node->Data();
else {
- database = XrmGetFileDatabase(buffer);
- wxResourceCache.Append(buffer, (wxObject *)database);
+ database = XrmGetFileDatabase(buffer);
+ wxLogTrace(wxTraceResAlloc, "Write: Number = %d", wxTheResourceCache->Number());
+ wxTheResourceCache->Append(buffer, (wxObject *)database);
}
char resName[300];
strcpy(resName, !section.IsNull() ? WXSTRINGCAST section : "wxWindows");
bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file )
{
if (!wxResourceDatabase)
- wxXMergeDatabases();
+ wxXMergeDatabases();
XrmDatabase database;
if (file) {
- char buffer[500];
- // Is this right? Trying to get it to look in the user's
- // home directory instead of current directory -- JACS
- (void)GetIniFile(buffer, file);
-
- wxNode *node = wxResourceCache.Find(buffer);
- if (node)
- database = (XrmDatabase)node->Data();
- else {
- database = XrmGetFileDatabase(buffer);
- wxResourceCache.Append(buffer, (wxObject *)database);
- }
+ char buffer[500];
+ // Is this right? Trying to get it to look in the user's
+ // home directory instead of current directory -- JACS
+ (void)GetIniFile(buffer, file);
+
+ wxNode *node = wxTheResourceCache->Find(buffer);
+ if (node)
+ database = (XrmDatabase)node->Data();
+ else {
+ database = XrmGetFileDatabase(buffer);
+ wxLogTrace(wxTraceResAlloc, "Get: Number = %d", wxTheResourceCache->Number());
+ wxTheResourceCache->Append(buffer, (wxObject *)database);
+ }
} else
- database = wxResourceDatabase;
+ database = wxResourceDatabase;
XrmValue xvalue;
char *str_type[20];
bool success = XrmGetResource(database, buf, "*", str_type, &xvalue);
// Try different combinations of upper/lower case, just in case...
if (!success) {
- buf[0] = (isupper(buf[0]) ? tolower(buf[0]) : toupper(buf[0]));
- success = XrmGetResource(database, buf, "*", str_type, &xvalue);
+ buf[0] = (isupper(buf[0]) ? tolower(buf[0]) : toupper(buf[0]));
+ success = XrmGetResource(database, buf, "*", str_type, &xvalue);
}
if (success) {
- if (*value)
- delete[] *value;
- *value = new char[xvalue.size + 1];
- strncpy(*value, xvalue.addr, (int)xvalue.size);
- return TRUE;
+ if (*value)
+ delete[] *value;
+ *value = new char[xvalue.size + 1];
+ strncpy(*value, xvalue.addr, (int)xvalue.size);
+ return TRUE;
}
return FALSE;
};
char *s = NULL;
bool succ = wxGetResource(section, entry, &s, file);
if (succ) {
- *value = (float)strtod(s, NULL);
- delete[]s;
- return TRUE;
+ *value = (float)strtod(s, NULL);
+ delete[]s;
+ return TRUE;
} else
- return FALSE;
+ return FALSE;
};
bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file )
char *s = NULL;
bool succ = wxGetResource(section, entry, &s, file);
if (succ) {
- *value = strtol(s, NULL, 10);
- delete[]s;
- return TRUE;
+ *value = strtol(s, NULL, 10);
+ delete[]s;
+ return TRUE;
} else
- return FALSE;
+ return FALSE;
};
bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file )
char *s = NULL;
bool succ = wxGetResource(section, entry, &s, file);
if (succ) {
- // Handle True, False here
- // True, Yes, Enables, Set or Activated
- if (*s == 'T' || *s == 'Y' || *s == 'E' || *s == 'S' || *s == 'A')
- *value = TRUE;
- // False, No, Disabled, Reset, Cleared, Deactivated
- else if (*s == 'F' || *s == 'N' || *s == 'D' || *s == 'R' || *s == 'C')
- *value = FALSE;
- // Handle as Integer
- else
- *value = (int)strtol(s, NULL, 10);
- delete[]s;
- return TRUE;
+ // Handle True, False here
+ // True, Yes, Enables, Set or Activated
+ if (*s == 'T' || *s == 'Y' || *s == 'E' || *s == 'S' || *s == 'A')
+ *value = TRUE;
+ // False, No, Disabled, Reset, Cleared, Deactivated
+ else if (*s == 'F' || *s == 'N' || *s == 'D' || *s == 'R' || *s == 'C')
+ *value = FALSE;
+ // Handle as Integer
+ else
+ *value = (int)strtol(s, NULL, 10);
+ delete[]s;
+ return TRUE;
} else
- return FALSE;
+ return FALSE;
};
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
+ m_cursor = NULL;
Create( parent, id, pos, size, style, name );
};
if (m_widget) gtk_widget_destroy( m_widget );
-// delete m_cursor;
+ wxDELETE(m_cursor);
DeleteRelatedConstraints();
if (m_constraints)
m_windowValidator = NULL;
m_windowId = id;
m_sizeSet = FALSE;
- m_cursor = new wxCursor( wxCURSOR_ARROW );
+ if (m_cursor == NULL)
+ m_cursor = new wxCursor( wxCURSOR_ARROW );
m_font = *wxSWISS_FONT;
m_backgroundColour = wxWHITE;
m_foregroundColour = wxBLACK;
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;
if (m_widget->window)
gdk_window_set_cursor( m_widget->window, m_cursor->GetCursor() );
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
-// Licence: wxWindows license
+// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
}
}
#endif //WXDEBUG
+
+#include "../common/wincmn.cpp"