Sign in Join
Wiki copytemporary

Adding a new interface: what changed

Revision 1 to 2. 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.
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.
22
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
48+
349## Steps
450
5-As example we write the steps for adding a new interface for the *pogo* widget set.
51+As example we write the steps for adding a new interface for the _pogo_ widget set.
652
753### Register the new widgetset in the IDE
854
9-In the file lcl/interfacebase.pp add *lppogo* to TLCLPlatform add 'pogo' to LCLPlatformDirNames. Add 'pogo' to ide/lazconf.pp (LCLPlatformDisplayNames).
55+In the file lcl/interfacebase.pp add _lppogo_ to TLCLPlatform add 'pogo' to LCLPlatformDirNames. Add 'pogo' to ide/lazconf.pp (LCLPlatformDisplayNames).
1056
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.
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.
1258
1359### Create a directory for the interface
1460
15-Create a subdirectory pogo in lazarus\lcl\interface.
16-
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]]:
18-
19-For *nix:
61+Create a subdirectory pogo in lazarus\lcl\interface.
2062
21-` cd lazarus/lcl/interfaces/pogo`\
22-` export FPCDIR=/home/username/fpc_sources_trunk/`\
23-` fpcmake -Tall`\
24-` export FPCDIR=`
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]]:
2564
26-For windows:
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+```
2772
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=`
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+```
3280
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.
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.
3482
35-Then copy the interfaces.pp from one of the other widgetsets and adapt it. For example rename the widgetset class to TPogoWidgetSet.
83+Then copy the interfaces.pp from one of the other widgetsets and adapt it. For example rename the widgetset class to TPogoWidgetSet.
3684
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.
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.
3886
3987### Update Makefiles
4088
41-Edit lazarus\lcl\interfaces\Makefile.fpc and append *pogo* to the Target directories
42-
43- [target]
89+Edit lazarus\lcl\interfaces\Makefile.fpc and append _pogo_ to the Target directories
90+```
91+[target]
4492 dirs=gtk gtk2 win32 wince qt carbon fpgui pogo
93+```
4594
46-Generate the Makefile in lazarus\lcl\interfaces using [[Fpcmake]].
95+Generate the Makefile in lazarus\lcl\interfaces using [[Fpcmake]].
4796
4897### Add widgetset directory to update_allunits
4998
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
51-
52-` instantfpc ./update_allunits.lpr`
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+```
53103
54-Or you could run
104+Or you could run
105+```
106+lazbuild ./update_allunits.lpr
107+ ./update_all_units
108+```
55109
56-` lazbuild ./update_allunits.lpr`\
57-` ./update_all_units`
110+You can now compile your new widgetset in the IDE, by setting the widgetset in the 'Configure build lazarus' dialog.
58111
59-You can now compile your new widgetset in the IDE, by setting the widgetset in the 'Configure build lazarus' dialog.
112+
60113
61114### Compiler options / search paths
62115
63116If 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.
64117
65118---
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
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).*

Back to history