Sign in Join
Wiki copytemporary

Adding a new interface: what changed

Revision 3 to 4. 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-` cd lazarus/lcl/interfaces/pogo`\
22-` export FPCDIR=/home/username/fpc_sources_trunk/`\
23-` fpcmake -Tall`\
24-` export FPCDIR=`
21+```
22+ cd lazarus/lcl/interfaces/pogo
23+ export FPCDIR=/home/username/fpc_sources_trunk/
24+ fpcmake -Tall
25+ export FPCDIR=
26+```
2527
2628For windows:
2729
28-` cd lazarus\lcl\interfaces\pogo`\
29-` set FPCDIR=lazarus\fpc\source`\
30-` lazarus\fpc\2.3.1\bin\i386-win32\fpcmake -Tall`\
31-` set FPCDIR=`
30+```
31+ cd lazarus\lcl\interfaces\pogo
32+ set FPCDIR=lazarus\fpc\source
33+ lazarus\fpc\2.3.1\bin\i386-win32\fpcmake -Tall
34+ set FPCDIR=
35+```
3236
3337You **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.
3438
3539Then copy the interfaces.pp from one of the other widgetsets and adapt it. For example rename the widgetset class to TPogoWidgetSet.
3640
3741Then 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.
3842
3943### Update Makefiles
4044
4145Edit lazarus\lcl\interfaces\Makefile.fpc and append *pogo* to the Target directories
4246
4347 [target]
4448 dirs=gtk gtk2 win32 wince qt carbon fpgui pogo
4549
4650Generate the Makefile in lazarus\lcl\interfaces using [[Fpcmake]].
4751
4852### Add widgetset directory to update_allunits
4953
5054Add 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
5155
52-` instantfpc ./update_allunits.lpr`
56+```
57+ instantfpc ./update_allunits.lpr
58+```
5359
5460Or you could run
5561
56-` lazbuild ./update_allunits.lpr`\
57-` ./update_all_units`
62+```
63+ lazbuild ./update_allunits.lpr
64+ ./update_all_units
65+```
5866
5967You can now compile your new widgetset in the IDE, by setting the widgetset in the 'Configure build lazarus' dialog.
6068
6169### Compiler options / search paths
6270
6371If 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.
6472
6573---
6674*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).*
6775Category: LCL
6876Category: Widgetsets

Back to history