Sign in Join
Wiki copytemporary

Carbon interface internals/de: what changed

Revision 6 to 7. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11## Einleitung
22
33Diese Seite bietet einen Überblick über die LCL Carbon Schnittstelle für macOS und soll neuen Entwicklern helfen.
44
55Für die Installation und Erzeugung einer ersten Carbon Anwendung lesen sie zunächst [[Carbon Interface/de|Carbon Interface]].
66
77## Andere Schnittstellen
88
99- [[Lazarus known issues (things that will never be fixed)]] - Eine Liste mit Kompatibilitätsproblemen der Schnittstellen
1010- [[Win32/64 Interface]] - Die winapi Schnittstelle für Windows 95/98/Me/2K/XP/Vista, aber nicht CE
1111- [[GTK2 Interface]] - Die gtk2 Schnittstelle für Unixes, macOS, Windows
1212- [[Carbon Interface]] - Die Carbon Schnittstelle für macOS
1313- [[Qt Interface]] - Die Qt 4 Schnittstelle für Unixes, macOS und linux-basierte PDAs
1414- [[Windows CE Interface]] - Für Pocket PC und Smartphones
1515- [[fpGUI Interface]] - Ein Widgetset komplett in Object Pascal geschrieben
1616
1717### Artikel über die Entwicklung von Schnittstellen
1818
1919- [[Carbon interface internals]] - Wenn du helfen willst, die Carbon Schnittstelle zu verbessern
2020- [[Windows CE Development Notes]] - Für Pocket PC und Smartphones
2121- [[Adding a new interface]] - Wie man eine neue Widgetset-Schnittstelle entwickelt
2222
2323## Dokumentation über Carbon
2424
2525- [Apple Carbon docs](http://developer.apple.com/documentation/Carbon)
2626
2727- [Apple Mailing List search](http://search.lists.apple.com)
2828
2929- [Carbon Buch zum Download](http://www.mactech.com/macintosh-c/downloads.html)
3030
3131- [Carbon Dev](http://www.carbondev.com/site/)
3232
3333- ["Learning Carbon" sample book chapter](http://www.oreilly.com/catalog/learncarbon)
3434
3535Die Carbon API unit von FreePascal ist FPCMacOSAll.pas in /usr/local/share/fpcsrc/packages/extra/univint.
3636
3737## Carbon Schnittstelle Entwicklungs-Grundlagen
3838
3939- Die macOS Zielversion ist 10.4
4040- Vermeiden sie die Verwendung von veralteten oder ausgemusterten APIs und Funktionen (z.B. QuickDraw vs. *Quartz 2D*)
4141- Verwenden sie den Objektansatz
4242- Prüfen sie die Ergebnisse von Carbon Aufrufen mit der OSError Funktion
4343- erwenden Sie UTF-8 kodierte Zeichenketten zwischen LCL und dem Carbon widgetset (für zukünftige Lazarus Unicode Unterstützung)
4444
4545## Was funktioniert bereits ?
4646
4747- Features - siehe [[Roadmap|Roadmap#Status_of_features_on_each_widgetset]]
4848- Formulare und Bedienelemente - siehe [[Roadmap|Roadmap Widgetset dependent components]]
4949- Erstellen von TOpenGLControl mit AGL Kontext (siehe components/opengl/)
5050- Maus Ereignisse
5151- Tastatur Ereignisse (VK_ mapping für fremde Tastaturen muss noch getestet werden)
5252
5353![](/wiki-images/d/d3/Carbon_interface_show_case.png)
5454
5555## Was muss als nächstes getan werden ?
5656
5757Siehe [Bug Tracker Carbon open issues](http://www.freepascal.org/mantis/view_all_set.php?type=3&source_query_id=1017)
5858
5959## Carbon IDE Bugs
6060
61-<thead>
62-
63-</thead>
64-<tbody>
65-
66-File New should be Cmd+N<br />
67-File Save As should be Shift+Cmd+S<br />
68-File Quit should be Cmd+Q<br />
69-Search Find should be Cmd+F<br />
70-Search Find Next should be Cmd+G<br />
71-Search Find Previous should be Shift+Cmd+G<br />
72-(Goto line and Procedure List need to be reassigned)<br />
73-Option+Cmd+F does not bring up Search Results<br />
74-F11 behaves weird!</td>
75-
76-</tbody>
61+| Item | Anmerkung | Abhängigkeiten | Verantwortlich |
62+|---|---|---|---|
63+| '...' buttons in dialogs | Now they are too large I think | | |
64+| OK/Cancel | Many dialogs have non-Mac check-X glyphs | | |
65+| \|Menu bar | Too wide for 1024x768 display resolution | | |
66+| \|Lazarus menu | Help About and app prefs (Environment options) should be accessible here | | |
67+| \|Menus | Many missing or non-standard menu shortcuts: · File New should be Cmd+N · File Save As should be Shift+Cmd+S · File Quit should be Cmd+Q · Search Find should be Cmd+F · Search Find Next should be Cmd+G · Search Find Previous should be Shift+Cmd+G · (Goto line and Procedure List need to be reassigned) · Option+Cmd+F does not bring up Search Results · F11 behaves weird! | \| | |
7768
7869Siehe [Bug Tracker Carbon IDE open issues](http://www.freepascal.org/mantis/view_all_set.php?type=3&source_query_id=1018)
7970
8071## Implementation Details
8172
8273### Keyboard
8374
8475- Apple Command key is mapped to ssCtrl per [Apple Guidelines](http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/index.html)
8576- Apple Control key is mapped to ssMeta
8677- Apple Option key is mapped to its inscription, i.e. ssAlt
8778- Virtual key codes mapping is not reliable (depends on keyboard language layout!)
8879
8980### Application
9081
9182- Title: You cannot change it at runtime. You have to set it in Application Bundle.
9283- OnDropFiles event is fired when file is dropped on application dock icon or opened via Finder if is associated. You have to enable this event in Application Bundle.
9384
9485### Drawing and measuring text precisely in parts
9586
9687If you want to draw (via TextOut, TextRect) or measure (via TextWidth, TextHeight) text divided into various parts and rely it will be displayed same each time not depending on its division, you have to disable some default typographic features (like kerning, fractional positioning, ...) of Canvas. You can choose one of the following:
9788
9889- CarbonWidgetSet.SetTextFractional(Canvas, False); // from CarbonInt unit
9990- TCarbonCustomControl(CustomControl.Handle).TextFractional := False; // from CarbonPrivate unit
10091- TCarbonDeviceContext(Canvas.Handle)..TextFractional := False; // from CarbonCanvas unit
10192
10293### Screenshot taking
10394
10495The only possible efficient way of taking a screenshot on macOS is using OpenGL. Apple provides a demonstration function which returns a CGImageRef with the screenshot. This function was converted to Pascal and is available on the glgrab.pas unit on the carbon interface directory. This function requires the Apple-specific parts of the Apple OpenGL headers, and those didn't exist yet in Pascal at this point, so the headers were translated and are placed on opengl.pas until they are released on a stable Free Pascal.
10596
10697It isn't possible to directly access the bytes of a CGImageRef, and the Screenshot taking rountine (TWidgetset.RawImage_fromDevice) requires doing that, so the image needs to be drawn to a CGContextRef which uses a memory area allocated by us as buffer. This painting has the great advantage of converting from the internal format of the screenshot bytes to the very convenient ARGB, 32-bits depth, 8-bits per channel format that is default to LCL.
10798
10899## Kompatibilitätsprobleme
109100
110101These are things that will probably never be solved.
111102
112103### Mouse.CursorPos changing does not generate mouse (move) events
113104
114105### Release mouse capture is not supported
115106
116107### Kommandozeilenparameter
117108
118109Because Carbon applications are executed via Application Bundle, command line parameters are not passed. You have to use OnDropFiles event to detect openning associated files.
119110
120111### Shortcuts indication is not supported
121112
122113### Drawing on Canvas outside OnPaint event is not supported
123114
124115### Drawing on screen device context is not supported
125116
126117### TCustomControl.Color of clBtnFace makes its background transparent
127118
128119### TWinControl.Font fsStrikeOut wird nicht unterstützt
129120
130121### TForm
131122
132123- Icon wird nicht unterstützt
133124- ShowInTaskbar wird nicht unterstützt
134125
135126### TEdit.PasswordChar different then default is not supported
136127
137128### TMemo.WordWrap when is disabled, does not allow to scroll text horizontally
138129
139130### TListBox.Columns wird nicht unterstützt
140131
141132### TComboBox
142133
143134- OnDropDown is called when set focus
144135- OnCloseUp is called when released focus
145136- DroppedDown does not show drop down list when style is csDropDownList
146137- DropDownCount wird nicht unterstützt
147138- Style: csSimple, csOwnerDrawFixed und csOwnerDrawVariable werden nicht unterstützt
148139
149140### TPanel.Bevelxxx: bvLowered und bvSpace werden nicht unterstützt
150141
151142### TBitBtn.Spacing is not supported
152143
153144### TTrackBar
154145
155146- LineSize wird nicht unterstützt
156147- ScalePos wird nicht unterstützt
157148- TickMarks werden nicht unterstützt
158149
159150### TProgressBar
160151
161152- BarShowText wird nicht unterstützt
162153- Smooth wird nicht unterstützt
163154- Step wird nicht unterstützt
164155
165156### TColorDialog.Title is not supported
166157
167158## Wie man ein neues Bedienelement hinzufügt
168159
169160Zum Beispiel TButton.
170161
171162TButton wird definiert in lcl/buttons.pp. Dies ist der plattformunabhängige Teil der LCL, welcher vom normalen LCL Programmierer benutzt wird.
172163
173164Seine widgetset Klasse befindet sich in lcl/widgetset/wsbuttons.pp. Dies ist die plattformabhängige Basis für alle widgetsets (carbon, gtk, win32, ...).
174165
175166Seine Carbon Schnittstellenklasse ist in lcl/interfaces/carbon/carbonwsbuttons.pp:
176167
177168``` pascal
178169 TCarbonWSButton = class(TWSButton)
179170 private
180171 protected
181172 public
182173 class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
183174 end;
184175```
185176
186177Jede WS Klasse, die tatsächlich etwas implementiert, muss registriert werden. Schauen sie sich den initialization Abschnitt am Ende der carbonwsXXX.pp Unit an:
187178
188179```text
189180 RegisterWSComponent(TCustomButton, TCarbonWSButton);
190181```
191182
192183TCarbonWSButton setzt CreateHandle außer Kraft und erzeugt eine Carbon-Schaltfläche-Helfer-Klasse namens TCarbonButton in carbonprivate.pp, die die Schaltfläche in Carbon erzeugt und die Event-Handler installiert.
193184
194185---
195186*From the Free Pascal wiki, page "Carbon interface internals/de", as it stood on 2019-12-17 after a change by Trev, 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).*

Back to history