*** empty log message ***
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -12,14 +12,16 @@
|
||||
#ifndef __APPH_BASE__
|
||||
#define __APPH_BASE__
|
||||
|
||||
/*
|
||||
#ifndef __GTK__
|
||||
class WXDLLEXPORT wxApp;
|
||||
typedef wxApp* (*wxAppInitializerFunction) (void);
|
||||
*/
|
||||
#endif
|
||||
|
||||
#include "wx/object.h"
|
||||
|
||||
#ifdef __GTK
|
||||
typedef wxObject* (*wxAppInitializerFunction) (void); // returning wxApp* won't work with gcc
|
||||
#endif
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
#include "wx/msw/app.h"
|
||||
|
@@ -531,6 +531,12 @@ typedef void (*wxFunction) (wxObject&, wxEvent&);
|
||||
#define wxTAB_FIXEDWIDTH 0x0008
|
||||
#define wxTAB_OWNERDRAW 0x0010
|
||||
|
||||
// Sorry, I changed my mind about these names...
|
||||
#define wxTC_MULTILINE 0x0000
|
||||
#define wxTC_RIGHTJUSTIFY 0x0004
|
||||
#define wxTC_FIXEDWIDTH 0x0008
|
||||
#define wxTC_OWNERDRAW 0x0010
|
||||
|
||||
/*
|
||||
* wxStatusBar95 flags
|
||||
*/
|
||||
|
129
include/wx/expr.h
Normal file
129
include/wx/expr.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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 __EXPRH__
|
||||
#define __EXPRH__
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef ____HPUX__
|
||||
#define alloca malloc
|
||||
#endif
|
||||
|
||||
/* Rename all YACC/LEX stuff or we'll conflict with other
|
||||
* applications
|
||||
*/
|
||||
|
||||
#define yyback PROIO_yyback
|
||||
#define yylook PROIO_yylook
|
||||
#define yywrap PROIO_yywrap
|
||||
#define yyoutput PROIO_yyoutput
|
||||
#define yylex PROIO_yylex
|
||||
#define yyerror PROIO_yyerror
|
||||
#define input PROIO_input
|
||||
#define unput PROIO_unput
|
||||
|
||||
#define yyleng PROIO_yyleng
|
||||
#define yytext PROIO_yytext
|
||||
#define yymorfg PROIO_yymorfg
|
||||
#define yylineno PROIO_yylineno
|
||||
#define yytchar PROIO_yytchar
|
||||
#define yyin PROIO_yyin
|
||||
#define yyout PROIO_yyout
|
||||
#define yysvf PROIO_yysvf
|
||||
#define yyestate PROIO_yyestate
|
||||
#define yysvec PROIO_yysvec
|
||||
#define yybgin PROIO_yybgin
|
||||
#define yyprevious PROIO_yyprevious
|
||||
#define yylhs PROIO_yylhs
|
||||
#define yylen PROIO_yylen
|
||||
#define yydefred PROIO_yydefred
|
||||
#define yydgoto PROIO_yydgoto
|
||||
#define yysindex PROIO_yysindex
|
||||
#define yyrindex PROIO_yyrindex
|
||||
#define yygindex PROIO_yygindex
|
||||
#define yytable PROIO_yytable
|
||||
#define yycheck PROIO_yycheck
|
||||
#define yyname PROIO_yyname
|
||||
#define yyrule PROIO_yyrule
|
||||
#define yydebug PROIO_yydebug
|
||||
#define yynerrs PROIO_yynerrs
|
||||
#define yyerrflag PROIO_yyerrflag
|
||||
#define yychar PROIO_yychar
|
||||
#define yyvsp PROIO_yyvsp
|
||||
#define yyssp PROIO_yyssp
|
||||
#define yyval PROIO_yyval
|
||||
#define yylval PROIO_yylval
|
||||
#define yyss PROIO_yyss
|
||||
#define yyvs PROIO_yyvs
|
||||
#define yyparse PROIO_yyparse
|
||||
|
||||
/* +++steve162e: more defines necessary */
|
||||
#define yy_init_buffer PROIO_yy_init_buffer
|
||||
#define yy_create_buffer PROIO_yy_create_buffer
|
||||
#define yy_load_buffer_state PROIO_yy_load_buffer_state
|
||||
#define yyrestart PROIO_yyrestart
|
||||
#define yy_switch_to_buffer PROIO_yy_switch_to_buffer
|
||||
#define yy_delete_buffer PROIO_yy_delete_buffer
|
||||
/* ---steve162e */
|
||||
|
||||
/* WG 1/96: still more for flex 2.5 */
|
||||
#define yy_scan_buffer PROIO_scan_buffer
|
||||
#define yy_scan_string PROIO_scan_string
|
||||
#define yy_scan_bytes PROIO_scan_bytes
|
||||
#define yy_flex_debug PROIO_flex_debug
|
||||
#define yy_flush_buffer PROIO_flush_buffer
|
||||
#define yyleng PROIO_yyleng
|
||||
#define yytext PROIO_yytext
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
char *proio_cons(char *, char *);
|
||||
char * make_integer(char *);
|
||||
char * make_word(char *);
|
||||
char * make_string(char *);
|
||||
char * make_real(char *, char *);
|
||||
char * make_exp(char *, char *);
|
||||
char * make_exp2(char *, char *, char*);
|
||||
void add_expr(char *);
|
||||
void process_command(char *);
|
||||
void syntax_error(char *);
|
||||
}
|
||||
#else
|
||||
#if __BORLANDC__
|
||||
char *proio_cons(char *, char *);
|
||||
char * make_integer(char *);
|
||||
char * make_word(char *);
|
||||
char * make_string(char *);
|
||||
char * make_real(char *, char *);
|
||||
char * make_exp(char *, char *);
|
||||
char * make_exp2(char *, char *, char*);
|
||||
void add_expr(char *);
|
||||
void process_command(char *);
|
||||
void syntax_error(char *);
|
||||
#else
|
||||
char *proio_cons();
|
||||
char * make_integer();
|
||||
char * make_word();
|
||||
char * make_string();
|
||||
char * make_real();
|
||||
char * make_exp();
|
||||
char * make_exp2();
|
||||
|
||||
void add_expr();
|
||||
void process_command();
|
||||
void syntax_error();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// __EXPRH__
|
@@ -62,17 +62,17 @@ class WXDLLEXPORT wxPostScriptDC: public wxDC
|
||||
void DrawRoundedRectangle(long x, long y, long width, long height, double radius = 20);
|
||||
void DrawEllipse(long x, long y, long width, long height);
|
||||
|
||||
/*
|
||||
// RR: I define these in wxDC, after all they all do the same everywhere
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
// Splines
|
||||
// 3-point spline
|
||||
void DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3);
|
||||
// Any number of control points - a list of pointers to wxPoints
|
||||
void DrawSpline(wxList *points);
|
||||
void DrawSpline(int n, wxPoint points[]);
|
||||
|
||||
I define these in wxDC, after all they all do the same everywhere
|
||||
|
||||
*/
|
||||
#endif
|
||||
|
||||
void DrawOpenSpline(wxList *points);
|
||||
|
||||
void DrawIcon(const wxIcon& icon, long x, long y);
|
||||
|
13
include/wx/tbar95.h
Normal file
13
include/wx/tbar95.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef __TBAR95H_BASE__
|
||||
#define __TBAR95H_BASE__
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
#include "wx/msw/tbar95.h"
|
||||
#elif defined(__MOTIF__)
|
||||
#include "wx/xt/tbar95.h"
|
||||
#elif defined(__GTK__)
|
||||
#include "wx/gtk/tbar95.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// __TBAR95H_BASE__
|
240
include/wx/tbarbase.h
Normal file
240
include/wx/tbarbase.h
Normal file
@@ -0,0 +1,240 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: tbarbase.h
|
||||
// Purpose: Base class for toolbar classes
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __TBARBASEH__
|
||||
#define __TBARBASEH__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "tbarbase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if USE_TOOLBAR
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/control.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
|
||||
WXDLLEXPORT_DATA(extern const wxSize) wxDefaultSize;
|
||||
WXDLLEXPORT_DATA(extern const wxPoint) wxDefaultPosition;
|
||||
|
||||
#define wxTOOL_STYLE_BUTTON 1
|
||||
#define wxTOOL_STYLE_SEPARATOR 2
|
||||
|
||||
class WXDLLEXPORT wxToolBarTool: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxToolBarTool)
|
||||
public:
|
||||
wxToolBarTool(const int theIndex = 0, const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap,
|
||||
const bool toggle = FALSE, const long xPos = -1, const long yPos = -1,
|
||||
const wxString& shortHelpString = "", const wxString& longHelpString = "");
|
||||
~wxToolBarTool ();
|
||||
inline void SetSize( const long w, const long h ) { m_width = w; m_height = h; }
|
||||
inline long GetWidth () const { return m_width; }
|
||||
inline long GetHeight () const { return m_height; }
|
||||
|
||||
public:
|
||||
int m_toolStyle;
|
||||
wxObject * m_clientData;
|
||||
int m_index;
|
||||
long m_x;
|
||||
long m_y;
|
||||
long m_width;
|
||||
long m_height;
|
||||
bool m_toggleState;
|
||||
bool m_isToggle;
|
||||
bool m_deleteSecondBitmap;
|
||||
bool m_enabled;
|
||||
wxBitmap m_bitmap1;
|
||||
wxBitmap m_bitmap2;
|
||||
bool m_isMenuCommand;
|
||||
wxString m_shortHelpString;
|
||||
wxString m_longHelpString;
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxToolBarBase : public wxControl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxToolBarBase)
|
||||
public:
|
||||
|
||||
wxToolBarBase(void);
|
||||
~wxToolBarBase(void);
|
||||
|
||||
// Handle wxToolBar events
|
||||
|
||||
// Only allow toggle if returns TRUE. Call when left button up.
|
||||
virtual bool OnLeftClick(int toolIndex, bool toggleDown);
|
||||
|
||||
// Call when right button down.
|
||||
virtual void OnRightClick(int toolIndex, long x, long y);
|
||||
|
||||
// Called when the mouse cursor enters a tool bitmap.
|
||||
// Argument is -1 if mouse is exiting the toolbar.
|
||||
virtual void OnMouseEnter(int toolIndex);
|
||||
|
||||
// If pushedBitmap is NULL, a reversed version of bitmap is
|
||||
// created and used as the pushed/toggled image.
|
||||
// If toggle is TRUE, the button toggles between the two states.
|
||||
virtual wxToolBarTool *AddTool(const int toolIndex, const wxBitmap& bitmap, const wxBitmap& pushedBitmap = wxNullBitmap,
|
||||
const bool toggle = FALSE, const long xPos = -1, const long yPos = -1, wxObject *clientData = NULL,
|
||||
const wxString& helpString1 = "", const wxString& helpString2 = "");
|
||||
virtual void AddSeparator(void);
|
||||
virtual void ClearTools(void);
|
||||
|
||||
virtual void EnableTool(const int toolIndex, const bool enable);
|
||||
virtual void ToggleTool(const int toolIndex, const bool toggle); // toggle is TRUE if toggled on
|
||||
virtual void SetToggle(const int toolIndex, const bool toggle); // Set this to be togglable (or not)
|
||||
virtual wxObject *GetToolClientData(const int index) const;
|
||||
inline wxList& GetTools(void) const { return (wxList&) m_tools; }
|
||||
|
||||
// After the toolbar has initialized, this is the size the tools take up
|
||||
#if WXWXIN_COMPATIBILITY
|
||||
inline void GetMaxSize ( long * width, long * height ) const
|
||||
{ wxSize maxSize(GetMaxSize()); *width = maxSize.x; *height = maxSize.y; }
|
||||
#endif
|
||||
virtual wxSize GetMaxSize ( void ) const;
|
||||
|
||||
virtual bool GetToolState(const int toolIndex) const;
|
||||
virtual bool GetToolEnabled(const int toolIndex) const;
|
||||
virtual wxToolBarTool *FindToolForPosition(const long x, const long y) const;
|
||||
|
||||
virtual void SetToolShortHelp(const int toolIndex, const wxString& helpString);
|
||||
virtual wxString GetToolShortHelp(const int toolIndex) const;
|
||||
virtual void SetToolLongHelp(const int toolIndex, const wxString& helpString);
|
||||
virtual wxString GetToolLongHelp(const int toolIndex) const;
|
||||
|
||||
virtual void SetMargins(const int x, const int y);
|
||||
inline void SetMargins(const wxSize& size) { SetMargins(size.x, size.y); }
|
||||
virtual void SetToolPacking(const int packing);
|
||||
virtual void SetToolSeparation(const int separation);
|
||||
|
||||
inline virtual wxSize GetToolMargins(void) { return wxSize(m_xMargin, m_yMargin); }
|
||||
inline virtual int GetToolPacking(void) { return m_toolPacking; }
|
||||
inline virtual int GetToolSeparation(void) { return m_toolSeparation; }
|
||||
|
||||
virtual void SetDefaultSize(const wxSize& size) { m_defaultWidth = size.x; m_defaultHeight = size.y; };
|
||||
virtual wxSize GetDefaultSize(void) const { return wxSize(m_defaultWidth, m_defaultHeight); }
|
||||
|
||||
// The button size (in some implementations) is bigger than the bitmap size: this returns
|
||||
// the total button size.
|
||||
virtual wxSize GetDefaultButtonSize(void) const { return wxSize(m_defaultWidth, m_defaultHeight); } ;
|
||||
|
||||
// Compatibility
|
||||
#if WXWIN_COMPATIBILITY
|
||||
inline void SetDefaultSize(const int w, const int h) { SetDefaultSize(wxSize(w, h)); }
|
||||
inline long GetDefaultWidth(void) const { return m_defaultWidth; }
|
||||
inline long GetDefaultHeight(void) const { return m_defaultHeight; }
|
||||
inline int GetDefaultButtonWidth(void) const { return GetDefaultButtonSize().x; };
|
||||
inline int GetDefaultButtonHeight(void) const { return GetDefaultButtonSize().y; };
|
||||
#endif
|
||||
|
||||
// Lay the tools out
|
||||
virtual void Layout(void);
|
||||
|
||||
// Add all the buttons: required for Win95.
|
||||
// TODO: unify API so there's no ambiguity
|
||||
virtual bool CreateTools(void) { return TRUE; }
|
||||
|
||||
void Command(wxCommandEvent& event);
|
||||
|
||||
// SCROLLING: this has to be copied from wxScrolledWindow since wxToolBarBase
|
||||
// inherits from wxControl. This could have been put into wxToolBarSimple,
|
||||
// but we might want any derived toolbar class to be scrollable.
|
||||
|
||||
// Number of pixels per user unit (0 or -1 for no scrollbar)
|
||||
// Length of virtual canvas in user units
|
||||
virtual void SetScrollbars(const int horizontal, const int vertical,
|
||||
const int x_length, const int y_length,
|
||||
const int x_pos = 0, const int y_pos = 0);
|
||||
|
||||
// Physically scroll the window
|
||||
virtual void Scroll(const int x_pos, const int y_pos);
|
||||
virtual void GetScrollPixelsPerUnit(int *x_unit, int *y_unit) const;
|
||||
virtual void EnableScrolling(const bool x_scrolling, const bool y_scrolling);
|
||||
virtual void AdjustScrollbars(void);
|
||||
|
||||
// Prepare the DC by translating it according to the current scroll position
|
||||
virtual void PrepareDC(wxDC& dc);
|
||||
|
||||
int GetScrollPageSize(int orient) const ;
|
||||
void SetScrollPageSize(int orient, int pageSize);
|
||||
|
||||
// Get the view start
|
||||
virtual void ViewStart(int *x, int *y) const;
|
||||
|
||||
// Actual size in pixels when scrolling is taken into account
|
||||
virtual void GetVirtualSize(int *x, int *y) const;
|
||||
|
||||
// Do the toolbar button updates (check for EVT_UPDATE_UI handlers)
|
||||
virtual void DoToolbarUpdates(void);
|
||||
|
||||
/*
|
||||
virtual void CalcScrolledPosition(const int x, const int y, int *xx, int *yy) const ;
|
||||
virtual void CalcUnscrolledPosition(const int x, const int y, long *xx, long *yy) const ;
|
||||
*/
|
||||
|
||||
void OnScroll(wxScrollEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
|
||||
// Required to force normal cursor-setting behaviour in Windows
|
||||
#ifdef __WINDOWS__
|
||||
virtual void MSWOnMouseMove(const int x, const int y, const WXUINT flags);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
wxList m_tools;
|
||||
int m_tilingDirection;
|
||||
int m_rowsOrColumns;
|
||||
int m_currentRowsOrColumns;
|
||||
long m_lastX, m_lastY;
|
||||
long m_maxWidth, m_maxHeight;
|
||||
int m_currentTool; // Tool where mouse currently is
|
||||
int m_pressedTool; // Tool where mouse pressed
|
||||
int m_xMargin;
|
||||
int m_yMargin;
|
||||
int m_toolPacking;
|
||||
int m_toolSeparation;
|
||||
long m_defaultWidth;
|
||||
long m_defaultHeight;
|
||||
|
||||
public:
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//// IMPLEMENTATION
|
||||
|
||||
// Calculate scroll increment
|
||||
virtual int CalcScrollInc(wxScrollEvent& event);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//// PROTECTED DATA
|
||||
protected:
|
||||
int m_xScrollPixelsPerLine;
|
||||
int m_yScrollPixelsPerLine;
|
||||
bool m_xScrollingEnabled;
|
||||
bool m_yScrollingEnabled;
|
||||
int m_xScrollPosition;
|
||||
int m_yScrollPosition;
|
||||
bool m_calcScrolledOffset; // If TRUE, wxCanvasDC uses scrolled offsets
|
||||
int m_xScrollLines;
|
||||
int m_yScrollLines;
|
||||
int m_xScrollLinesPerPage;
|
||||
int m_yScrollLinesPerPage;
|
||||
|
||||
public:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // USE_TOOLBAR
|
||||
#endif
|
||||
// __TBARBASEH__
|
||||
|
13
include/wx/tbarmsw.h
Normal file
13
include/wx/tbarmsw.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef __TBARMSWH_BASE__
|
||||
#define __TBARMSWH_BASE__
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
#include "wx/msw/tbarmsw.h"
|
||||
#elif defined(__MOTIF__)
|
||||
#include "wx/xt/tbarmsw.h"
|
||||
#elif defined(__GTK__)
|
||||
#include "wx/gtk/tbarmsw.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// __TBARMSWH_BASE__
|
77
include/wx/tbarsmpl.h
Normal file
77
include/wx/tbarsmpl.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: tbarsmpl.h
|
||||
// Purpose: wxToolBarSimple class
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __TBARSMPLH__
|
||||
#define __TBARSMPLH__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "tbarsmpl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if USE_TOOLBAR
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/tbarbase.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
|
||||
WXDLLEXPORT_DATA(extern const wxSize) wxDefaultSize;
|
||||
WXDLLEXPORT_DATA(extern const wxPoint) wxDefaultPosition;
|
||||
|
||||
// XView can't cope properly with panels that behave like canvases
|
||||
// (e.g. no scrollbars in panels)
|
||||
class WXDLLEXPORT wxToolBarSimple : public wxToolBarBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxToolBarSimple)
|
||||
|
||||
public:
|
||||
|
||||
wxToolBarSimple(void);
|
||||
#if WXWIN_COMPATIBILITY > 0
|
||||
inline wxToolBarSimple(wxWindow *parent, int x, int y, int w, int h,
|
||||
long style = wxNO_BORDER, int orientation = wxVERTICAL, int RowsOrColumns = 1,
|
||||
const char *name = wxToolBarNameStr)
|
||||
{
|
||||
Create(parent, -1, wxPoint(x, y), wxSize(w, h), style, orientation, RowsOrColumns, name);
|
||||
}
|
||||
#endif
|
||||
inline wxToolBarSimple(wxWindow *parent, const wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
const long style = wxNO_BORDER, const int orientation = wxVERTICAL,
|
||||
const int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr)
|
||||
{
|
||||
Create(parent, id, pos, size, style, orientation, RowsOrColumns, name);
|
||||
}
|
||||
~wxToolBarSimple(void);
|
||||
|
||||
bool Create(wxWindow *parent, const wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
const long style = wxNO_BORDER, const int orientation = wxVERTICAL, const int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr);
|
||||
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnMouseEvent(wxMouseEvent& event);
|
||||
void OnKillFocus(wxFocusEvent& event);
|
||||
|
||||
// Handle wxToolBar events
|
||||
|
||||
virtual void DrawTool(wxDC& dc, wxMemoryDC& memDC, wxToolBarTool *tool);
|
||||
virtual void ToggleTool(const int toolIndex, const bool toggle); // toggle is TRUE if toggled on
|
||||
|
||||
virtual void SpringUpButton(const int index);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // USE_TOOLBAR
|
||||
#endif
|
||||
// __TBARSMPLH__
|
||||
|
145
include/wx/thread.h
Normal file
145
include/wx/thread.h
Normal file
@@ -0,0 +1,145 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: thread.h
|
||||
// Purpose: Thread API
|
||||
// Author: Guilhem Lavaux
|
||||
// Modified by:
|
||||
// Created: 04/13/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Guilhem Lavaux
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __THREADH__
|
||||
#define __THREADH__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "thread.h"
|
||||
#endif
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/setup.h"
|
||||
|
||||
typedef enum {
|
||||
MUTEX_NO_ERROR=0,
|
||||
MUTEX_DEAD_LOCK, // Mutex has been already locked by THE CALLING thread
|
||||
MUTEX_BUSY // Mutex has been already locked by ONE thread
|
||||
} wxMutexError;
|
||||
|
||||
typedef enum {
|
||||
THREAD_NO_ERROR=0, // No error
|
||||
THREAD_NO_RESOURCE, // No resource left to create a new thread
|
||||
THREAD_RUNNING, // The thread is already running
|
||||
THREAD_NOT_RUNNING // The thread isn't running
|
||||
} wxThreadError;
|
||||
|
||||
// defines the interval of priority.
|
||||
#define WXTHREAD_MIN_PRIORITY 0
|
||||
#define WXTHREAD_DEFAULT_PRIORITY 50
|
||||
#define WXTHREAD_MAX_PRIORITY 100
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Mutex handler
|
||||
class wxMutexInternal;
|
||||
class WXDLLEXPORT wxMutex {
|
||||
public:
|
||||
// constructor & destructor
|
||||
wxMutex(void);
|
||||
~wxMutex(void);
|
||||
|
||||
// Lock the mutex.
|
||||
wxMutexError Lock(void);
|
||||
// Try to lock the mutex: if it can't, returns immediately with an error.
|
||||
wxMutexError TryLock(void);
|
||||
// Unlock the mutex.
|
||||
wxMutexError Unlock(void);
|
||||
|
||||
// Returns true if the mutex is locked.
|
||||
bool IsLocked(void) { return (m_locked > 0); }
|
||||
protected:
|
||||
friend class wxCondition;
|
||||
|
||||
int m_locked;
|
||||
wxMutexInternal *p_internal;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Condition handler.
|
||||
class wxConditionInternal;
|
||||
class WXDLLEXPORT wxCondition {
|
||||
public:
|
||||
// constructor & destructor
|
||||
wxCondition(void);
|
||||
~wxCondition(void);
|
||||
|
||||
// Waits undefinitely.
|
||||
void Wait(wxMutex& mutex);
|
||||
// Waits until a signal is raised or the timeout is elapsed.
|
||||
bool Wait(wxMutex& mutex, unsigned long sec, unsigned long nsec);
|
||||
// Raises a signal: only one "Waiter" is released.
|
||||
void Signal(void);
|
||||
// Broadcasts to all "Waiters".
|
||||
void Broadcast(void);
|
||||
private:
|
||||
wxConditionInternal *p_internal;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Thread management class
|
||||
class wxThreadInternal;
|
||||
class WXDLLEXPORT wxThread {
|
||||
public:
|
||||
// constructor & destructor.
|
||||
wxThread(void);
|
||||
virtual ~wxThread(void);
|
||||
|
||||
// Create a new thread, this method should check there is only one thread
|
||||
// running by object.
|
||||
wxThreadError Create(void);
|
||||
|
||||
// Destroys the thread immediately if the flag DIFFER isn't true.
|
||||
wxThreadError Destroy(void);
|
||||
|
||||
// Switches on the DIFFER flag.
|
||||
void DeferDestroy(bool on);
|
||||
|
||||
// Waits for the termination of the thread.
|
||||
void *Join(void);
|
||||
|
||||
// Sets the priority to "prio". (Warning: The priority can only be set before
|
||||
// the thread is created)
|
||||
void SetPriority(int prio);
|
||||
// Get the current priority.
|
||||
int GetPriority(void);
|
||||
|
||||
// Get the thread ID
|
||||
unsigned long GetID(void);
|
||||
|
||||
// Returns true if the thread is alive.
|
||||
bool IsAlive(void);
|
||||
// Returns true if the thread is the main thread (aka the GUI thread).
|
||||
static bool IsMain(void);
|
||||
|
||||
// Called when thread exits.
|
||||
virtual void OnExit(void);
|
||||
protected:
|
||||
// In case, the DIFFER flag is true, enables another thread to kill this one.
|
||||
void TestDestroy(void);
|
||||
// Exits from the current thread.
|
||||
void Exit(void *status = NULL);
|
||||
private:
|
||||
// Entry point for the thread.
|
||||
virtual void *Entry(void) = 0;
|
||||
|
||||
private:
|
||||
friend class wxThreadInternal;
|
||||
|
||||
wxThreadInternal *p_internal;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Global variables
|
||||
|
||||
// GUI mutex.
|
||||
WXDLLEXPORT_DATA(extern wxMutex) wxMainMutex;
|
||||
|
||||
#endif
|
279
include/wx/wxexpr.h
Normal file
279
include/wx/wxexpr.h
Normal file
@@ -0,0 +1,279 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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 __WXEXPRH__
|
||||
#define __WXEXPRH__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "wxexpr.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/string.h"
|
||||
|
||||
#if USE_IOSTREAMH
|
||||
#include <iostream.h>
|
||||
#else
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#include "wx/list.h"
|
||||
#include "wx/hash.h"
|
||||
|
||||
#include "wx/expr.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;
|
||||
|
||||
WXDLLEXPORT_DATA(extern "C" FILE*) yyin;
|
||||
|
||||
extern "C" int WXDLLEXPORT yyparse(void);
|
||||
|
||||
typedef enum {
|
||||
wxExprNull,
|
||||
wxExprInteger,
|
||||
wxExprReal,
|
||||
wxExprWord,
|
||||
wxExprString,
|
||||
wxExprList
|
||||
} wxExprType;
|
||||
|
||||
class WXDLLEXPORT wxExprDatabase;
|
||||
|
||||
class WXDLLEXPORT wxExpr
|
||||
{
|
||||
public:
|
||||
wxObject *client_data;
|
||||
wxExprType type;
|
||||
union {
|
||||
long integer;
|
||||
char *word;
|
||||
char *string;
|
||||
float 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, char *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 = "");
|
||||
wxExpr(long the_integer);
|
||||
wxExpr(float 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 float RealValue(void) const {
|
||||
if (type == wxExprReal)
|
||||
return value.real;
|
||||
else if (type == wxExprInteger)
|
||||
return (float)value.integer;
|
||||
else return (float)0.0;
|
||||
}
|
||||
|
||||
inline wxString WordValue(void) const {
|
||||
if (type == wxExprWord)
|
||||
return value.word;
|
||||
else if (type == wxExprString)
|
||||
return wxString(value.string);
|
||||
else return wxString("");
|
||||
}
|
||||
|
||||
inline wxString StringValue(void) const {
|
||||
if (type == wxExprString)
|
||||
return wxString(value.string);
|
||||
else if (type == wxExprWord)
|
||||
return wxString(value.word);
|
||||
else return wxString("");
|
||||
}
|
||||
|
||||
// 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(ostream& stream); // Write this expression as a top-level clause
|
||||
void WriteExpr(ostream& stream); // Write as any other subexpression
|
||||
void WriteLispExpr(ostream& stream);
|
||||
|
||||
// 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, float 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, wxString& var) const; // Word OR string -> string
|
||||
bool GetAttributeValue(const wxString& att, wxExpr **var) const;
|
||||
|
||||
// Compatibility with old PrologIO
|
||||
inline void AssignAttributeValue(char *att, int *var) const { GetAttributeValue(att, *var); }
|
||||
inline void AssignAttributeValue(char *att, long *var) const { GetAttributeValue(att, *var); }
|
||||
inline void AssignAttributeValue(char *att, float *var) const { GetAttributeValue(att, *var); }
|
||||
inline void AssignAttributeValue(char *att, wxExpr **var) const { GetAttributeValue(att, var); }
|
||||
void AssignAttributeValue(char *att, char **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; }
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxExprDatabase: public wxList
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxExprDatabase)
|
||||
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, float 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(ostream& stream);
|
||||
void WriteLisp(ostream& stream);
|
||||
|
||||
// Compatibility
|
||||
inline bool ReadProlog(char *filename) { return Read(wxString(filename)); }
|
||||
inline bool ReadPrologFromString(char *buffer) { return ReadFromString(wxString(buffer)); }
|
||||
inline void WriteProlog(ostream& stream) { Write(stream); }
|
||||
};
|
||||
|
||||
// Function call-style interface - some more convenience wrappers/unwrappers
|
||||
|
||||
// Make a call
|
||||
wxExpr* WXDLLEXPORT wxExprMakeCall(const wxString& functor ...);
|
||||
|
||||
#define wxExprMakeInteger(x) (new wxExpr((long)x))
|
||||
#define wxExprMakeReal(x) (new wxExpr((float)x))
|
||||
#define wxExprMakeString(x) (new wxExpr(wxExprString, x))
|
||||
#define wxExprMakeWord(x) (new wxExpr(wxExprWord, x))
|
||||
#define wxExprMake(x) (new wxExpr(x))
|
||||
|
||||
// Checks functor
|
||||
bool WXDLLEXPORT 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 wxExprCleanUp();
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user