More deprecated class mods

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19900 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2003-03-31 10:24:36 +00:00
parent f2638c97a5
commit 7c9955d147
103 changed files with 466 additions and 11735 deletions

View File

@@ -1,68 +0,0 @@
/* //////////////////////////////////////////////////////////////////////////
// Name: expr.h
// Purpose: C helper defines and functions for wxExpr class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c)
// Licence: wxWindows licence
////////////////////////////////////////////////////////////////////////// */
#ifndef _WX_EXPRH__
#define _WX_EXPRH__
#include <math.h>
#if defined(__VISAGECPP__) && __IBMCPP__ >= 400
# undef __BSEXCPT__
#endif
#include <stdlib.h>
#ifdef ____HPUX__
#define alloca malloc
#endif
#ifdef __cplusplus
extern "C" {
char *proio_cons(char *, char *);
char * wxmake_integer(char *);
char * wxmake_word(char *);
char * wxmake_string(char *);
char * wxmake_real(char *, char *);
char * wxmake_exp(char *, char *);
char * wxmake_exp2(char *, char *, char*);
void add_expr(char *);
void process_command(char *);
void syntax_error(char *);
}
#else
#if defined(__BORLANDC__) || defined(__VISAGECPP__)
char *proio_cons(char *, char *);
char * wxmake_integer(char *);
char * wxmake_word(char *);
char * wxmake_string(char *);
char * wxmake_real(char *, char *);
char * wxmake_exp(char *, char *);
char * wxmake_exp2(char *, char *, char*);
void add_expr(char *);
void process_command(char *);
void syntax_error(char *);
int lex_input(void);
#else
char *proio_cons();
char * wxmake_integer();
char * wxmake_word();
char * wxmake_string();
char * wxmake_real();
char * wxmake_exp();
char * wxmake_exp2();
void add_expr();
void process_command();
void syntax_error();
#endif
#endif
#endif
/* _WX_EXPRH__ */

View File

@@ -1,208 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: resource.h
// Purpose: Resource processing
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_RESOURCEH__
#define _WX_RESOURCEH__
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "resource.h"
#endif
#include "wx/setup.h"
#if wxUSE_WX_RESOURCES
#include "wx/bitmap.h"
#include <stdio.h>
// A few further types not in wx_types.h
#define wxRESOURCE_TYPE_SEPARATOR 1000
#define wxRESOURCE_TYPE_XBM_DATA 1001
#define wxRESOURCE_TYPE_XPM_DATA 1002
#define RESOURCE_PLATFORM_WINDOWS 1
#define RESOURCE_PLATFORM_X 2
#define RESOURCE_PLATFORM_MAC 3
#define RESOURCE_PLATFORM_ANY 4
// Extended styles: for resource usage only
// Use dialog units instead of pixels
#define wxRESOURCE_DIALOG_UNITS 0x0001
// Use default system colour and font
#define wxRESOURCE_USE_DEFAULTS 0x0002
// Old-style vertical label
#define wxRESOURCE_VERTICAL_LABEL 0x0004
// Old-style horizontal label
#define wxRESOURCE_HORIZONTAL_LABEL 0x0008
// Macros to help use dialog units
#define wxDLG_POINT(x, y, parent, useDlgUnits) (useDlgUnits ? parent->ConvertDialogToPixel(wxPoint(x, y)) : wxPoint(x, y))
#define wxDLG_SIZE(x, y, parent, useDlgUnits) (useDlgUnits ? parent->ConvertDialogToPixel(wxSize(x, y)) : wxSize(x, y))
#ifdef FindResource
#undef FindResource
#endif
class WXDLLEXPORT wxInputStream;
/*
* Internal format for control/panel item
*/
class WXDLLEXPORT wxItemResource: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxItemResource)
public:
wxItemResource();
~wxItemResource();
inline void SetType(const wxString& type) { m_itemType = type; }
inline void SetStyle(long styl) { m_windowStyle = styl; }
inline void SetId(int id) { m_windowId = id; }
inline void SetBitmap(const wxBitmap& bm) { m_bitmap = bm; }
inline wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; }
inline void SetFont(const wxFont& font) { m_windowFont = font; }
inline wxFont& GetFont() const { return (wxFont&) m_windowFont; }
inline void SetSize(int xx, int yy, int ww, int hh)
{ m_x = xx; m_y = yy; m_width = ww; m_height = hh; }
inline void SetTitle(const wxString& title) { m_title = title; }
inline void SetName(const wxString& name) { m_name = name; }
inline void SetValue1(long v) { m_value1 = v; }
inline void SetValue2(long v) { m_value2 = v; }
inline void SetValue3(long v) { m_value3 = v; }
inline void SetValue5(long v) { m_value5 = v; }
inline void SetValue4(const wxString& v) { m_value4 = v; }
inline void SetStringValues(const wxStringList& svalues) { m_stringValues = svalues; }
inline const wxString& GetType() const { return m_itemType; }
inline int GetX() const { return m_x; }
inline int GetY() const { return m_y; }
inline int GetWidth() const { return m_width; }
inline int GetHeight() const { return m_height; }
inline const wxString& GetTitle() const { return m_title; }
inline const wxString& GetName() const { return m_name; }
inline long GetStyle() const { return m_windowStyle; }
inline int GetId() const { return m_windowId; }
inline wxInt32 GetValue1() const { return m_value1; }
inline wxInt32 GetValue2() const { return m_value2; }
inline wxInt32 GetValue3() const { return m_value3; }
inline wxInt32 GetValue5() const { return m_value5; }
inline wxString GetValue4() const { return m_value4; }
inline wxList& GetChildren() const { return (wxList&) m_children; }
inline wxStringList& GetStringValues() const { return (wxStringList&) m_stringValues; }
inline void SetBackgroundColour(const wxColour& col) { m_backgroundColour = col; }
inline void SetLabelColour(const wxColour& col) { m_labelColour = col; }
inline void SetButtonColour(const wxColour& col) { m_buttonColour = col; }
inline wxColour& GetBackgroundColour() const { return (wxColour&) m_backgroundColour; }
inline wxColour& GetLabelColour() const { return (wxColour&) m_labelColour; }
inline wxColour& GetButtonColour() const { return (wxColour&) m_buttonColour; }
inline void SetResourceStyle(long style) { m_exStyle = style; }
inline wxInt32 GetResourceStyle() const { return m_exStyle; }
protected:
wxList m_children;
wxString m_itemType;
int m_x, m_y, m_width, m_height;
wxString m_title;
wxString m_name;
long m_windowStyle;
long m_value1, m_value2, m_value3, m_value5;
wxString m_value4;
int m_windowId;
wxStringList m_stringValues; // Optional string values
wxBitmap m_bitmap;
wxColour m_backgroundColour;
wxColour m_labelColour;
wxColour m_buttonColour;
wxFont m_windowFont;
long m_exStyle; // Extended, resource-specific styles
};
/*
* Resource table (normally only one of these)
*/
class WXDLLEXPORT wxResourceTable: public wxHashTable
{
DECLARE_DYNAMIC_CLASS(wxResourceTable)
protected:
public:
wxHashTable identifiers;
wxResourceTable();
~wxResourceTable();
virtual wxItemResource *FindResource(const wxString& name) const;
virtual void AddResource(wxItemResource *item);
virtual bool DeleteResource(const wxString& name);
virtual bool ParseResourceFile(const wxString& filename);
virtual bool ParseResourceFile(wxInputStream *is);
virtual bool ParseResourceData(const wxString& data);
virtual bool SaveResource(const wxString& filename);
// Register XBM/XPM data
virtual bool RegisterResourceBitmapData(const wxString& name, char bits[], int width, int height);
virtual bool RegisterResourceBitmapData(const wxString& name, char **data);
virtual wxControl *CreateItem(wxWindow *panel, const wxItemResource* childResource, const wxItemResource* parentResource) const;
virtual void ClearTable();
};
WXDLLEXPORT extern void wxInitializeResourceSystem();
WXDLLEXPORT extern void wxCleanUpResourceSystem();
WXDLLEXPORT_DATA(extern wxResourceTable*) wxDefaultResourceTable;
WXDLLEXPORT extern long wxParseWindowStyle(const wxString& style);
class WXDLLEXPORT wxMenuBar;
class WXDLLEXPORT wxMenu;
class WXDLLEXPORT wxBitmap;
class WXDLLEXPORT wxIcon;
WXDLLEXPORT extern wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern wxMenuBar* wxResourceCreateMenuBar(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL, wxMenuBar *menuBar = (wxMenuBar *) NULL);
WXDLLEXPORT extern wxMenu* wxResourceCreateMenu(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern bool wxResourceParseData(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern bool wxResourceParseData(const char* resource, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern bool wxResourceParseFile(const wxString& filename, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern bool wxResourceParseString(char* s, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern bool wxResourceParseString(const wxString& s, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern void wxResourceClear(wxResourceTable *table = (wxResourceTable *) NULL);
// Register XBM/XPM data
WXDLLEXPORT extern bool wxResourceRegisterBitmapData(const wxString& name, char bits[], int width, int height, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern bool wxResourceRegisterBitmapData(const wxString& name, char **data, wxResourceTable *table = (wxResourceTable *) NULL);
#define wxResourceRegisterIconData wxResourceRegisterBitmapData
/*
* Resource identifer code: #define storage
*/
WXDLLEXPORT extern bool wxResourceAddIdentifier(const wxString& name, int value, wxResourceTable *table = (wxResourceTable *) NULL);
WXDLLEXPORT extern int wxResourceGetIdentifier(const wxString& name, wxResourceTable *table = (wxResourceTable *) NULL);
#if defined(__WXPM__)
#include "wx/os2/wxrsc.h"
#endif
#endif
#endif
// _WX_RESOURCEH__

View File

@@ -1,7 +0,0 @@
#ifndef _WX_TREELAY_H_BASE_
#define _WX_TREELAY_H_BASE_
#include "wx/generic/treelay.h"
#endif
// _WX_TREELAY_H_BASE_

View File

@@ -1,283 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wxexpr.h
// Purpose: Prolog-like file I/O, used by resource system.
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c)
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WXEXPRH__
#define _WX_WXEXPRH__
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "wxexpr.h"
#endif
#if wxUSE_PROLOGIO
#include "wx/defs.h"
#include "wx/string.h"
#include "wx/list.h"
#include "wx/hash.h"
#include "wx/expr.h"
#include <stdio.h>
// Compatibility
#define PrologExpr wxExpr
#define PrologDatabase wxExprDatabase
#define proioErrorHandler wxExprErrorHandler
#define PROIO_ERROR_GENERAL 1
#define PROIO_ERROR_SYNTAX 2
#define PrologNull wxExprNull
#define PrologInteger wxExprInteger
#define PrologReal wxExprReal
#define PrologWord wxExprWord
#define PrologString wxExprString
#define PrologList wxExprList
#define PrologType wxExprType
// Error types
#define WXEXPR_ERROR_GENERAL 1
#define WXEXPR_ERROR_SYNTAX 2
// Error handler function definition. If app returns TRUE,
// carry on processing.
typedef bool (*wxExprErrorHandler) (int errorType, char *msg);
WXDLLEXPORT_DATA(extern wxExprErrorHandler) currentwxExprErrorHandler;
typedef enum {
wxExprNull,
wxExprInteger,
wxExprReal,
wxExprWord,
wxExprString,
wxExprList
} wxExprType;
class WXDLLEXPORT wxExprDatabase;
class WXDLLEXPORT wxExpr
{
public:
wxObject *client_data;
wxExprType type;
union {
long integer;
wxChar *word;
wxChar *string;
double real;
wxExpr *first; // If is a list expr, points to the first node
} value;
wxExpr *next; // If this is a node in a list, points to the next node
wxExpr *last; // If is a list expr, points to the last node
wxExpr(wxExprType the_type, wxChar *word_or_string, bool allocate);
wxExpr(const wxString& functor); // Assume this is a new clause - pass functor
wxExpr(wxExprType the_type, const wxString& word_or_string = wxT(""));
wxExpr(long the_integer);
wxExpr(double the_real);
wxExpr(wxList *the_list);
~wxExpr(void);
inline wxExprType Type(void) const { return type; }
inline long IntegerValue(void) const
{
if (type == wxExprInteger)
return value.integer;
else if (type == wxExprReal)
return (long)value.real;
else return 0;
}
inline double RealValue(void) const {
if (type == wxExprReal)
return value.real;
else if (type == wxExprInteger)
return (double)value.integer;
else return (double)0.0;
}
inline wxString WordValue(void) const {
if (type == wxExprWord)
return value.word;
else if (type == wxExprString)
return wxString(value.string);
else return wxString(wxT(""));
}
inline wxString StringValue(void) const {
if (type == wxExprString)
return wxString(value.string);
else if (type == wxExprWord)
return wxString(value.word);
else return wxString(wxT(""));
}
// Get nth arg of clause (starting from 1)
wxExpr *Arg(wxExprType type, int arg) const;
// Return nth argument of a list expression (starting from zero)
wxExpr *Nth(int arg) const;
// Returns the number of elements in a list expression
int Number(void) const;
// Make a clone
wxExpr *Copy(void) const;
wxExpr *GetAttributeValueNode(const wxString& word) const; // Use only for a clause or list
wxExpr *AttributeValue(const wxString& word) const; // Use only for a clause
wxString Functor(void) const; // Only for a clause
bool IsFunctor(const wxString& s) const; // Only for a clause
void WriteClause(FILE* stream); // Write this expression as a top-level clause
void WriteExpr(FILE* stream); // Write as any other subexpression
// Append an expression to a list
void Append(wxExpr *expr);
// Insert at beginning of list
void Insert(wxExpr *expr);
// Get first expr in list
inline wxExpr *GetFirst(void) const { return ((type == wxExprList) ? value.first : (wxExpr*)NULL); }
// Get next expr if this is a node in a list
inline wxExpr *GetNext(void) const { return next; }
// Get last expr in list
inline wxExpr *GetLast(void) const { return ((type == wxExprList) ? last : (wxExpr*)NULL); }
// This should really be called SetAttributeValue since any existing
// attribute-value is deleted first.
void AddAttributeValue(const wxString& attribute, long value);
void AddAttributeValue(const wxString& attribute, double value);
void AddAttributeValueWord(const wxString& attribute, const wxString& value);
void AddAttributeValueString(const wxString& attribute, const wxString& value);
void AddAttributeValue(const wxString& attribute, wxList *value);
void AddAttributeValue(const wxString& attribute, wxExpr *value);
void AddAttributeValueStringList(const wxString& attribute, wxList *string_list);
void DeleteAttributeValue(const wxString& attribute);
bool GetAttributeValue(const wxString& att, int& var) const;
bool GetAttributeValue(const wxString& att, long& var) const;
bool GetAttributeValue(const wxString& att, float& var) const;
bool GetAttributeValue(const wxString& att, double& var) const;
bool GetAttributeValue(const wxString& att, wxString& var) const; // Word OR string -> string
bool GetAttributeValue(const wxString& att, wxExpr **var) const;
// Compatibility with old PrologIO
inline void AssignAttributeValue(wxChar *att, int *var) const { GetAttributeValue(att, *var); }
inline void AssignAttributeValue(wxChar *att, long *var) const { GetAttributeValue(att, *var); }
inline void AssignAttributeValue(wxChar *att, float *var) const { GetAttributeValue(att, *var); }
inline void AssignAttributeValue(wxChar *att, double *var) const { GetAttributeValue(att, *var); }
inline void AssignAttributeValue(wxChar *att, wxExpr **var) const { GetAttributeValue(att, var); }
void AssignAttributeValue(wxChar *att, wxChar **var) const ; // Word OR string -> string
// Add string items to list if the list attribute exists
bool GetAttributeValueStringList(const wxString& att, wxList *var) const;
// Associate other data with this expression, e.g. when reading in a
// number of linked items - store C++ object pointer with the expression
// so we can index into the wxExpr database and fish out the pointer.
inline void SetClientData(wxObject *data) { client_data = data; }
inline wxObject *GetClientData(void) const { return client_data; }
DECLARE_NO_COPY_CLASS(wxExpr)
};
class WXDLLEXPORT wxExprDatabase: public wxList
{
private:
wxNode *position; // Where we are in a search
wxHashTable *hash_table;
wxString attribute_to_hash;
public:
int noErrors;
wxExprDatabase(wxExprErrorHandler handler = 0);
// Use hashing on both the functor, and the attribute of
// specified type (wxExprString or wxExprInteger) and name.
// So to find node 45
// (i.e. match the clause node(id=45, ...))
// it usually requires 1 look-up: the keys for functor and attribute
// are added together.
// Obviously if the attribute was missing in a clause, it would
// fail to be found by this method, but could be retrieved by a
// linear search using BeginFind and FindClauseByFunctor,
// or just searching through the list as per usual.
wxExprDatabase(wxExprType type, const wxString& attribute, int size = 500,
wxExprErrorHandler handler = 0);
~wxExprDatabase(void);
void BeginFind(void) ; // Initialise a search
wxExpr *FindClause(long id) ; // Find a term based on an integer id attribute
// e.g. node(id=23, type=rectangle, ....).
// Find on basis of attribute/value pairs, e.g. type=rectangle
// This doesn't use hashing; it's a linear search.
wxExpr *FindClause(const wxString& word, const wxString& value);
wxExpr *FindClause(const wxString& word, long value);
wxExpr *FindClause(const wxString& word, double value);
wxExpr *FindClauseByFunctor(const wxString& functor);
wxExpr *HashFind(const wxString& functor, const wxString& value) const;
wxExpr *HashFind(const wxString& functor, long value) const;
void Append(wxExpr *expr); // Does cleverer things if hashing is on
void ClearDatabase(void);
inline int GetErrorCount() const { return noErrors; }
bool Read(const wxString& filename);
bool ReadFromString(const wxString& buffer);
bool Write(const wxString& fileName);
bool Write(FILE* stream);
// Compatibility
inline bool ReadProlog(wxChar *filename) { return Read(wxString(filename)); }
inline bool ReadPrologFromString(char *buffer)
{
return ReadFromString(wxString(buffer, wxConvLibc));
}
inline void WriteProlog(FILE* stream) { Write(stream); }
private:
DECLARE_DYNAMIC_CLASS(wxExprDatabase)
DECLARE_NO_COPY_CLASS(wxExprDatabase)
};
// Function call-style interface - some more convenience wrappers/unwrappers
// Make a call
WXDLLEXPORT wxExpr* wxExprMakeCall(const wxString& functor ...);
#define wxExprMakeInteger(x) (new wxExpr((long)x))
#define wxExprMakeReal(x) (new wxExpr((double)x))
#define wxExprMakeString(x) (new wxExpr(wxExprString, x))
#define wxExprMakeWord(x) (new wxExpr(wxExprWord, x))
#define wxExprMake(x) (new wxExpr(x))
// Checks functor
WXDLLEXPORT bool wxExprIsFunctor(wxExpr *expr, const wxString& functor);
// Temporary variable for communicating between wxexpr.cpp and YACC/LEX
WXDLLEXPORT_DATA(extern wxExprDatabase*) thewxExprDatabase;
// YACC/LEX can leave memory lying around...
extern "C" WXDLLEXPORT int wxExprCleanUp();
#endif // wxUSE_PROLOGIO
#endif // _WX_WXEXPRH__