| 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. |
| 48 | 2 | | |
| 49 | 3 | | ## Steps |
| 50 | 4 | | |
| 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. |
| 52 | 6 | | |
| 53 | 7 | | ### Register the new widgetset in the IDE |
| 54 | 8 | | |
| 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). |
| 56 | 10 | | |
| 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. |
| 58 | 12 | | |
| 59 | 13 | | ### Create a directory for the interface |
| 60 | 14 | | |
| 61 | | - | Create a subdirectory pogo in lazarus\lcl\interface. |
| 15 | + | Create a subdirectory pogo in lazarus\lcl\interface. |
| 62 | 16 | | |
| 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]]: |
| 64 | 18 | | |
| 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: |
| 72 | 20 | | |
| 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=` |
| 80 | 25 | | |
| 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: |
| 82 | 27 | | |
| 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=` |
| 84 | 32 | | |
| 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. |
| 86 | 34 | | |
| 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 | + | |
| 87 | 39 | | ### Update Makefiles |
| 88 | 40 | | |
| 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] |
| 92 | 44 | | dirs=gtk gtk2 win32 wince qt carbon fpgui pogo |
| 93 | | - | ``` |
| 94 | 45 | | |
| 95 | | - | Generate the Makefile in lazarus\lcl\interfaces using [[Fpcmake]]. |
| 46 | + | Generate the Makefile in lazarus\lcl\interfaces using [[Fpcmake]]. |
| 96 | 47 | | |
| 97 | 48 | | ### Add widgetset directory to update_allunits |
| 98 | 49 | | |
| 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 |
| 103 | 51 | | |
| 104 | | - | Or you could run |
| 105 | | - | ``` |
| 106 | | - | lazbuild ./update_allunits.lpr |
| 107 | | - | ./update_all_units |
| 108 | | - | ``` |
| 52 | + | ` instantfpc ./update_allunits.lpr` |
| 109 | 53 | | |
| 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 |
| 111 | 55 | | |
| 112 | | - | |
| 56 | + | ` lazbuild ./update_allunits.lpr`\ |
| 57 | + | ` ./update_all_units` |
| 113 | 58 | | |
| 59 | + | You can now compile your new widgetset in the IDE, by setting the widgetset in the 'Configure build lazarus' dialog. |
| 60 | + | |
| 114 | 61 | | ### Compiler options / search paths |
| 115 | 62 | | |
| 116 | 63 | | If 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. |
| 117 | 64 | | |
| 118 | 65 | | --- |
| 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 |