Carbon interface internals/de

From Free Pascal wiki
Revision as of 15:15, 18 May 2007 by Swen (talk | contribs)
Jump to navigationJump to search

Deutsch (de) English (en)

macOSlogo.png

Dieser Artikel behandelt ausschließlich macOS.

Siehe auch: Multiplatform Programming Guide/de

Apple iOS new.svg

Dieser Artikel behandelt ausschließlich iOS.

Siehe auch: Multiplatform Programming Guide/de


Diese Seite bietet einen Überblick über die LCL Carbon Schnittstelle für Mac OS X und soll neuen Entwicklern helfen.

Für die Installation und Erzeugung einer ersten Carbon Anwendung lesen sie zunächst Carbon Interface.

Dokumentation über Carbon

Carbon Buch zum Download

Carbon Dev

Apple Carbon docs

"Learning Carbon" sample book chapter

Free Pascal's Carbon API unit is FPCMacOSAll.pas in /usr/local/share/fpcsrc/packages/extra/univint.

Carbon Schnittstelle Entwicklungs-Grundlagen

  • Die Mac OS X Zielversion ist 10.4
  • Vermeiden sie die Verwendung von veralteten oder ausgemusterten APIs und Funktionen (z.B. QuickDraw vs. Quartz 2D)
  • Verwenden sie den Objektansatz
  • Prüfen sie die Ergebnisse von Carbon Aufrufen mit der OSError Funktion
  • Assume UTF-8 encoded strings between LCL and Carbon widgetset (für zukünftige Lazarus Unicode Unterstützung)

Was funktioniert bereits ?

  • Formulare und Bedienelemente - siehe Roadmap Widgetset dependent components
  • Erstellen von TOpenGLControl mit AGL Kontext (siehe components/opengl/)
  • Maus Ereignisse
  • Tastatur Ereignisse (VK_ mapping für fremde Tastaturen muß noch getestet werden)

Working components in the Carbon interface

Was muß als nächstes getan werden ?

Item Anmerkung Abhängigkeiten Verantwortlich
Mouse Capture releasing
GDI objects Delete only unselected objects
TListBox + TCheckListBox CreateListBoxControl does not function in compositing mode! We must create our own Carbon list box control.
TBitBtn default glyphs CreatePixmapIndirect
TBrush Patterns CGPatternCreate
ScreenDC CGDisplayCapture, CGDisplayGetDrawingContext - CGDisplayCapture locks screen! TCarbonScreenContext
StretchMaskBlt Implement: ROP, stretch mode
TCalendar no counterpart
TFontDialog FPShowHideFontPanel
TListView CreateDataBrowserControl
TSpeedButton DrawFrameControl Tombo
TScrollBox, TCustomControl with scrollbars, TScrollingWinControl HIScrollViewCreate Tombo
TClipboard PasteboardCreate

Bugs

Item Anmerkung Abhängigkeiten Verantwortlich
TCustomEdit.CharCase Is ignored when typing text
TMemo.WordWrap persistent bug, when word wrap is disabled the memo doesn't scroll to caret
TMaskEdit Every typed char is doubled

Kompatibilitätsprobleme

Tastatur

  • Apple Command key is mapped to ssCtrl due to Apple Guidelines
  • Apple control key is mapped to ssMeta
  • Apple option key is mapped to its inscription, i.e. ssAlt
  • Virtual key codes mapping (depends on keyboard language layout!)
  • Shortcuts indication (ampersand)

Drawing on canvas outside OnPaint event

  • paints into QuickDraw window port, maybe QDBeginCGContext, QDEndCGContext would help

Note that Quickdraw is deprecated as of Mac OS X 10.5, so in the long term this needs another solution.

TControl.Color

  • der Hintergrund von Carbon Bedienelementen ist transparent

Wie man ein neues Bedienelement hinzufügt

Zum Beispiel TButton.

TButton wird definiert in lcl/buttons.pp. Dies ist der plattformunabhängige Teil der LCL, welcher vom normalen LCL Programmierer benutzt wird.

Seine widgetset Klasse befindet sich in lcl/widgetset/wsbuttons.pp. Dies ist die plattformabhängige Basis für alle widgetsets (carbon, gtk, win32, ...).

Seine Carbon Schnittstellenklasse ist in lcl/interfaces/carbon/carbonwsbuttons.pp:

 TCarbonWSButton = class(TWSButton)
 private
 protected
 public
   class function  CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
 end;

Jede WS Klasse, die tatsächlich etwas implementiert, muß registriert werden. Schauen sie den initialization Abschnitt am Ende der carbonwsXXX.pp Unit an:

 RegisterWSComponent(TCustomButton, TCarbonWSButton);

TCarbonWSButton setzt CreateHandle außer Kraft, to create a Carbon button helper class called TCarbonButton in carbonprivate.pp, which really creates the button control in the Carbon and installs event handlers.