Difference between revisions of "Carbon interface internals"
Line 12: | Line 12: | ||
== What needs to be done next == | == What needs to be done next == | ||
− | *Create more controls ( | + | *Create more controls (TEdit, TCheckBox, TRadioButton, TGroupBox) |
*Keyboard events (KeyDown, KeyUp, Char) | *Keyboard events (KeyDown, KeyUp, Char) | ||
*Resize events (when form has been resized by user) | *Resize events (when form has been resized by user) |
Revision as of 22:14, 14 January 2006
This page gives an overview of the LCL carbon interface for MacOSX and will help new developers.
For installation and creating a first carbon application read first Carbon Interface.
What is already working ?
- Creating a TForm
- Creating and clicking on a TButton
- Creating TOpenGLControl with AGL context (see components/opengl/)
- Mouse events
What needs to be done next
- Create more controls (TEdit, TCheckBox, TRadioButton, TGroupBox)
- Keyboard events (KeyDown, KeyUp, Char)
- Resize events (when form has been resized by user)
- ShowModal (for dialogs)
How to add a new control
For example TButton.
TButton is defined in lcl/buttons.pp. This is the platform independent part of the LCL, that is shown to the user.
And its widgetset class in lcl/widgetset/wsbuttons.pp. This is the platform independent base for all widgetsets (carbon, gtk, win32, ...).
Its carbon interface class in lcl/interfaces/carbon/carbonwsbuttons.pp:
TCarbonWSButton = class(TWSButton) private protected public class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override; end;
Every WS class, that actually implements something must be registered. See the initialization section at the end of the carbonwsXXX.pp unit:
RegisterWSComponent(TCustomButton, TCarbonWSButton);
TCarbonWSButton overrides CreateHandle to create a carbon button. The code is short and should be easily adaptable for other controls like TCheckBox.
Keys
- 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