Difference between revisions of "Carbon interface internals/de"

From Lazarus wiki
Jump to navigationJump to search
m
m
Line 10: Line 10:
  
 
[http://www.carbondev.com/site/ Carbon Dev]
 
[http://www.carbondev.com/site/ Carbon Dev]
 +
 +
== Carbon interface development basics ==
 +
 +
* Target Mac OS X version is 10.4
 +
* Avoid using obsolete or deprecated APIs and functions (e. g. QuickDraw vs. ''Quartz 2D'')
  
 
== Was funktioniert bereits ? ==
 
== Was funktioniert bereits ? ==
  
*Erstellen einer TForm
+
* Forms and controls - see [[Roadmap#Widgetset_dependent_components|Roadmap Widgetset dependent components]]
*Erstellen und Klicken auf einen TButton
 
*Erstellen und Bearbeiten eines TEdit
 
*Erstellen und Klicken auf eine TGroupBox
 
*Erstellen und Klicken auf eine TCheckBox
 
*Erstellen eines TStaticText
 
*Erstellen eines TTimer
 
 
*Erstellen von TOpenGLControl mit AGL Kontext (siehe components/opengl/)
 
*Erstellen von TOpenGLControl mit AGL Kontext (siehe components/opengl/)
 
*Maus Ereignisse
 
*Maus Ereignisse
Line 26: Line 25:
 
== Was muß als nächstes getan werden ? ==
 
== Was muß als nächstes getan werden ? ==
  
*Erstellen weiterer Bedienelemente (TComboBox, TRadioButton, TMemo, TListBox, TImage)
+
{|BORDER="1" CELLSPACING="0"
*Resize Ereignisse (wenn das Formular vom Benutzer resized wird)
+
!STYLE="background:#99D2FD;"|Item
*InvalidateRect
+
!STYLE="background:#99D2FD;"|Anmerkung
*ShowModal (für Dialoge)
+
!STYLE="background:#99D2FD;"|Abhängigkeiten
 +
!STYLE="background:#99D2FD;"|Verantwortlich
 +
|----
 +
|TControl.Cursor||SetThemeCursor|| ||
 +
|----
 +
|TComboBox||HIComboBox(Create)|| ||
 +
|----
 +
|TListBox||CreateListBoxControl|| ||
 +
|----
 +
|TCanvas||Quartz 2D, CGContext|| ||[[User:Tombo|Tombo]]
 +
|----
 +
|TPen||Quartz 2D|| ||[[User:Tombo|Tombo]]
 +
|----
 +
|TBrush||Quartz 2D|| ||[[User:Tombo|Tombo]]
 +
|----
 +
|SaveDC, RestoreDC||Quartz 2D, CGContextSaveGState, CGContextRestoreGState|| ||[[User:Tombo|Tombo]]
 +
|----
 +
|TBitmap.LoadFromFile||Quartz 2D, CGImage||GetDescriptionFromDevice, CreateBitmapFromRawImage, GetObject||[[User:Tombo|Tombo]]
 +
|----
 +
|TColorDialog||Color Picker Manager|| ||[[User:Tombo|Tombo]]
 +
|----
 +
|TButton.Default indication||kControlPushButtonDefaultTag|| ||[[User:Tombo|Tombo]]
 +
|----
 +
|TBitBtn||CreateBevelButtonControl|| ||[[User:Tombo|Tombo]]
 +
|----
 +
|TCustomControl|| || ||
 +
|----
 +
|TGraphicControl|| ||MoveWindowOrgEx, IntersectClipRect, SaveDC, RestoreDC||
 +
|----
 +
|ScreenDC||CGDisplayCapture, CGDisplayGetDrawingContext, CGDisplayRegisterReconfigurationCallback || ||
 +
|----
 +
|Hints||CreateNewWindow with kHelpWindowClass||WindowFromPoint||
 +
|}
 +
 
 +
== Bugs ==
 +
 
 +
{|BORDER="1" CELLSPACING="0"
 +
!STYLE="background:#FF9999;"|Item
 +
!STYLE="background:#FF9999;"|Anmerkung
 +
!STYLE="background:#FF9999;"|Abhängigkeiten
 +
!STYLE="background:#FF9999;"|Verantwortlich
 +
|----
 +
|Mouse events fired on structure part of TForm|| || ||
 +
|----
 +
|ShowWindow||Maximize <-> Restore is breaked|| ||
 +
|----
 +
|TScrollBar and TTrackBar live tracking|| || ||
 +
|----
 +
|TScrollBar arrow clicking|| || ||
 +
|----
 +
|TCustomEdit.MaxLength||The caret pos is not preserved when typed text is longer than maxlength|| ||[[User:Tombo|Tombo]]
 +
|----
 +
|TMemo.ReadOnly|| || ||
 +
|----
 +
|TMemo.WordWrap|| || ||
 +
|----
 +
|TMemo is not scrolling to caret|| || ||
 +
|----
 +
|TMemo.ScrollBars||Embed in HIScrollView -> solve event handling|| ||
 +
|----
 +
|EnumFontFamiliesEx, FindCarbonFontID||Get UTF-8 font names||UTF16ToUTF8||[[User:Tombo|Tombo]]
 +
|----
 +
|TCustomCheckBox.OnClick||Called before state is changed -> toggle manually|| ||[[User:Tombo|Tombo]]
 +
|----
 +
|TForm.ShowModal||Problem with repeated calling|| ||
 +
|----
 +
|TMaskEdit||Every typed char is doubled|| ||
 +
|}
  
== Weitere schwierige Aufgaben ==
+
== Compatibility issues ==
  
* TLabel ist custom drawn in der LCL. Das bedeutet, daß zuerst TCanvas implementiert werden muß.
+
=== Tastatur ===
* TCanvas benötigt GetDC/ReleaseDC, fonts, brush, pen, clipping und paint Nachrichten
+
 
* TMenu ist ganz anders als die GTK und Win32 Menüs.
+
* Apple Command key is mapped to ssCtrl due to [http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/index.html 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 keyborad language layout!)
 +
* Shortcuts indication (ampersand)
 +
 
 +
=== Drawing on canvas outside OnPaint event ===
 +
 
 +
* paints into QuickDraw window port, maybe QDBeginCGContext, QDEndCGContext would help
 +
 
 +
=== TControl.Color ===
 +
 
 +
* background of Carbon controls is transparent
 +
* implement at least for TEdit, TComboBox
  
 
== Wie man ein neues Bedienelement hinzufügt ==
 
== Wie man ein neues Bedienelement hinzufügt ==
Line 59: Line 138:
 
TCarbonWSButton setzt CreateHandle außer Kraft, um einen Carbon Button zu erstellen.
 
TCarbonWSButton setzt CreateHandle außer Kraft, um einen Carbon Button zu erstellen.
 
Der Code ist kurz und sollte leicht anpassbar sein für andere Bedienelemente wie TCheckBox.
 
Der Code ist kurz und sollte leicht anpassbar sein für andere Bedienelemente wie TCheckBox.
 
== Tastatur ==
 
 
*Apple Command key is mapped to ssCtrl due to [http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/index.html Apple Guidelines]
 
*Apple control key is mapped to ssMeta
 
*Apple option key is mapped to its inscription, i.e. ssAlt
 

Revision as of 23:02, 25 February 2007

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

Carbon interface development basics

  • Target Mac OS X version is 10.4
  • Avoid using obsolete or deprecated APIs and functions (e. g. QuickDraw vs. Quartz 2D)

Was funktioniert bereits ?

  • Forms and controls - see 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)

Was muß als nächstes getan werden ?

Item Anmerkung Abhängigkeiten Verantwortlich
TControl.Cursor SetThemeCursor
TComboBox HIComboBox(Create)
TListBox CreateListBoxControl
TCanvas Quartz 2D, CGContext Tombo
TPen Quartz 2D Tombo
TBrush Quartz 2D Tombo
SaveDC, RestoreDC Quartz 2D, CGContextSaveGState, CGContextRestoreGState Tombo
TBitmap.LoadFromFile Quartz 2D, CGImage GetDescriptionFromDevice, CreateBitmapFromRawImage, GetObject Tombo
TColorDialog Color Picker Manager Tombo
TButton.Default indication kControlPushButtonDefaultTag Tombo
TBitBtn CreateBevelButtonControl Tombo
TCustomControl
TGraphicControl MoveWindowOrgEx, IntersectClipRect, SaveDC, RestoreDC
ScreenDC CGDisplayCapture, CGDisplayGetDrawingContext, CGDisplayRegisterReconfigurationCallback
Hints CreateNewWindow with kHelpWindowClass WindowFromPoint

Bugs

Item Anmerkung Abhängigkeiten Verantwortlich
Mouse events fired on structure part of TForm
ShowWindow Maximize <-> Restore is breaked
TScrollBar and TTrackBar live tracking
TScrollBar arrow clicking
TCustomEdit.MaxLength The caret pos is not preserved when typed text is longer than maxlength Tombo
TMemo.ReadOnly
TMemo.WordWrap
TMemo is not scrolling to caret
TMemo.ScrollBars Embed in HIScrollView -> solve event handling
EnumFontFamiliesEx, FindCarbonFontID Get UTF-8 font names UTF16ToUTF8 Tombo
TCustomCheckBox.OnClick Called before state is changed -> toggle manually Tombo
TForm.ShowModal Problem with repeated calling
TMaskEdit Every typed char is doubled

Compatibility issues

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 keyborad language layout!)
  • Shortcuts indication (ampersand)

Drawing on canvas outside OnPaint event

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

TControl.Color

  • background of Carbon controls is transparent
  • implement at least for TEdit, TComboBox

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, um einen Carbon Button zu erstellen. Der Code ist kurz und sollte leicht anpassbar sein für andere Bedienelemente wie TCheckBox.