unit wObjectCreatorLOW2;

{ Feel free to use this unit as you want.
  First developped by Bernard Gisin

  The idea of this unit is that objects like  Windows  EditBox etc.
  which are created in the library, can be objects you defined
  in your main application.
  The library will call
  gglpoObjCreate^.xxx  to create a new object, where  'xxx'  represent
  the object to be created.
  Thus if  gglpoObjCreate  points to a descendent of  TObjectCreator2
  defined in your application, it will create the object as you want.

  For example, the  TApplication0  object creates  an TParamApplic2
  object. But by creating it through calling
  gglpoObjCreate^.
  you can make that a descendent of  TParamApplic2  is created insead.

  Low Level, that can be included in any other library unit.
  Every methode will be everriden in  wObjectCreator2.pp
  Which will really create the wanted object.
  This last unit can be used in the final application, and the
  correspondent object  TObjectCreator  can have a descendent,
  for example  TMyObjectCreator.
  Then, creating an  TMyObjectCreator  and letting  gglpoObjCreate
  point on the created object, this will allow the library to
  create object of your final application.
  ----------------------------------------------------------------}

INTERFACE
//"""""""

// uses wWindowBase0;

type
  // usually, the object creator is overriden to allow the library to
  // create objects from your own application.
  PObjectCreatorLOW2 = ^TObjectCreatorLOW2;
  TObjectCreatorLOW2 = object
  //"""""""""""""""""""""""""
  constructor Init;
  destructor  Done; virtual;

  function CreateParamApplic:Pointer; virtual;
  // Will be overriden to point on a TParamApplic or descendent object

  function CreateMDIClientWindow(poParent:Pointer):Pointer; virtual;
  // Will be overriden to point on a TMDIClientWindow or descendent object

  function CreateWindowText(strS:ShortString):Pointer; virtual;
  // Will be overriden to point on a TWindowText or descendent object

  function CreateMenu(poParent:Pointer):Pointer; virtual;
  // Will be overriden to point on a TMenu or descendent object

  function CreateDialogCreator:Pointer; virtual;
  // Will be overriden to point on a TDialogCreator or descendent object

  function CreateDialog(poParent:Pointer):Pointer; virtual;
  // Will be overriden to point on a TDialog or descendent object

  function CreateToolBar(poParent:Pointer):Pointer; virtual;
  // Will be overriden to point on a TToolBar or descendent object

  function DialogExecute(poDialogP:Pointer):longint; virtual;
  // This will execute the dialog box which is pointed by poDialogP
  // No type checking can be made to be sure that  poDialog
  // really points on a dialog. It is assumed that it does.

  procedure DialogCreate(poDialogP:Pointer); virtual;
  // This will create the dialog window which is pointed by poDialogP
  // No type checking can be made to be sure that  poDialog
  // really points on a dialog. It is assumed that it does.

  procedure ToolBarCreate(poTBarP:Pointer); virtual;
  // This will create the Toolbar window which is pointed by poTBarP
  // No type checking can be made to be sure that  poTBarP
  // really points on a Toolbar. It is assumed that it does.

  function CreateButtonPush(poParent:Pointer):Pointer; virtual;
  // Will be overriden to point on a TButtonPush or descendent object

  function CreateButtonBitMap(poParent:Pointer):Pointer; virtual;
  // Will be overriden to point on a TButtonBitMap or descendent object

  function CreateButtonRadio(poParent:Pointer):Pointer; virtual;
  // Will be overriden to point on a TButtonRadio or descendent object

  function CreateButtonCheck(poParent:Pointer):Pointer; virtual;
  // Will be overriden to point on a TButtonCheck or descendent object

  function CreateComboBox(poParent:Pointer):Pointer; virtual;
  // Will be overriden to point on a TComboBox or descendent object

  function CreateEditBox(poParent:Pointer):Pointer; virtual;
  // Will be overriden to point on a TEditBox or descendent object

  function CreateRichText(poParent:Pointer):Pointer; virtual;
  // Will be overriden to point on a TRichText or descendent object

  function CreateStatic(poParent:Pointer):Pointer; virtual;
  // Will be overriden to point on a TStatic or descendent object

  function CreatePopupWindow(poParent:Pointer):Pointer; virtual;
  // Will be overriden to point on a PopupWindow or descendent object

  function CreateBody3D(poParent:Pointer):Pointer; virtual;
  // Will be overriden to point on a TBody3D0 or descendent object

  function CreateMatrixRNMFloat(bFamillyP:byte):Pointer; virtual;
  // Will be overriden to point on a TMatrixRNMFloat or descendent object

  end; // TObjectCreatorLOW2 = object
  TObjectCreatorLOW =  TObjectCreatorLOW2;
  PObjectCreatorLOW = ^TObjectCreatorLOW;

// pointer to the object creator
const
  gglpoObjCreate : PObjectCreatorLOW2 = NIL;

IMPLEMENTATION
//""""""""""""

Uses
  wDebug0;

var nNotUsed : integer; // only to avoid an error message while compliling in DevPascal 1.9

constructor TObjectCreatorLOW2.Init;
//==================================
begin
// Keep a global pointer on the Object creator
if (gglpoObjCreate = NIL) then gglpoObjCreate:=@Self;
end;  // TObjectCreatorLOW2.Init

destructor  TObjectCreatorLOW2.Done;
//==================================
begin
if (gglpoObjCreate = @Self) then gglpoObjCreate:=NIL;
end;  // TObjectCreator2LOW.Done

function TObjectCreatorLOW2.CreateParamApplic:Pointer;
//====================================================
begin
CreateParamApplic:=NIL;
end;  // TObjectCreatorLOW2.CreateParamApplic

function TObjectCreatorLOW2.CreateMDIClientWindow(poParent:Pointer):Pointer;
//==========================================================================
begin
poParent:=poParent; // to avoid a Hint
CreateMDIClientWindow:=NIL;
end;  // TObjectCreatorLOW2.CreateMDIClientWindow

function TObjectCreatorLOW2.CreateWindowText(strS:ShortString):Pointer;
//=====================================================================
begin
strS:=strS; // to avoid a Hint
CreateWindowText:=NIL;
end;  // TObjectCreatorLOW2.CreateWindowText

function TObjectCreatorLOW2.CreateMenu(poParent:Pointer):Pointer;
//===============================================================
begin
poParent:=poParent; // to avoid a Hint
CreateMenu:=NIL;
end;  // TObjectCreatorLOW2.CreateMenu

function TObjectCreatorLOW2.CreateDialogCreator:Pointer;
//======================================================
begin
CreateDialogCreator:=NIL;
end;  // TObjectCreatorLOW2.CreateDialogCreator

function TObjectCreatorLOW2.CreateDialog(poParent:Pointer):Pointer;
//=================================================================
begin
poParent:=poParent; // to avoid a Hint
CreateDialog:=NIL;
end;  // TObjectCreatorLOW2.CreateDialog

function TObjectCreatorLOW2.CreateToolBar(poParent:Pointer):Pointer;
//==================================================================
begin
poParent:=poParent; // to avoid a Hint
CreateToolBar:=NIL;
end;  // TObjectCreatorLOW2.CreateToolBar

function TObjectCreatorLOW2.DialogExecute(poDialogP:Pointer):longint;
//===================================================================
// This will execute the dialog box which is pointed by poDialogP
// No type checking can be made to be sure that  poDialog
// really points on a dialog. It is assumed that it does.
begin
poDialogP:=poDialogP; // to avoid a Hint
DialogExecute:=-1;
end;  // TObjectCreatorLOW2.DialogExecute

procedure TObjectCreatorLOW2.DialogCreate(poDialogP:Pointer);
//===========================================================
// This will create the dialog window which is pointed by poDialogP
// No type checking can be made to be sure that  poDialog
// really points on a dialog. It is assumed that it does.
begin
poDialogP:=poDialogP; // to avoid a Hint
end;  // TObjectCreatorLOW2.DialogCreate

procedure TObjectCreatorLOW2.ToolBarCreate(poTBarP:Pointer);
//==========================================================
// This will create the ToolBar window which is pointed by poTBarP
// No type checking can be made to be sure that  poTBarP
// really points on a ToolBar. It is assumed that it does.
begin                      
poTBarP:=poTBarP; // to avoid a Hint
end;  // TObjectCreatorLOW2.ToolBarCreate

function TObjectCreatorLOW2.CreateButtonPush(poParent:Pointer):Pointer;
//=====================================================================
begin
poParent:=poParent; // to avoid a Hint
CreateButtonPush:=NIL;
end;  // TObjectCreatorLOW2.CreateButtonPush

function TObjectCreatorLOW2.CreateButtonBitMap(poParent:Pointer):Pointer;
//=======================================================================
begin
poParent:=poParent; // to avoid a Hint
CreateButtonBitMap:=NIL;
end;  // TObjectCreatorLOW2.CreateButtonBitMap

function TObjectCreatorLOW2.CreateButtonRadio(poParent:Pointer):Pointer;
//=====================================================================
begin
poParent:=poParent; // to avoid a Hint
CreateButtonRadio:=NIL;
end;  // TObjectCreatorLOW2.CreateButtonRadio

function TObjectCreatorLOW2.CreateButtonCheck(poParent:Pointer):Pointer;
//=====================================================================
begin
poParent:=poParent; // to avoid a Hint
CreateButtonCheck:=NIL;
end;  // TObjectCreatorLOW2.CreateButtonCheck

function TObjectCreatorLOW2.CreateComboBox(poParent:Pointer):Pointer;
//===================================================================
begin
poParent:=poParent; // to avoid a Hint
CreateComboBox:=NIL;
end;  // TObjectCreatorLOW2.CreateComboBox

function TObjectCreatorLOW2.CreateEditBox(poParent:Pointer):Pointer;
//==================================================================
begin
poParent:=poParent; // to avoid a Hint
CreateEditBox:=NIL;
end;  // TObjectCreatorLOW2.CreateEditBox

function TObjectCreatorLOW2.CreateRichText(poParent:Pointer):Pointer;
//=====================================================================
begin
poParent:=poParent; // to avoid a Hint
CreateRichText:=NIL;
end;  // TObjectCreatorLOW2.CreateRichText

function TObjectCreatorLOW2.CreateStatic(poParent:Pointer):Pointer;
//=====================================================================
begin
poParent:=poParent; // to avoid a Hint
CreateStatic:=NIL;
end;  // TObjectCreatorLOW2.CreateStatic

function TObjectCreatorLOW2.CreatePopupWindow(poParent:Pointer):Pointer;
//=====================================================================
begin
poParent:=poParent; // to avoid a Hint
CreatePopupWindow:=NIL;
end;  // TObjectCreatorLOW2.CreatePopupWindow

function TObjectCreatorLOW2.CreateBody3D(poParent:Pointer):Pointer;
//=================================================================
begin
poParent:=poParent; // to avoid a Hint
CreateBody3D:=NIL;
end;  // TObjectCreatorLOW2.CreateBody3D

function TObjectCreatorLOW2.CreateMatrixRNMFloat(bFamillyP:byte):Pointer;
//=======================================================================
// Will be overriden to point on a TMatrixRNMFloat or descendent object
begin
bFamillyP:=bFamillyP; // to avoid a Hint
CreateMatrixRNMFloat:=NIL;
end;  // TObjectCreatorLOW2.CreateMatrixRNMFloat


End.  // unit wObjectCreatorLOW2;

