Sign in Join
Wiki copytemporary

Adding a new interface: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1-This 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.
2-
3-## Contents
4-
5- * 1 Other Interfaces
6- * 1.1 Platform specific Tips
7- * 1.2 Interface Development Articles
8- * 2 Steps
9- * 2.1 Register the new widgetset in the IDE
10- * 2.2 Create a directory for the interface
11- * 2.3 Update Makefiles
12- * 2.4 Add widgetset directory to update_allunits
13- * 2.5 Compiler options / search paths
14-
15-## Other Interfaces
16-
17- * [[Lazarus known issues \(things that will never be fixed\|Lazarus known issues (things that will never be fixed)]]> "Lazarus known issues \(things that will never be fixed\)") \- A list of interface compatibility issues
18- * [[Win32/64 Interface]] \- The Windows API (formerly Win32 API) interface for Windows 95/98/Me/2000/XP/Vista/10, but not CE
19- * [[Windows CE Interface]] \- For Pocket PC and Smartphones
20- * [[Carbon Interface]] \- The Carbon 32 bit interface for macOS (deprecated; removed from macOS 10.15)
21- * [[Cocoa Interface]] \- The Cocoa 64 bit interface for macOS
22- * [[Qt Interface]] \- The Qt4 interface for Unixes, macOS, Windows, and Linux-based PDAs
23- * [[Qt5 Interface]] \- The Qt5 interface for Unixes, macOS, Windows, and Linux-based PDAs
24- * [[GTK1 Interface]] \- The gtk1 interface for Unixes, macOS (X11), Windows
25- * [[GTK2 Interface]] \- The gtk2 interface for Unixes, macOS (X11), Windows
26- * [[GTK3 Interface]] \- The gtk3 interface for Unixes, macOS (X11), Windows
27- * [[fpGUI Interface]] \- Based on the fpGUI library, which is a cross-platform toolkit completely written in Object Pascal
28- * [[Custom Drawn Interface]] \- A cross-platform LCL backend written completely in Object Pascal inside Lazarus. The Lazarus interface to Android.
29-
30-### Platform specific Tips
31-
32- * [[Android Programming]] \- For Android smartphones and tablets
33- * [[iPhone/iPod development]] \- About using Objective Pascal to develop iOS applications
34- * [[FreeBSD Programming Tips]] \- FreeBSD programming tips
35- * [[Linux Programming Tips]] \- How to execute particular programming tasks in Linux
36- * [[macOS Programming Tips]] \- Lazarus tips, useful tools, Unix commands, and more...
37- * [[WinCE Programming Tips]] \- Using the telephone API, sending SMSes, and more...
38- * [[Windows Programming Tips]] \- Desktop Windows programming tips
39-
40-### Interface Development Articles
41-
42- * [[Carbon interface internals]] \- If you want to help improving the Carbon interface
43- * [[Windows CE Development Notes]] \- For Pocket PC and Smartphones
44- * Adding a new interface \- How to add a new widget set interface
45- * [[LCL Defines]] \- Choosing the right options to recompile LCL
46- * [[LCL Internals]] \- Some info about the inner workings of the LCL
47- * [[Cocoa Internals]] \- Some info about the inner workings of the Cocoa widgetset
1+This 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.
482
493## Steps
504
51-As example we write the steps for adding a new interface for the _pogo_ widget set.
5+As example we write the steps for adding a new interface for the *pogo* widget set.
526
537### Register the new widgetset in the IDE
548
55-In the file lcl/interfacebase.pp add _lppogo_ to TLCLPlatform add 'pogo' to LCLPlatformDirNames. Add 'pogo' to ide/lazconf.pp (LCLPlatformDisplayNames).
9+In the file lcl/interfacebase.pp add *lppogo* to TLCLPlatform add 'pogo' to LCLPlatformDirNames. Add 'pogo' to ide/lazconf.pp (LCLPlatformDisplayNames).
5610
57-Then 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.
11+Then 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.
5812
5913### Create a directory for the interface
6014
61-Create a subdirectory pogo in lazarus\lcl\interface.
15+Create a subdirectory pogo in lazarus\lcl\interface.
6216
63-Then copy the Makefile.fpc from one of the existing widgetsets and adapt it. For example change the _unittargetdir_. Then create the Makefile with [[Fpcmake]]:
17+Then copy the Makefile.fpc from one of the existing widgetsets and adapt it. For example change the *unittargetdir*. Then create the Makefile with [[Fpcmake]]:
6418
65-For *nix:
66-```
67-cd lazarus/lcl/interfaces/pogo
68- export FPCDIR=/home/username/fpc_sources_trunk/
69- fpcmake -Tall
70- export FPCDIR=
71-```
19+For *nix:
7220
73-For windows:
74-```
75-cd lazarus\lcl\interfaces\pogo
76- set FPCDIR=lazarus\fpc\source
77- lazarus\fpc\2.3.1\bin\i386-win32\fpcmake -Tall
78- set FPCDIR=
79-```
21+` cd lazarus/lcl/interfaces/pogo`\
22+` export FPCDIR=/home/username/fpc_sources_trunk/`\
23+` fpcmake -Tall`\
24+` export FPCDIR=`
8025
81-You **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.
26+For windows:
8227
83-Then copy the interfaces.pp from one of the other widgetsets and adapt it. For example rename the widgetset class to TPogoWidgetSet.
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=`
8432
85-Then 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.
33+You **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.
8634
35+Then copy the interfaces.pp from one of the other widgetsets and adapt it. For example rename the widgetset class to TPogoWidgetSet.
36+
37+Then 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.
38+
8739### Update Makefiles
8840
89-Edit lazarus\lcl\interfaces\Makefile.fpc and append _pogo_ to the Target directories
90-```
91-[target]
41+Edit lazarus\lcl\interfaces\Makefile.fpc and append *pogo* to the Target directories
42+
43+ [target]
9244 dirs=gtk gtk2 win32 wince qt carbon fpgui pogo
93-```
9445
95-Generate the Makefile in lazarus\lcl\interfaces using [[Fpcmake]].
46+Generate the Makefile in lazarus\lcl\interfaces using [[Fpcmake]].
9647
9748### Add widgetset directory to update_allunits
9849
99-Add 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
100-```
101-instantfpc ./update_allunits.lpr
102-```
50+Add 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
10351
104-Or you could run
105-```
106-lazbuild ./update_allunits.lpr
107- ./update_all_units
108-```
52+` instantfpc ./update_allunits.lpr`
10953
110-You can now compile your new widgetset in the IDE, by setting the widgetset in the 'Configure build lazarus' dialog.
54+Or you could run
11155
112-
56+` lazbuild ./update_allunits.lpr`\
57+` ./update_all_units`
11358
59+You can now compile your new widgetset in the IDE, by setting the widgetset in the 'Configure build lazarus' dialog.
60+
11461### Compiler options / search paths
11562
11663If 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.
11764
11865---
119-*From the Free Pascal wiki, page "Adding a new interface", as the Internet Archive kept it on 2022-12-31. 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).*
66+*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).*
67+Category: LCL
68+Category: Widgetsets

Back to history