initial version

This commit is contained in:
memson
2002-05-26 18:52:43 +00:00
parent b0351d5098
commit c850afcc5c
31 changed files with 3031 additions and 0 deletions

View File

@@ -0,0 +1,90 @@
/* BePascal - A pascal wrapper around the BeOS API
Copyright (C) 2002 Olivier Coursiere
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _POINT_CPP
#define _POINT_CPP
#include <Point.h>
#include <beobj.cpp>
class BPPoint : public BPoint, public BPasObject
{
public:
BPPoint(TPasObject PasObject, float x, float y);
BPPoint(TPasObject PasObject, const BPoint& point);
BPPoint(TPasObject PasObject);
};
BPPoint::BPPoint(TPasObject PasObject, float x, float y) : BPoint(x, y), BPasObject(PasObject)
{
}
BPPoint::BPPoint(TPasObject PasObject, const BPoint& point) : BPoint(point), BPasObject(PasObject)
{
}
BPPoint::BPPoint(TPasObject PasObject) : BPoint(), BPasObject(PasObject)
{
}
#if defined(__cplusplus)
extern "C" {
#endif
TCPlusObject BPoint_Create_1(TPasObject PasObject, float x, float y)
{
return new BPPoint(PasObject, x, y);
}
TCPlusObject BPoint_Create_2(TPasObject PasObject, const BPoint& point)
{
return new BPPoint(PasObject, point);
}
TCPlusObject BPoint_Create_3(TPasObject PasObject)
{
return new BPPoint(PasObject);
}
void BPoint_Free(TCPlusObject Point)
{
delete Point;
}
void BPoint_ConstrainTo(TCPlusObject Point, BRect rect)
{
reinterpret_cast<BPoint*>(Point)->ConstrainTo(rect);
}
void BPoint_PrintToStream(TCPlusObject Point)
{
reinterpret_cast<BPoint*>(Point)->PrintToStream();
}
void BPoint_Set(TCPlusObject Point, float x, float y)
{
reinterpret_cast<BPoint*>(Point)->Set(x, y);
}
#if defined(__cplusplus)
}
#endif
#endif _POINT_CPP /* _POINT_CPP */

View File

@@ -0,0 +1,92 @@
/* BePascal - A pascal wrapper around the BeOS API
Copyright (C) 2002 Olivier Coursiere
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _RECT_CPP
#define _RECT_CPP
#include <Point.h>
#include <Rect.h>
#include <beobj.cpp>
class BPRect : public BRect, public BPasObject
{
public:
BPRect(TPasObject PasObject);
BPRect(TPasObject PasObject, const BRect & rect);
BPRect(TPasObject PasObject, float l, float t, float r, float b);
BPRect(TPasObject PasObject, BPoint leftTop, BPoint rightBottom);
};
BPRect::BPRect(TPasObject PasObject) : BRect(), BPasObject(PasObject)
{
}
BPRect::BPRect(TPasObject PasObject, const BRect & rect) : BRect(rect), BPasObject(PasObject)
{
}
BPRect::BPRect(TPasObject PasObject, float l, float t, float r, float b) : BRect(l, t, r, b), BPasObject(PasObject)
{
}
BPRect::BPRect(TPasObject PasObject, BPoint leftTop, BPoint rightBottom) : BRect(leftTop, rightBottom), BPasObject(PasObject)
{
}
#if defined(__cplusplus)
extern "C" {
#endif
TCPlusObject BRect_Create_1(TPasObject PasObject)
{
return new BPRect(PasObject);
}
TCPlusObject BRect_Create_2(TPasObject PasObject, const BRect& rect)
{
return new BPRect(PasObject, rect);
}
TCPlusObject BRect_Create_3(TPasObject PasObject, float l, float t, float r, float b)
{
return new BPRect(PasObject, l, t, r, b);
}
TCPlusObject BRect_Create_4(TPasObject PasObject, BPoint leftTop, BPoint rightBottom)
{
return new BPRect(PasObject, leftTop, rightBottom);
}
void BRect_Free(TCPlusObject rect)
{
delete rect;
}
void BRect_PrintToStream(TCPlusObject rect)
{
reinterpret_cast<BRect*>(rect)->PrintToStream();
}
#if defined(__cplusplus)
}
#endif
#endif _RECT_CPP /* _RECT_CPP */

View File

@@ -0,0 +1,98 @@
/* BePascal - A pascal wrapper around the BeOS API
Copyright (C) 2002 Olivier Coursiere
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _WINDOW_CPP_
#define _WINDOW_CPP_
#include <Window.h>
#include <OS.h>
#include <beobj.cpp>
// definition of callback function in BWindow
#if defined(__cplusplus)
extern "C" {
#endif
#if defined(__cplusplus)
}
#endif
class BPWindow : public BWindow, public BPLooper
{
public:
BPWindow(TPasObject PasObject,
BRect frame,
const char *title,
window_type type,
uint32 flags,
uint32 workspaces = B_CURRENT_WORKSPACE);
// virtual void DispatchMessage(BMessage *message, BHandler *target);
// virtual bool QuitRequested(void);
private:
};
BPWindow::BPWindow(TPasObject PasObject,
BRect frame,
const char *title,
window_type type,
uint32 flags,
uint32 workspaces = B_CURRENT_WORKSPACE)
: BWindow(frame, title, type, flags, workspaces),
BPLooper(PasObject)
{
}
#if defined(__cplusplus)
extern "C" {
#endif
TCPlusObject BWindow_Create_1(TPasObject PasObject,
BRect frame,
const char *title,
window_type type,
uint32 flags,
uint32 workspaces)
{
return new BPWindow(PasObject, frame, title, type, flags, workspaces);
}
void BWindow_Free(TCPlusObject Window)
{
delete Window;
}
void BWindow_Show(TCPlusObject Window)
{
reinterpret_cast<BWindow*>(Window)->Show();
}
void BWindow_Hide(TCPlusObject Window)
{
reinterpret_cast<BWindow*>(Window)->Hide();
}
#if defined(__cplusplus)
}
#endif
#endif /* _WINDOW_CPP_ */

View File

@@ -0,0 +1,72 @@
unit Point;
interface
uses
beobj, rect;
type
// TRect = class;
TPoint = class(TBeObject)
public
constructor Create(x, y : single); virtual;
constructor Create(point : TPoint); virtual;
constructor Create; override;
destructor Destroy; override;
procedure ConstrainTo(Rect : TRect);
procedure PrintToStream;
procedure Sept(x, y : single);
end;
function BPoint_Create(AObject : TBeObject; x, y : single) : TCPlusObject; cdecl; external BePascalLibName name 'BPoint_Create_1';
function BPoint_Create(AObject : TBeObject; point : TCPlusObject) : TCPlusObject; cdecl; external BePascalLibName name 'BPoint_Create_2';
function BPoint_Create(AObject : TBeObject) : TCPlusObject; cdecl; external BePascalLibName name 'BPoint_Create_3';
procedure BPoint_Free(Point : TCPlusObject); cdecl; external BePascalLibName name 'BPoint_Free';
procedure BPoint_ConstrainTo(Point : TCPlusObject; Rect : TCPlusObject); cdecl; external BePascalLibName name 'BPoint_ConstrainTo';
procedure BPoint_PrintToStream(Point : TCPlusObject); cdecl; external bePascalLibName name 'BPoint_PrintToStream';
procedure BPoint_Set(Point : TCPlusObject; x, y : single); cdecl; external BePascalLibName name 'BPoint_Set';
implementation
constructor TPoint.Create(x, y : single);
begin
inherited Create;
CPlusObject := BPoint_Create(Self, x, y);
end;
constructor TPoint.Create(point : TPoint);
begin
inherited Create;
CPlusObject := BPoint_Create(Self, point.CPlusObject)
end;
constructor TPoint.Create;
begin
inherited Create;
CPlusObject := BPoint_Create(Self);
end;
destructor TPoint.Destroy;
begin
BPoint_Free(CPlusObject);
inherited;
end;
procedure TPoint.ConstrainTo(Rect : TRect);
begin
BPoint_ConstrainTo(CPlusObject, Rect.CPlusObject);
end;
procedure TPoint.PrintToStream;
begin
BPoint_PrintToStream(CPlusObject);
end;
procedure TPoint.Sept(x, y : single);
begin
BPoint_Set(CPlusObject, x, y);
end;
initialization
end.

View File

@@ -0,0 +1,144 @@
{ BePascal - A pascal wrapper around the BeOS API
Copyright (C) 2002 Olivier Coursiere
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
unit rect;
interface
uses
beobj;
type
// TPoint and TRect are defined in the same unit to avoid circular reference
TPoint = class;
TRect = class(TBeObject)
public
constructor Create; override;
constructor Create(rect : TRect); virtual; // Problème de référence circulaire avec TPoint
constructor Create(l, t, r, b : single); virtual;
constructor Create(leftTop, rightBottom : TPoint); virtual;
destructor Destroy; override;
procedure PrintToStream;
end;
function BRect_Create(AObject : TBeObject) : TCPlusObject; cdecl; external BePascalLibName name 'BRect_Create_1';
function BRect_Create(AObject : TBeObject; rect : TCPlusObject) : TCPlusObject; cdecl; external BePascalLibName name 'BRect_Create_2';
function BRect_Create(AObject : TBeObject; l, t, r, b : single) : TCPlusObject; cdecl; external BePascalLibName name 'BRect_Create_3';
function BRect_Create(AObject : TBeObject; leftTop, rightBottom : TCPlusObject) : TCPlusObject; cdecl; external BePascalLibName name 'BRect_Create_4';
procedure BRect_Free(rect : TCPlusObject); cdecl; external BePascalLibName name 'BRect_Free';
procedure BRect_PrintToStream(Rect : TCPlusObject); cdecl; external bePascalLibName name 'BRect_PrintToStream';
type
TPoint = class(TBeObject)
public
constructor Create; override;
constructor Create(x, y : single); virtual;
constructor Create(point : TPoint); virtual;
destructor Destroy; override;
procedure ConstrainTo(Rect : TRect);
procedure PrintToStream;
procedure Sept(x, y : single);
end;
function BPoint_Create(AObject : TBeObject; x, y : single) : TCPlusObject; cdecl; external BePascalLibName name 'BPoint_Create_1';
function BPoint_Create(AObject : TBeObject; point : TCPlusObject) : TCPlusObject; cdecl; external BePascalLibName name 'BPoint_Create_2';
function BPoint_Create(AObject : TBeObject) : TCPlusObject; cdecl; external BePascalLibName name 'BPoint_Create_3';
procedure BPoint_Free(Point : TCPlusObject); cdecl; external BePascalLibName name 'BPoint_Free';
procedure BPoint_ConstrainTo(Point : TCPlusObject; Rect : TCPlusObject); cdecl; external BePascalLibName name 'BPoint_ConstrainTo';
procedure BPoint_PrintToStream(Point : TCPlusObject); cdecl; external bePascalLibName name 'BPoint_PrintToStream';
procedure BPoint_Set(Point : TCPlusObject; x, y : single); cdecl; external BePascalLibName name 'BPoint_Set';
implementation
constructor TRect.Create;
begin
inherited Create;
CPlusObject := BRect_Create(Self);
end;
constructor TRect.Create(rect : TRect);
begin
inherited Create;
CPlusObject := BRect_Create(Self, rect.CPlusObject);
end;
constructor TRect.Create(l, t, r, b : single);
begin
inherited Create;
CPlusObject := BRect_Create(Self, l, t, r, b);
end;
constructor TRect.Create(leftTop, rightBottom : TPoint);
begin
inherited Create;
CPlusObject := BRect_Create(Self, leftTop.CPlusObject, rightBottom.CPlusObject);
end;
destructor TRect.Destroy;
begin
BRect_Free(CPlusObject);
inherited Destroy;
end;
procedure TRect.PrintToStream;
begin
BRect_PrintToStream(CPlusObject);
end;
constructor TPoint.Create(x, y : single);
begin
inherited Create;
CPlusObject := BPoint_Create(Self, x, y);
end;
constructor TPoint.Create(point : TPoint);
begin
inherited Create;
CPlusObject := BPoint_Create(Self, point.CPlusObject)
end;
constructor TPoint.Create;
begin
inherited Create;
CPlusObject := BPoint_Create(Self);
end;
destructor TPoint.Destroy;
begin
BPoint_Free(CPlusObject);
inherited;
end;
procedure TPoint.ConstrainTo(Rect : TRect);
begin
BPoint_ConstrainTo(CPlusObject, Rect.CPlusObject);
end;
procedure TPoint.PrintToStream;
begin
BPoint_PrintToStream(CPlusObject);
end;
procedure TPoint.Sept(x, y : single);
begin
BPoint_Set(CPlusObject, x, y);
end;
initialization
end.

View File

@@ -0,0 +1,120 @@
{ BePascal - A pascal wrapper around the BeOS API
Copyright (C) 2002 Olivier Coursiere
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
unit Window;
interface
uses
beobj, looper, rect, os, application, appdefs;
const
// window_type
B_UNTYPED_WINDOW = 0;
B_TITLED_WINDOW = 1;
B_MODAL_WINDOW = 3;
B_DOCUMENT_WINDOW = 11;
B_BORDERED_WINDOW = 20;
B_FLOATING_WINDOW = 21;
// window_look
B_BORDERED_WINDOW_LOOK = 20;
B_NO_BORDER_WINDOW_LOOK = 19;
B_TITLED_WINDOW_LOOK = 1;
B_DOCUMENT_WINDOW_LOOK = 11;
B_MODAL_WINDOW_LOOK = 3;
B_FLOATING_WINDOW_LOOK = 7;
// window_feel
B_NORMAL_WINDOW_FEEL = 0;
B_MODAL_SUBSET_WINDOW_FEEL = 2;
B_MODAL_APP_WINDOW_FEEL = 1;
B_MODAL_ALL_WINDOW_FEEL = 3;
B_FLOATING_SUBSET_WINDOW_FEEL = 5;
B_FLOATING_APP_WINDOW_FEEL = 4;
B_FLOATING_ALL_WINDOW_FEEL = 6;
// flags
B_NOT_MOVABLE = $00000001;
B_NOT_CLOSABLE = $00000020;
B_NOT_ZOOMABLE = $00000040;
B_NOT_MINIMIZABLE = $00004000;
B_NOT_RESIZABLE = $00000002;
B_NOT_H_RESIZABLE = $00000004;
B_NOT_V_RESIZABLE = $00000008;
B_AVOID_FRONT = $00000080;
B_AVOID_FOCUS = $00002000;
B_WILL_ACCEPT_FIRST_CLICK = $00000010;
B_OUTLINE_RESIZE = $00001000;
B_NO_WORKSPACE_ACTIVATION = $00000100;
B_NOT_ANCHORED_ON_ACTIVATE = $00020000;
B_ASYNCHRONOUS_CONTROLS = $00080000;
B_QUIT_ON_WINDOW_CLOSE = $00100000;
B_CURRENT_WORKSPACE = 0;
B_ALL_WORKSPACES = $ffffffff;
type
TWindow = class(TLooper)
public
constructor Create(frame : TRect; title : PChar; atype, flags, workspaces : Cardinal);
destructor Destroy; override;
procedure Show;
procedure Hide;
function QuitRequested : boolean; override;
end;
function BWindow_Create(AObject : TObject; frame : TCPlusObject; title : PChar;
atype, flags, workspaces : cardinal) : TCplusObject; cdecl; external BePascalLibName name 'BWindow_Create_1';
procedure BWindow_Free(CPlusObject : TCPlusObject); cdecl; external BePascalLibName name 'BWindow_Free';
procedure BWindow_Show(CPlusObject : TCPlusObject); cdecl; external BePascalLibName name 'BWindow_Show';
procedure BWindow_Hide(CPlusObject : TCPlusObject); cdecl; external BePascalLibName name 'BWindow_Hide';
implementation
function TWindow.QuitRequested : boolean;
begin
Result := inherited;
be_app.PostMessage(B_QUIT_REQUESTED);
end;
constructor TWindow.Create(frame : TRect; title : PChar; atype, flags, workspaces : Cardinal);
begin
inherited Create;
CPlusObject := BWindow_Create(Self, frame.CPlusObject, title, atype, flags, workspaces);
end;
destructor TWindow.Destroy;
begin
BWindow_Free(CPlusObject);
inherited;
end;
procedure TWindow.Show;
begin
BWindow_Show(Self.CPlusObject);
end;
procedure TWindow.Hide;
begin
BWindow_Hide(Self.CPlusObject);
end;
initialization
end.