Sign in Join
Wiki copytemporary

Adding a new interface: what changed

Revision 4 to 5. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11This article describes the steps to add a new widgetset interface. This article is intended for developers who want to make an existing widget set available for use with the LCL. It describes the first steps to set up the directories and adapt the IDE for developing the new interface.
22
33## Steps
44
55As example we write the steps for adding a new interface for the *pogo* widget set.
66
77### Register the new widgetset in the IDE
88
99In the file lcl/interfacebase.pp add *lppogo* to TLCLPlatform add 'pogo' to LCLPlatformDirNames. Add 'pogo' to ide/lazconf.pp (LCLPlatformDisplayNames).
1010
1111Then rebuild the IDE with the LCL and restart it. You should now see the new wigdetset in the 'Configure build lazarus' dialog. Now the codetools know about it and basic code functions will work.
1212
1313### Create a directory for the interface
1414
1515Create a subdirectory pogo in lazarus\lcl\interface.
1616
1717Then copy the Makefile.fpc from one of the existing widgetsets and adapt it. For example change the *unittargetdir*. Then create the Makefile with [[Fpcmake]]:
1818
1919For *nix:
2020
21-```
21+```text
2222 cd lazarus/lcl/interfaces/pogo
2323 export FPCDIR=/home/username/fpc_sources_trunk/
2424 fpcmake -Tall
2525 export FPCDIR=
2626```
2727
2828For windows:
2929
30-```
30+```text
3131 cd lazarus\lcl\interfaces\pogo
3232 set FPCDIR=lazarus\fpc\source
3333 lazarus\fpc\2.3.1\bin\i386-win32\fpcmake -Tall
3434 set FPCDIR=
3535```
3636
3737You **must** use fpcmake from the latest and greatest and unstable FPC version, so that all FPC platforms are known in the Makefile. For the source it is less critical. The last line sets the variable FPCDIR to none. Otherwise other Makefiles will be auto regenerated too, which can accidently break things. So better make sure with the last line that FPCDIR is not set.
3838
3939Then copy the interfaces.pp from one of the other widgetsets and adapt it. For example rename the widgetset class to TPogoWidgetSet.
4040
4141Then create a first unit pogoint.pp for the new class TPogoWidgetSet. Every widgetset needs to override some abstract methods. Position the blinking cursor on class and use the refactoring tool Source Editor / Popup menu / Refactoring / Show abstract methods to automatically add the method stubs. Don't forget to use pogoint in the new interfaces.pp.
4242
4343### Update Makefiles
4444
4545Edit lazarus\lcl\interfaces\Makefile.fpc and append *pogo* to the Target directories
4646
4747 [target]
4848 dirs=gtk gtk2 win32 wince qt carbon fpgui pogo
4949
5050Generate the Makefile in lazarus\lcl\interfaces using [[Fpcmake]].
5151
5252### Add widgetset directory to update_allunits
5353
5454Add a line in lcl/update_allunits.lpr for the *pogo* widgetset. You will need to run this program as you implement the PogoWSxxxx units. I used
5555
56-```
56+```text
5757 instantfpc ./update_allunits.lpr
5858```
5959
6060Or you could run
6161
62-```
62+```text
6363 lazbuild ./update_allunits.lpr
6464 ./update_all_units
6565```
6666
6767You can now compile your new widgetset in the IDE, by setting the widgetset in the 'Configure build lazarus' dialog.
6868
6969### Compiler options / search paths
7070
7171If the new widgetset has subdirectories or need some extra flags, then these must be added to the Makefile (e.g. lcl/interfaces/pogo/Makefile) **and** to the LCL.lpk. Otherwise: ask Mattias via mail.
7272
7373---
7474*From the Free Pascal wiki, page "Adding a new interface", as it stood on 2021-02-21 after a change by Mattias2, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
7575Category: LCL
7676Category: Widgetsets

Back to history