[lazarus] Some (major) changes

michael at tfdec1.fys.kuleuven.ac.be michael at tfdec1.fys.kuleuven.ac.be
Sun Nov 14 14:06:13 EST 1999




On Sat, 13 Nov 1999, Marc Weustink wrote:

> HI,
> I started to implement some WINAPI functions, becouse mwEdit dumps on some
> unimplemented results. 
> Since the implementation is platform dependent, this should go to the
> interface object. The only way to communicate was through sendmesseges. For
> a few functions I think this is OK, but for loads of API, whrapping
> parameters in structs an pass them.... nah
> 
> This reminded me of a discussion a while ago about an (abstract) baseclass.
> This could be a way to implenment all these functions. I started on this
> and committed the basic idea. If peaple have other thoughts I can change it
> back.
> 
> TInterfaceBase has an abstract declaration of 
>   AppTerminate, 
>   DoEvents, 
>   HandleEvents, 
>   Init, 
>   IntSendMessage3, 
>   SetCallback, 
>   RemoveCallbacks
> 
> and WINAPI parts are defined in winapih.inc as virtual. Interfacebase.inc
> implements all winapih.inc methods like:
>   procedure TInterfaceBase.MyApiFunc;
>   begin
>   end;
> 
> It has NO code. This way not all functions have to be implemented in the
> specific platform InterfaceObject. (Thats the reason why they arent abstract)
> 
> The platform specific code (in this case GTK) goes in gtkwinapih.inc and
> gtkwinapi.inc
> 
> since these are still object.member functions, they are mapped through
> normal calls' in LCLLinux (for now, I still have no idea where this should
> go) 
> by winapih.inc and winapi.inc. The latter one just contains calls like:
>   procedure MyApiFunc;
>   begin
>     TInterfaceBase.MyApiFunc;
>   end;
> 
> This way I can now create my own say gtk GetDC and can mwEdit happily draw

Apart from the TBaseClass discussion, wouldn't it be better to change 
mwedit so it doesn't use GetDC ?
A TCanvas will do the same, and TCanvas can be made platform independent.

I am not very fond of your solution, because it leaves too much platform 
specific stuff in your components; if you want to do some portable work,
this should be avoided, IMHO.

Just my idea;

Michael.






More information about the Lazarus mailing list