Thanks from me, too...
Thanks JuhaManninen
..., but your code needs some work.
That's the idea. I am a linux user for many years. However, I am programmer in C / C + +, Delphi, but only on windows platform. So multiplatform applications used only Java.. I give up Delphi, but not Pascal.
I'm maturing as a developer seeking to multiplatform and contribute something to the community. And you're helping me, pointing me in other directions I can take as a path.
First, there already is function PtInRegion although it is not implemented for GTK2 for some reason.
I tried to implement it in another way, Why was not responding the same way on different platforms. Through research, I noticed that several people had the same difficulties when working on the issue of porting or converting your application. The way it appears, managed to get a common answer for both platforms.
Second, LCL code should not have platform specific IFDEFs. Platform specific code must go to WidgetSet libraries. See how PtInRegion is done, it only calls a virtual WidgetSet.PtInRegion.
The IFDEFs platform-specific, are there because I copied the code directly from my application here, after having had a satisfactory result. I confess that at first I was not thinking specifically in LCL.
But if we make the following code in both windows in gtk as:
function PtInRegion(RGN: HRGN; X, Y: Integer) : Boolean;
var
APoint : TPoint;
ARect : TRect;
begin
GetRgnBox(RGN, @ARect);
APoint.X := X;
APoint.Y := Y;
Result := LclIntf.PtInRect(ARect, APoint);
end;
have the same result. You do not need directives compilation is only a mention for those who have a preference for using the API directly.
function TWidgetSet.PtInRegion(RGN: HRGN; X, Y: Integer): Boolean;
begin
Result := false;
end;
I confess that gave me a fright. Because I did not understand, if the code was not yet implemented, or if your call proceeded otherwise, because it is where a virtual function call.
There are differences of Delphi and did not expect anything else. Particularly loved the way the code was organized in Lazarus / Free Pascal excited to have new experience.
You must either find a GTK2 API call or use more generic code,...
I have searched for it and I will bring to the community.
...but calling LclIntf code from the widgetset code is banned (although this rule has been bended, too).
If possible, talk more about it. I really did not know that.
LclIntf.PtInRect is a short function and its could be copied if needed.
You know, reuse of code, but you are right the function is very short.
Searching the LCL sources can be educating. Most likely similar functionality is already implemented in some other function.
And yes, a patch in bug tracker is preferred.
I'll do that.
Thank you for helping me on this journey.
VCunha.