Sign in Join
Wiki copytemporary

Carbon interface internals/de: what changed

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

OldNewLine
1+[![macOSlogo.png](/wiki-images/1/15/macOSlogo.png)](</File:macOSlogo.png>)
2+
3+Dieser Artikel behandelt ausschließlich [macOS](</Category:macOS> "Category:macOS").
4+
5+Siehe auch: [[Multiplatform Programming Guide/de]]
6+
7+[![Apple iOS new.svg](https://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Apple_iOS_new.svg/50px-Apple_iOS_new.svg.png)](</File:Apple_iOS_new.svg>)
8+
9+Dieser Artikel behandelt ausschließlich [iOS](</Category:iOS> "Category:iOS").
10+
11+Siehe auch: [[Multiplatform Programming Guide/de]]
12+
13+
14+****
15+
16+## Contents
17+
18+ * 1 Einleitung
19+ * 2 Andere Schnittstellen
20+ * 2.1 Artikel über die Entwicklung von Schnittstellen
21+ * 3 Dokumentation über Carbon
22+ * 4 Carbon Schnittstelle Entwicklungs-Grundlagen
23+ * 5 Was funktioniert bereits ?
24+ * 6 Was muss als nächstes getan werden ?
25+ * 7 Carbon IDE Bugs
26+ * 8 Implementation Details
27+ * 8.1 Keyboard
28+ * 8.2 Application
29+ * 8.3 Drawing and measuring text precisely in parts
30+ * 8.4 Screenshot taking
31+ * 9 Kompatibilitätsprobleme
32+ * 9.1 Mouse.CursorPos changing does not generate mouse (move) events
33+ * 9.2 Release mouse capture is not supported
34+ * 9.3 Kommandozeilenparameter
35+ * 9.4 Shortcuts indication is not supported
36+ * 9.5 Drawing on Canvas outside OnPaint event is not supported
37+ * 9.6 Drawing on screen device context is not supported
38+ * 9.7 TCustomControl.Color of clBtnFace makes its background transparent
39+ * 9.8 TWinControl.Font fsStrikeOut wird nicht unterstützt
40+ * 9.9 TForm
41+ * 9.10 TEdit.PasswordChar different then default is not supported
42+ * 9.11 TMemo.WordWrap when is disabled, does not allow to scroll text horizontally
43+ * 9.12 TListBox.Columns wird nicht unterstützt
44+ * 9.13 TComboBox
45+ * 9.14 TPanel.Bevelxxx: bvLowered und bvSpace werden nicht unterstützt
46+ * 9.15 TBitBtn.Spacing is not supported
47+ * 9.16 TTrackBar
48+ * 9.17 TProgressBar
49+ * 9.18 TColorDialog.Title is not supported
50+ * 10 Wie man ein neues Bedienelement hinzufügt
51+
152## Einleitung
253
3-Diese Seite bietet einen Überblick über die LCL Carbon Schnittstelle für macOS und soll neuen Entwicklern helfen.
54+Diese Seite bietet einen Überblick über die LCL Carbon Schnittstelle für macOS und soll neuen Entwicklern helfen.
455
5-Für die Installation und Erzeugung einer ersten Carbon Anwendung lesen sie zunächst [[Carbon Interface/de|Carbon Interface]].
56+Für die Installation und Erzeugung einer ersten Carbon Anwendung lesen sie zunächst [[Carbon Interface/de|Carbon Interface]].
657
758## Andere Schnittstellen
859
9-- [[Lazarus known issues (things that will never be fixed)]] - Eine Liste mit Kompatibilitätsproblemen der Schnittstellen
10-- [[Win32/64 Interface]] - Die winapi Schnittstelle für Windows 95/98/Me/2K/XP/Vista, aber nicht CE
11-- [[GTK2 Interface]] - Die gtk2 Schnittstelle für Unixes, macOS, Windows
12-- [[Carbon Interface]] - Die Carbon Schnittstelle für macOS
13-- [[Qt Interface]] - Die Qt 4 Schnittstelle für Unixes, macOS und linux-basierte PDAs
14-- [[Windows CE Interface]] - Für Pocket PC und Smartphones
15-- [[fpGUI Interface]] - Ein Widgetset komplett in Object Pascal geschrieben
60+ * [[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\)") \- Eine Liste mit Kompatibilitätsproblemen der Schnittstellen
61+ * [[Win32/64 Interface]] \- Die winapi Schnittstelle für Windows 95/98/Me/2K/XP/Vista, aber nicht CE
62+ * [[GTK2 Interface]] \- Die gtk2 Schnittstelle für Unixes, macOS, Windows
63+ * [[Carbon Interface]] \- Die Carbon Schnittstelle für macOS
64+ * [[Qt Interface]] \- Die Qt 4 Schnittstelle für Unixes, macOS und linux-basierte PDAs
65+ * [[Windows CE Interface]] \- Für Pocket PC und Smartphones
66+ * [[fpGUI Interface]] \- Ein Widgetset komplett in Object Pascal geschrieben
1667
1768### Artikel über die Entwicklung von Schnittstellen
1869
19-- [[Carbon interface internals]] - Wenn du helfen willst, die Carbon Schnittstelle zu verbessern
20-- [[Windows CE Development Notes]] - Für Pocket PC und Smartphones
21-- [[Adding a new interface]] - Wie man eine neue Widgetset-Schnittstelle entwickelt
70+ * [[Carbon interface internals]] \- Wenn du helfen willst, die Carbon Schnittstelle zu verbessern
71+ * [[Windows CE Development Notes]] \- Für Pocket PC und Smartphones
72+ * [[Adding a new interface]] \- Wie man eine neue Widgetset-Schnittstelle entwickelt
2273
2374## Dokumentation über Carbon
2475
25-- [Apple Carbon docs](http://developer.apple.com/documentation/Carbon)
76+ * [Apple Carbon docs](<http://developer.apple.com/documentation/Carbon>)
2677
27-- [Apple Mailing List search](http://search.lists.apple.com)
78+ * [Apple Mailing List search](<http://search.lists.apple.com>)
2879
29-- [Carbon Buch zum Download](http://www.mactech.com/macintosh-c/downloads.html)
80+ * [Carbon Buch zum Download](<http://www.mactech.com/macintosh-c/downloads.html>)
3081
31-- [Carbon Dev](http://www.carbondev.com/site/)
82+ * [Carbon Dev](<http://www.carbondev.com/site/>)
3283
33-- ["Learning Carbon" sample book chapter](http://www.oreilly.com/catalog/learncarbon)
84+ * ["Learning Carbon" sample book chapter](<http://www.oreilly.com/catalog/learncarbon>)
3485
35-Die Carbon API unit von FreePascal ist FPCMacOSAll.pas in /usr/local/share/fpcsrc/packages/extra/univint.
86+Die Carbon API unit von FreePascal ist FPCMacOSAll.pas in /usr/local/share/fpcsrc/packages/extra/univint.
3687
3788## Carbon Schnittstelle Entwicklungs-Grundlagen
3889
39-- Die macOS Zielversion ist 10.4
40-- Vermeiden sie die Verwendung von veralteten oder ausgemusterten APIs und Funktionen (z.B. QuickDraw vs. *Quartz 2D*)
41-- Verwenden sie den Objektansatz
42-- Prüfen sie die Ergebnisse von Carbon Aufrufen mit der OSError Funktion
43-- erwenden Sie UTF-8 kodierte Zeichenketten zwischen LCL und dem Carbon widgetset (für zukünftige Lazarus Unicode Unterstützung)
90+ * Die macOS Zielversion ist 10.4
91+ * Vermeiden sie die Verwendung von veralteten oder ausgemusterten APIs und Funktionen (z.B. QuickDraw vs. _Quartz 2D_)
92+ * Verwenden sie den Objektansatz
93+ * Prüfen sie die Ergebnisse von Carbon Aufrufen mit der OSError Funktion
94+ * erwenden Sie UTF-8 kodierte Zeichenketten zwischen LCL und dem Carbon widgetset (für zukünftige Lazarus Unicode Unterstützung)
4495
4596## Was funktioniert bereits ?
4697
47-- Features - siehe [[Roadmap|Roadmap#Status_of_features_on_each_widgetset]]
48-- Formulare und Bedienelemente - siehe [[Roadmap|Roadmap Widgetset dependent components]]
49-- Erstellen von TOpenGLControl mit AGL Kontext (siehe components/opengl/)
50-- Maus Ereignisse
51-- Tastatur Ereignisse (VK_ mapping für fremde Tastaturen muss noch getestet werden)
98+ * Features - siehe [[Roadmap|Roadmap#Status_of_features_on_each_widgetset]]
99+ * Formulare und Bedienelemente - siehe [[Roadmap|Roadmap Widgetset dependent components]]
100+ * Erstellen von TOpenGLControl mit AGL Kontext (siehe components/opengl/)
101+ * Maus Ereignisse
102+ * Tastatur Ereignisse (VK_ mapping für fremde Tastaturen muss noch getestet werden)
52103
53-<figure>
54-<img src="Carbon_interface_show_case.png" title="Working components in the Carbon interface" width="640" />
55-<figcaption>Working components in the Carbon interface</figcaption>
56-</figure>
104+[![Working components in the Carbon interface](/wiki-images/d/d3/Carbon_interface_show_case.png)](</File:Carbon_interface_show_case.png> "Working components in the Carbon interface")
57105
58106## Was muss als nächstes getan werden ?
59107
60-Siehe [Bug Tracker Carbon open issues](http://www.freepascal.org/mantis/view_all_set.php?type=3&source_query_id=1017)
108+Siehe [Bug Tracker Carbon open issues](<http://www.freepascal.org/mantis/view_all_set.php?type=3&source_query_id=1017>)
61109
62110## Carbon IDE Bugs
63111
64-<table>
65-<thead>
66-<tr>
67-<th data-STYLE="background:#FF9999;">Item</th>
68-<th data-STYLE="background:#FF9999;">Anmerkung</th>
69-<th data-STYLE="background:#FF9999;">Abhängigkeiten</th>
70-<th data-STYLE="background:#FF9999;">Verantwortlich</th>
71-</tr>
72-</thead>
73-<tbody>
74-<tr>
75-<td>'...' buttons in dialogs</td>
76-<td>Now they are too large I think</td>
77-<td></td>
78-<td></td>
79-</tr>
80-<tr>
81-<td>OK/Cancel</td>
82-<td>Many dialogs have non-Mac check-X glyphs</td>
83-<td></td>
84-<td></td>
85-</tr>
86-<tr>
87-<td>|Menu bar</td>
88-<td>Too wide for 1024x768 display resolution</td>
89-<td></td>
90-<td></td>
91-</tr>
92-<tr>
93-<td>|Lazarus menu</td>
94-<td>Help About and app prefs (Environment options) should be accessible here</td>
95-<td></td>
96-<td></td>
97-</tr>
98-<tr>
99-<td>|Menus</td>
100-<td>Many missing or non-standard menu shortcuts:<br />
101-File New should be Cmd+N<br />
102-File Save As should be Shift+Cmd+S<br />
103-File Quit should be Cmd+Q<br />
104-Search Find should be Cmd+F<br />
105-Search Find Next should be Cmd+G<br />
106-Search Find Previous should be Shift+Cmd+G<br />
107-(Goto line and Procedure List need to be reassigned)<br />
108-Option+Cmd+F does not bring up Search Results<br />
109-F11 behaves weird!</td>
110-<td>|</td>
111-<td></td>
112-</tr>
113-</tbody>
114-</table>
115-
116-Siehe [Bug Tracker Carbon IDE open issues](http://www.freepascal.org/mantis/view_all_set.php?type=3&source_query_id=1018)
112+Item | Anmerkung | Abhängigkeiten | Verantwortlich
113+---|---|---|---
114+'...' buttons in dialogs | Now they are too large I think | |
115+OK/Cancel | Many dialogs have non-Mac check-X glyphs | |
116+Menu bar | Too wide for 1024x768 display resolution | |
117+Lazarus menu | Help About and app prefs (Environment options) should be accessible here | |
118+Menus | Many missing or non-standard menu shortcuts:
119+File New should be Cmd+N
120+File Save As should be Shift+Cmd+S
121+File Quit should be Cmd+Q
122+Search Find should be Cmd+F
123+Search Find Next should be Cmd+G
124+Search Find Previous should be Shift+Cmd+G
125+(Goto line and Procedure List need to be reassigned)
126+Option+Cmd+F does not bring up Search Results
127+F11 behaves weird! | |
128+
129+Siehe [Bug Tracker Carbon IDE open issues](<http://www.freepascal.org/mantis/view_all_set.php?type=3&source_query_id=1018>)
117130
118131## Implementation Details
119132
120133### Keyboard
121134
122-- Apple Command key is mapped to ssCtrl per [Apple Guidelines](http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/index.html)
123-- Apple Control key is mapped to ssMeta
124-- Apple Option key is mapped to its inscription, i.e. ssAlt
125-- Virtual key codes mapping is not reliable (depends on keyboard language layout!)
135+ * Apple Command key is mapped to ssCtrl per [Apple Guidelines](<http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/index.html>)
136+ * Apple Control key is mapped to ssMeta
137+ * Apple Option key is mapped to its inscription, i.e. ssAlt
138+ * Virtual key codes mapping is not reliable (depends on keyboard language layout!)
126139
127140### Application
128141
129-- Title: You cannot change it at runtime. You have to set it in Application Bundle.
130-- 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.
142+ * Title: You cannot change it at runtime. You have to set it in Application Bundle.
143+ * 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.
131144
132145### Drawing and measuring text precisely in parts
133146
134-If 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:
147+If 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:
135148
136-- CarbonWidgetSet.SetTextFractional(Canvas, False); // from CarbonInt unit
137-- TCarbonCustomControl(CustomControl.Handle).TextFractional := False; // from CarbonPrivate unit
138-- TCarbonDeviceContext(Canvas.Handle)..TextFractional := False; // from CarbonCanvas unit
149+ * CarbonWidgetSet.SetTextFractional(Canvas, False); // from CarbonInt unit
150+ * TCarbonCustomControl(CustomControl.Handle).TextFractional := False; // from CarbonPrivate unit
151+ * TCarbonDeviceContext(Canvas.Handle)..TextFractional := False; // from CarbonCanvas unit
139152
140153### Screenshot taking
141154
142-The 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.
155+The 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.
143156
144-It 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.
157+It 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.
145158
146159## Kompatibilitätsprobleme
147160
148-These are things that will probably never be solved.
161+These are things that will probably never be solved.
149162
150163### Mouse.CursorPos changing does not generate mouse (move) events
151164
152165### Release mouse capture is not supported
153166
154167### Kommandozeilenparameter
155168
156-Because Carbon applications are executed via Application Bundle, command line parameters are not passed. You have to use OnDropFiles event to detect openning associated files.
169+Because Carbon applications are executed via Application Bundle, command line parameters are not passed. You have to use OnDropFiles event to detect openning associated files.
157170
158171### Shortcuts indication is not supported
159172
160173### Drawing on Canvas outside OnPaint event is not supported
161174
162175### Drawing on screen device context is not supported
163176
164177### TCustomControl.Color of clBtnFace makes its background transparent
165178
166179### TWinControl.Font fsStrikeOut wird nicht unterstützt
167180
168181### TForm
169182
170-- Icon wird nicht unterstützt
171-- ShowInTaskbar wird nicht unterstützt
183+ * Icon wird nicht unterstützt
184+ * ShowInTaskbar wird nicht unterstützt
172185
173186### TEdit.PasswordChar different then default is not supported
174187
175188### TMemo.WordWrap when is disabled, does not allow to scroll text horizontally
176189
177190### TListBox.Columns wird nicht unterstützt
178191
179192### TComboBox
180193
181-- OnDropDown is called when set focus
182-- OnCloseUp is called when released focus
183-- DroppedDown does not show drop down list when style is csDropDownList
184-- DropDownCount wird nicht unterstützt
185-- Style: csSimple, csOwnerDrawFixed und csOwnerDrawVariable werden nicht unterstützt
194+ * OnDropDown is called when set focus
195+ * OnCloseUp is called when released focus
196+ * DroppedDown does not show drop down list when style is csDropDownList
197+ * DropDownCount wird nicht unterstützt
198+ * Style: csSimple, csOwnerDrawFixed und csOwnerDrawVariable werden nicht unterstützt
186199
187200### TPanel.Bevelxxx: bvLowered und bvSpace werden nicht unterstützt
188201
189202### TBitBtn.Spacing is not supported
190203
191204### TTrackBar
192205
193-- LineSize wird nicht unterstützt
194-- ScalePos wird nicht unterstützt
195-- TickMarks werden nicht unterstützt
206+ * LineSize wird nicht unterstützt
207+ * ScalePos wird nicht unterstützt
208+ * TickMarks werden nicht unterstützt
196209
197210### TProgressBar
198211
199-- BarShowText wird nicht unterstützt
200-- Smooth wird nicht unterstützt
201-- Step wird nicht unterstützt
212+ * BarShowText wird nicht unterstützt
213+ * Smooth wird nicht unterstützt
214+ * Step wird nicht unterstützt
202215
203216### TColorDialog.Title is not supported
204217
205218## Wie man ein neues Bedienelement hinzufügt
206219
207-Zum Beispiel TButton.
208-
209-TButton wird definiert in lcl/buttons.pp. Dies ist der plattformunabhängige Teil der LCL, welcher vom normalen LCL Programmierer benutzt wird.
210-
211-Seine widgetset Klasse befindet sich in lcl/widgetset/wsbuttons.pp. Dies ist die plattformabhängige Basis für alle widgetsets (carbon, gtk, win32, ...).
220+Zum Beispiel TButton.
212221
213-Seine Carbon Schnittstellenklasse ist in lcl/interfaces/carbon/carbonwsbuttons.pp:
222+TButton wird definiert in lcl/buttons.pp. Dies ist der plattformunabhängige Teil der LCL, welcher vom normalen LCL Programmierer benutzt wird.
214223
215-` TCarbonWSButton = class(TWSButton)`\
216-` private`\
217-` protected`\
218-` public`\
219-`   class function  CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;`\
220-` end;`
224+Seine widgetset Klasse befindet sich in lcl/widgetset/wsbuttons.pp. Dies ist die plattformabhängige Basis für alle widgetsets (carbon, gtk, win32, ...).
221225
222-Jede WS Klasse, die tatsächlich etwas implementiert, muss registriert werden. Schauen sie sich den initialization Abschnitt am Ende der carbonwsXXX.pp Unit an:
226+Seine Carbon Schnittstellenklasse ist in lcl/interfaces/carbon/carbonwsbuttons.pp:
227+```
228+TCarbonWSButton = class(TWSButton)
229+ private
230+ protected
231+ public
232+ class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
233+ end;
234+```
223235
224-` RegisterWSComponent(TCustomButton, TCarbonWSButton);`
236+Jede WS Klasse, die tatsächlich etwas implementiert, muss registriert werden. Schauen sie sich den initialization Abschnitt am Ende der carbonwsXXX.pp Unit an:
237+```
238+RegisterWSComponent(TCustomButton, TCarbonWSButton);
239+```
225240
226241TCarbonWSButton 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.
227242
228243---
229-*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).*
244+*From the Free Pascal wiki, page "Carbon interface internals/de", as the Internet Archive kept it on 2024-09-09. 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