~ubuntu-branches/ubuntu/saucy/lazarus/saucy

« back to all changes in this revision

Viewing changes to lcl/interfaces/carbon/carbonwscomctrls.pp

  • Committer: Package Import Robot
  • Author(s): Paul Gevers, Abou Al Montacir, Bart Martens, Paul Gevers
  • Date: 2013-06-08 14:12:17 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20130608141217-7k0cy9id8ifcnutc
Tags: 1.0.8+dfsg-1
[ Abou Al Montacir ]
* New upstream major release and multiple maintenace release offering many
  fixes and new features marking a new milestone for the Lazarus development
  and its stability level.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_fixes_branch
* LCL changes:
  - LCL is now a normal package.
      + Platform independent parts of the LCL are now in the package LCLBase
      + LCL is automatically recompiled when switching the target platform,
        unless pre-compiled binaries for this target are already installed.
      + No impact on existing projects.
      + Linker options needed by LCL are no more added to projects that do
        not use the LCL package.
  - Minor changes in LCL basic classes behaviour
      + TCustomForm.Create raises an exception if a form resource is not
        found.
      + TNotebook and TPage: a new implementation of these classes was added.
      + TDBNavigator: It is now possible to have focusable buttons by setting
        Options = [navFocusableButtons] and TabStop = True, useful for
        accessibility and for devices with neither mouse nor touch screen.
      + Names of TControlBorderSpacing.GetSideSpace and GetSpace were swapped
        and are now consistent. GetSideSpace = Around + GetSpace.
      + TForm.WindowState=wsFullscreen was added
      + TCanvas.TextFitInfo was added to calculate how many characters will
        fit into a specified Width. Useful for word-wrapping calculations.
      + TControl.GetColorResolvingParent and
        TControl.GetRGBColorResolvingParent were added, simplifying the work
        to obtain the final color of the control while resolving clDefault
        and the ParentColor.
      + LCLIntf.GetTextExtentExPoint now has a good default implementation
        which works in any platform not providing a specific implementation.
        However, Widgetset specific implementation is better, when available.
      + TTabControl was reorganized. Now it has the correct class hierarchy
        and inherits from TCustomTabControl as it should.
  - New unit in the LCL:
      + lazdialogs.pas: adds non-native versions of various native dialogs,
        for example TLazOpenDialog, TLazSaveDialog, TLazSelectDirectoryDialog.
        It is used by widgetsets which either do not have a native dialog, or
        do not wish to use it because it is limited. These dialogs can also be
        used by user applications directly.
      + lazdeviceapis.pas: offers an interface to more hardware devices such
        as the accelerometer, GPS, etc. See LazDeviceAPIs
      + lazcanvas.pas: provides a TFPImageCanvas descendent implementing
        drawing in a LCL-compatible way, but 100% in Pascal.
      + lazregions.pas. LazRegions is a wholly Pascal implementation of
        regions for canvas clipping, event clipping, finding in which control
        of a region tree one an event should reach, for drawing polygons, etc.
      + customdrawncontrols.pas, customdrawndrawers.pas,
        customdrawn_common.pas, customdrawn_android.pas and
        customdrawn_winxp.pas: are the Lazarus Custom Drawn Controls -controls
        which imitate the standard LCL ones, but with the difference that they
        are non-native and support skinning.
  - New APIs added to the LCL to improve support of accessibility software
    such as screen readers.
* IDE changes:
  - Many improvments.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/New_IDE_features_since#v1.0_.282012-08-29.29
    http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes#IDE_Changes
* Debugger / Editor changes:
  - Added pascal sources and breakpoints to the disassembler
  - Added threads dialog.
* Components changes:
  - TAChart: many fixes and new features
  - CodeTool: support Delphi style generics and new syntax extensions.
  - AggPas: removed to honor free licencing. (Closes: Bug#708695)
[Bart Martens]
* New debian/watch file fixing issues with upstream RC release.
[Abou Al Montacir]
* Avoid changing files in .pc hidden directory, these are used by quilt for
  internal purpose and could lead to surprises during build.
[Paul Gevers]
* Updated get-orig-source target and it compinion script orig-tar.sh so that they
  repack the source file, allowing bug 708695 to be fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
{ $Id: carbonwscomctrls.pp 27827 2010-10-24 07:56:36Z sekelsenmat $}
2
1
{
3
2
 *****************************************************************************
4
3
 *                              CarbonWSComCtrls.pp                          *
30
29
{$I carbondefines.inc}
31
30
 
32
31
uses
33
 
  // libs
34
 
  MacOSAll,
35
32
  // LCL
36
 
  Classes, Controls, ComCtrls, StdCtrls, LCLType, LCLProc, Graphics, Math, ImgList,
 
33
  Classes, Controls, ComCtrls, StdCtrls, LCLType, LCLProc, Graphics, ImgList,
37
34
  // widgetset
38
 
  WSComCtrls, WSLCLClasses, WSControls, WSProc,
 
35
  WSComCtrls, WSLCLClasses,
39
36
  // LCL Carbon
40
 
  CarbonDef, CarbonPrivate, CarbonBars, CarbonStrings, CarbonWSControls,
 
37
  CarbonDef, CarbonPrivate, CarbonBars,
41
38
  CarbonListViews;
42
39
 
43
40
type
58
55
  published
59
56
  end;
60
57
 
 
58
 
 
59
  { TCarbonWSCustomPage }
 
60
 
 
61
  TCarbonWSCustomPage = class(TWSCustomPage)
 
62
  published
 
63
    class function  CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
 
64
    class procedure UpdateProperties(const ACustomPage: TCustomPage); override;
 
65
  end;
 
66
 
 
67
  { TCarbonWSCustomNotebook }
 
68
 
 
69
  TCarbonWSCustomNotebook = class(TWSCustomTabControl)
 
70
  published
 
71
    class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
 
72
 
 
73
    class procedure AddPage(const ATabControl: TCustomTabControl; const AChild: TCustomPage; const AIndex: integer); override;
 
74
    class procedure MovePage(const ATabControl: TCustomTabControl; const AChild: TCustomPage; const NewIndex: integer); override;
 
75
    class procedure RemovePage(const ATabControl: TCustomTabControl; const AIndex: integer); override;
 
76
 
 
77
    //class function GetNotebookMinTabHeight(const AWinControl: TWinControl): integer; override;
 
78
    //class function GetNotebookMinTabWidth(const AWinControl: TWinControl): integer; override;
 
79
    //class function GetPageRealIndex(const ATabControl: TCustomTabControl; AIndex: Integer): Integer; override;
 
80
    class function GetTabIndexAtPos(const ATabControl: TCustomTabControl; const AClientPos: TPoint): integer; override;
 
81
    class procedure SetPageIndex(const ATabControl: TCustomTabControl; const AIndex: integer); override;
 
82
    class procedure SetTabPosition(const ATabControl: TCustomTabControl; const ATabPosition: TTabPosition); override;
 
83
    class procedure ShowTabs(const ATabControl: TCustomTabControl; AShowTabs: boolean); override;
 
84
  end;
 
85
 
61
86
  { TCarbonWSPageControl }
62
87
 
63
88
  TCarbonWSPageControl = class(TWSPageControl)
71
96
    class function  CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
72
97
    // Column
73
98
    class procedure ColumnDelete(const ALV: TCustomListView; const AIndex: Integer); override;
74
 
    class function  ColumnGetWidth(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn): Integer; override;
 
99
    class function  ColumnGetWidth(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AColumn: TListColumn): Integer; override;
75
100
    class procedure ColumnInsert(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn); override;
76
101
    class procedure ColumnMove(const ALV: TCustomListView; const AOldIndex, ANewIndex: Integer; const AColumn: TListColumn); override;
77
 
    class procedure ColumnSetAlignment(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AAlignment: TAlignment); override;
78
 
    //class procedure ColumnSetAutoSize(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AAutoSize: Boolean); override;
79
 
    class procedure ColumnSetCaption(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const ACaption: String); override;
80
 
    class procedure ColumnSetImage(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AImageIndex: Integer); override;
81
 
    class procedure ColumnSetMaxWidth(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AMaxWidth: Integer); override;
82
 
    class procedure ColumnSetMinWidth(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AMinWidth: integer); override;
83
 
    class procedure ColumnSetWidth(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AWidth: Integer); override;
84
 
    class procedure ColumnSetVisible(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AVisible: Boolean); override;
 
102
    class procedure ColumnSetAlignment(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AColumn: TListColumn; const AAlignment: TAlignment); override;
 
103
    class procedure ColumnSetAutoSize(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AColumn: TListColumn; const AAutoSize: Boolean); override;
 
104
    class procedure ColumnSetCaption(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AColumn: TListColumn; const ACaption: String); override;
 
105
    class procedure ColumnSetImage(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AColumn: TListColumn; const AImageIndex: Integer); override;
 
106
    class procedure ColumnSetMaxWidth(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AColumn: TListColumn; const AMaxWidth: Integer); override;
 
107
    class procedure ColumnSetMinWidth(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AColumn: TListColumn; const AMinWidth: integer); override;
 
108
    class procedure ColumnSetWidth(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AColumn: TListColumn; const AWidth: Integer); override;
 
109
    class procedure ColumnSetVisible(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AColumn: TListColumn; const AVisible: Boolean); override;
85
110
 
86
111
    // Item
87
112
    class procedure ItemDelete(const ALV: TCustomListView; const AIndex: Integer); override;
88
113
    class function  ItemDisplayRect(const ALV: TCustomListView; const AIndex, ASubItem: Integer; ACode: TDisplayCode): TRect; override;
89
 
    class function  ItemGetChecked(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem): Boolean; override;
 
114
    class function  ItemGetChecked(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AItem: TListItem): Boolean; override;
90
115
    class function  ItemGetPosition(const ALV: TCustomListView; const AIndex: Integer): TPoint; override;
91
 
    class function  ItemGetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; out AIsSet: Boolean): Boolean; override; // returns True if supported
92
 
    class procedure ItemInsert(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem); override;
93
 
    class procedure ItemSetChecked(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AChecked: Boolean); override;
94
 
    class procedure ItemSetImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AImageIndex: Integer); override;
 
116
    class function  ItemGetState(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AItem: TListItem; const AState: TListItemState; out AIsSet: Boolean): Boolean; override; // returns True if supported
 
117
    class procedure ItemInsert(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AItem: TListItem); override;
 
118
    class procedure ItemSetChecked(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AItem: TListItem; const AChecked: Boolean); override;
 
119
    class procedure ItemSetImage(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AItem: TListItem; const {%H-}ASubIndex, {%H-}AImageIndex: Integer); override;
95
120
    //class function ItemSetPosition(const ALV: TCustomListView; const AIndex: Integer; const ANewPosition: TPoint): Boolean; override;
96
 
    class procedure ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean); override;
97
 
    class procedure ItemSetText(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex: Integer; const AText: String); override;
98
 
    class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean); override;
 
121
    class procedure ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean); override;
 
122
    class procedure ItemSetText(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AItem: TListItem; const {%H-}ASubIndex: Integer; const {%H-}AText: String); override;
 
123
    class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AItem: TListItem; const PartialOK: Boolean); override;
99
124
 
100
125
    // LV
101
126
    //class procedure BeginUpdate(const ALV: TCustomListView); override;
116
141
    class procedure SetDefaultItemHeight(const ALV: TCustomListView; const AValue: Integer); override;
117
142
    //class procedure SetHotTrackStyles(const ALV: TCustomListView; const AValue: TListHotTrackStyles); override;
118
143
    //class procedure SetHoverTime(const ALV: TCustomListView; const AValue: Integer); override;
119
 
    class procedure SetImageList(const ALV: TCustomListView; const AList: TListViewImageList; const AValue: TCustomImageList); override;
 
144
    class procedure SetImageList(const ALV: TCustomListView; const {%H-}AList: TListViewImageList; const {%H-}AValue: TCustomImageList); override;
120
145
    class procedure SetItemsCount(const ALV: TCustomListView; const Avalue: Integer); override;
121
 
    class procedure SetOwnerData(const ALV: TCustomListView; const AValue: Boolean); override;
 
146
    class procedure SetOwnerData(const ALV: TCustomListView; const {%H-}AValue: Boolean); override;
122
147
    class procedure SetProperty(const ALV: TCustomListView; const AProp: TListViewProperty; const AIsSet: Boolean); override;
123
148
    class procedure SetProperties(const ALV: TCustomListView; const AProps: TListViewProperties); override;
124
149
    class procedure SetScrollBars(const ALV: TCustomListView; const AValue: TScrollStyle); override;
125
 
    class procedure SetSort(const ALV: TCustomListView; const AType: TSortType; const AColumn: Integer); override;
 
150
    class procedure SetSort(const ALV: TCustomListView; const {%H-}AType: TSortType; const {%H-}AColumn: Integer;
 
151
      const {%H-}ASortDirection: TSortDirection); override;
126
152
    class procedure SetViewOrigin(const ALV: TCustomListView; const AValue: TPoint); override;
127
153
    class procedure SetViewStyle(const ALV: TCustomListView; const AValue: TViewStyle); override;
128
154
  end;
139
165
  published
140
166
    class function  CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
141
167
    class procedure ApplyChanges(const AProgressBar: TCustomProgressBar); override;
142
 
    class procedure SetPosition(const AProgressBar: TCustomProgressBar; const NewPosition: integer); override;
 
168
    class procedure SetPosition(const AProgressBar: TCustomProgressBar; const {%H-}NewPosition: integer); override;
143
169
    class procedure SetStyle(const AProgressBar: TCustomProgressBar; const AStyle: TProgressBarStyle); override;
144
170
  end;
145
171
 
165
191
 
166
192
  TCarbonWSToolBar = class(TWSToolBar)
167
193
  published
 
194
    class function  CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
168
195
  end;
169
196
 
170
197
  { TCarbonWSTrackBar }
174
201
    class function  CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
175
202
    class procedure ApplyChanges(const ATrackBar: TCustomTrackBar); override;
176
203
    class function  GetPosition(const ATrackBar: TCustomTrackBar): integer; override;
177
 
    class procedure SetPosition(const ATrackBar: TCustomTrackBar; const NewPosition: integer); override;
 
204
    class procedure SetPosition(const ATrackBar: TCustomTrackBar; const {%H-}NewPosition: integer); override;
178
205
  end;
179
206
 
180
207
  { TCarbonWSCustomTreeView }
193
220
implementation
194
221
 
195
222
uses
196
 
  CarbonProc, CarbonDbgConsts;
 
223
  CarbonProc, CarbonTabs;
 
224
 
 
225
{ TCarbonWSToolBar }
 
226
 
 
227
class function TCarbonWSToolBar.CreateHandle(const AWinControl: TWinControl;
 
228
  const AParams: TCreateParams): TLCLIntfHandle;
 
229
begin
 
230
  Result := TLCLIntfHandle(TCarbonToolBar.Create(AWinControl, AParams));
 
231
  // TCarbonCustomControl(Result).
 
232
end;
197
233
 
198
234
{ TCarbonWSStatusBar }
199
235
 
254
290
  TCarbonStatusBar(AStatusBar.Handle).UpdatePanel;
255
291
end;
256
292
 
 
293
{ TCarbonWSCustomPage }
 
294
 
 
295
{------------------------------------------------------------------------------
 
296
  Method:  TCarbonWSCustomPage.CreateHandle
 
297
  Params:  AWinControl - LCL control
 
298
           AParams     - Creation parameters
 
299
  Returns: Handle to the control in Carbon interface
 
300
 
 
301
  Creates new custom page in Carbon interface with the specified parameters
 
302
 ------------------------------------------------------------------------------}
 
303
class function TCarbonWSCustomPage.CreateHandle(const AWinControl: TWinControl;
 
304
  const AParams: TCreateParams): TLCLIntfHandle;
 
305
begin
 
306
  Result := TLCLIntfHandle(TCarbonTab.Create(AWinControl, AParams));
 
307
end;
 
308
 
 
309
{------------------------------------------------------------------------------
 
310
  Method:  TCarbonWSCustomPage.UpdateProperties
 
311
  Params:  ACustomPage - LCL custom page
 
312
 
 
313
  Update properties of the specified custom page in Carbon interface
 
314
 ------------------------------------------------------------------------------}
 
315
class procedure TCarbonWSCustomPage.UpdateProperties(const ACustomPage: TCustomPage);
 
316
begin
 
317
  if not CheckHandle(ACustomPage, Self, 'UpdateProperties') then Exit;
 
318
 
 
319
  TCarbonTab(ACustomPage.Handle).UpdateTab;
 
320
end;
 
321
 
 
322
{ TCarbonWSCustomNotebook }
 
323
 
 
324
{------------------------------------------------------------------------------
 
325
  Method:  TCarbonWSCustomNotebook.CreateHandle
 
326
  Params:  AWinControl - LCL control
 
327
           AParams     - Creation parameters
 
328
  Returns: Handle to the control in Carbon interface
 
329
 
 
330
  Creates new custom notebook in Carbon interface with the specified parameters
 
331
 ------------------------------------------------------------------------------}
 
332
class function TCarbonWSCustomNotebook.CreateHandle(const AWinControl: TWinControl;
 
333
  const AParams: TCreateParams): TLCLIntfHandle;
 
334
begin
 
335
  if AWinControl is TTabControl then
 
336
  begin
 
337
    Result := TLCLIntfHandle(TCarbonCustomControl.Create(AWinControl, AParams));
 
338
    TCarbonCustomControl(Result).CarbonWidgetFlag := cwdTTabControl;
 
339
  end else
 
340
    Result := TLCLIntfHandle(TCarbonTabsControl.Create(AWinControl, AParams));
 
341
end;
 
342
 
 
343
{------------------------------------------------------------------------------
 
344
  Method:  TCarbonWSCustomNotebook.AddPage
 
345
  Params:  ATabControl - LCL custom notebook
 
346
           AChild    - New tab
 
347
           AIndex    - New tab index
 
348
 
 
349
  Adds tab with the specified index in notebook in Carbon interface
 
350
 ------------------------------------------------------------------------------}
 
351
class procedure TCarbonWSCustomNotebook.AddPage(const ATabControl: TCustomTabControl;
 
352
  const AChild: TCustomPage; const AIndex: integer);
 
353
begin
 
354
  if not CheckHandle(ATabControl, Self, 'AddPage') then Exit;
 
355
  if AChild.HandleAllocated and not CheckHandle(AChild, Self, 'AddPage AChild') then Exit;
 
356
 
 
357
  // create child handle
 
358
  AChild.HandleNeeded;
 
359
  // add page
 
360
  TCarbonTabsControl(ATabControl.Handle).Add(TCarbonTab(AChild.Handle), AIndex);
 
361
  // sync PageIndex with LCL
 
362
  TCarbonTabsControl(ATabControl.Handle).SetPageIndex(ATabControl.PageIndex);
 
363
end;
 
364
 
 
365
{------------------------------------------------------------------------------
 
366
  Method:  TCarbonWSCustomNotebook.MovePage
 
367
  Params:  ATabControl - LCL custom notebook
 
368
           AChild    - Moved tab
 
369
           AIndex    - New tab index
 
370
 
 
371
  Moves tab to the specified index in notebook in Carbon interface
 
372
 ------------------------------------------------------------------------------}
 
373
class procedure TCarbonWSCustomNotebook.MovePage(const ATabControl: TCustomTabControl;
 
374
  const AChild: TCustomPage; const NewIndex: integer);
 
375
begin
 
376
  if not CheckHandle(ATabControl, Self, 'MovePage') then Exit;
 
377
  if not CheckHandle(AChild, Self, 'MovePage AChild') then Exit;
 
378
 
 
379
  TCarbonTabsControl(ATabControl.Handle).Remove(AChild.PageIndex);
 
380
  TCarbonTabsControl(ATabControl.Handle).Add(TCarbonTab(AChild.Handle), NewIndex);
 
381
end;
 
382
 
 
383
{------------------------------------------------------------------------------
 
384
  Method:  TCarbonWSCustomNotebook.RemovePage
 
385
  Params:  ATabControl - LCL custom notebook
 
386
           AIndex    - Removed tab index
 
387
 
 
388
  Removes tab with the specified index from notebook in Carbon interface
 
389
 ------------------------------------------------------------------------------}
 
390
class procedure TCarbonWSCustomNotebook.RemovePage(const ATabControl: TCustomTabControl;
 
391
  const AIndex: integer);
 
392
begin
 
393
  if not CheckHandle(ATabControl, Self, 'RemovePage') then Exit;
 
394
 
 
395
  TCarbonTabsControl(ATabControl.Handle).Remove(AIndex);
 
396
  // sync PageIndex with LCL
 
397
  TCarbonTabsControl(ATabControl.Handle).SetPageIndex(ATabControl.PageIndex);
 
398
end;
 
399
 
 
400
 
 
401
class function TCarbonWSCustomNotebook.GetTabIndexAtPos(const ATabControl: TCustomTabControl; const AClientPos: TPoint): integer;
 
402
var
 
403
  p : TPoint;
 
404
begin
 
405
  if not CheckHandle(ATabControl, Self, 'GetTabIndexAtPos') then Exit;
 
406
  p := AClientPos;
 
407
  inc(p.y, 35); // todo: find out why AClientPos incorrect for TNotebook
 
408
  Result := TCarbonTabsControl(ATabControl.Handle).GetPageIndexAtCursor(p);
 
409
end;
 
410
 
 
411
{------------------------------------------------------------------------------
 
412
  Method:  TCarbonWSCustomNotebook.SetPageIndex
 
413
  Params:  ATabControl - LCL custom notebook
 
414
           AIndex    - New tab index
 
415
 
 
416
  Selects tab with the specified index in notebook in Carbon interface
 
417
 ------------------------------------------------------------------------------}
 
418
class procedure TCarbonWSCustomNotebook.SetPageIndex(const ATabControl: TCustomTabControl;
 
419
  const AIndex: integer);
 
420
begin
 
421
  if not CheckHandle(ATabControl, Self, 'SetPageIndex') then Exit;
 
422
  if (AIndex < 0) or (AIndex > ATabControl.PageCount - 1) then
 
423
    exit;
 
424
  TCarbonTabsControl(ATabControl.Handle).SetPageIndex(AIndex);
 
425
end;
 
426
 
 
427
{------------------------------------------------------------------------------
 
428
  Method:  TCarbonWSCustomNotebook.SetTabPosition
 
429
  Params:  ATabControl    - LCL custom notebook
 
430
           ATabPosition - New position of tabs
 
431
 
 
432
  Changes position of the tabs of notebook in Carbon interface
 
433
 ------------------------------------------------------------------------------}
 
434
class procedure TCarbonWSCustomNotebook.SetTabPosition(const ATabControl: TCustomTabControl;
 
435
  const ATabPosition: TTabPosition);
 
436
begin
 
437
  if not CheckHandle(ATabControl, Self, 'SetTabPosition') then Exit;
 
438
 
 
439
  TCarbonTabsControl(ATabControl.Handle).SetTabPosition(ATabPosition);
 
440
end;
 
441
 
 
442
{------------------------------------------------------------------------------
 
443
  Method:  TCarbonWSCustomNotebook.ShowTabs
 
444
  Params:  ATabControl - LCL custom notebook
 
445
           AShowTabs - Tabs visibility
 
446
 
 
447
  Changes visibility of all tabs of notebook in Carbon interface
 
448
 ------------------------------------------------------------------------------}
 
449
class procedure TCarbonWSCustomNotebook.ShowTabs(const ATabControl: TCustomTabControl;
 
450
  AShowTabs: boolean);
 
451
begin
 
452
  if not CheckHandle(ATabControl, Self, 'ShowTabs') then Exit;
 
453
  if TCarbonControl(ATabControl.Handle).CarbonWidgetFlag <> cwdTTabControl then
 
454
    TCarbonTabsControl(ATabControl.Handle).ShowTabs(AShowTabs);
 
455
end;
 
456
 
257
457
{ TCarbonWSCustomListView }
258
458
 
259
459
{------------------------------------------------------------------------------
316
516
  TCarbonListView(ALV.Handle).GetColumn(AIndex).SetAlignment(AAlignment);
317
517
end;
318
518
 
 
519
class procedure TCarbonWSCustomListView.ColumnSetAutoSize(const ALV: TCustomListView;
 
520
  const AIndex: Integer; const AColumn: TListColumn; const AAutoSize: Boolean);
 
521
begin
 
522
  if not CheckHandle(ALV, Self, 'ColumnSetAutoSize') then Exit;
 
523
 
 
524
  TCarbonListView(ALV.Handle).GetColumn(AIndex).SetAutoSize(AAutoSize);
 
525
  TCarbonListView(ALV.Handle).AutoSizeColumns;
 
526
end;
 
527
 
319
528
class procedure TCarbonWSCustomListView.ColumnSetCaption(const ALV: TCustomListView;
320
529
  const AIndex: Integer; const AColumn: TListColumn; const ACaption: String);
321
530
begin
356
565
  if not CheckHandle(ALV, Self, 'ColumnSetWidth') then Exit;
357
566
 
358
567
  Column := TCarbonListView(ALV.Handle).GetColumn(AIndex);
359
 
  if Column <> nil then Column.SetWidth(AWidth, AColumn.AutoSize); // Avoids crash
 
568
  if Column <> nil then Column.SetWidth(AWidth); // Avoids crash
 
569
  TCarbonListView(ALV.Handle).AutoSizeColumns;
360
570
end;
361
571
 
362
572
class procedure TCarbonWSCustomListView.ColumnSetVisible(const ALV: TCustomListView;
462
672
 
463
673
class function TCarbonWSCustomListView.GetBoundingRect(const ALV: TCustomListView): TRect;
464
674
begin
 
675
  Result := Rect(0, 0, 0, 0);
465
676
  if not CheckHandle(ALV, Self, 'GetBoundingRect') then Exit;
466
677
 
467
678
  Result := TCarbonListView(ALV.Handle).GetItemsRect;
494
705
 
495
706
class function TCarbonWSCustomListView.GetTopItem(const ALV: TCustomListView): Integer;
496
707
begin
497
 
  Result := 0;
 
708
  Result := -1;
498
709
  if not CheckHandle(ALV, Self, 'GetTopItem') then Exit;
499
710
 
500
711
  Result := TCarbonListView(ALV.Handle).GetTopItem;
502
713
 
503
714
class function TCarbonWSCustomListView.GetViewOrigin(const ALV: TCustomListView): TPoint;
504
715
begin
 
716
  Result := Point(0, 0);
505
717
  if not CheckHandle(ALV, Self, 'GetViewOrigin') then Exit;
506
718
 
507
719
  Result := TCarbonListView(ALV.Handle).GetViewOrigin;
563
775
    lvpMultiSelect: TCarbonListView(ALV.Handle).SetSelectionMode(AIsSet, AIsSet);
564
776
    lvpOwnerDraw: TCarbonListView(ALV.Handle).SetOwnerDraw(AIsSet);
565
777
  //lvpReadOnly
566
 
    lvpRowSelect: TCarbonListView(ALV.Handle).SetRowSelect(AIsSet);
567
 
    lvpShowColumnHeaders: TCarbonListView(ALV.Handle).ShowColumnHeaders(AIsSet);
 
778
    lvpRowSelect: TCarbonListView(ALV.Handle).SetRowSelect((TListView(ALV).ViewStyle <> vsReport) or AIsSet);
 
779
    lvpShowColumnHeaders: TCarbonListView(ALV.Handle).ShowColumnHeaders((TListView(ALV).ViewStyle = vsReport) and AIsSet);
568
780
  //lvpShowWorkAreas
569
781
  //lvpWrapText
570
782
  //lvpToolTips
590
802
  TCarbonListView(ALV.Handle).SetScrollBars(AValue);
591
803
end;
592
804
 
593
 
class procedure TCarbonWSCustomListView.SetSort(const ALV: TCustomListView; const AType: TSortType;
594
 
  const AColumn: Integer);
 
805
class procedure TCarbonWSCustomListView.SetSort(const ALV: TCustomListView;
 
806
  const AType: TSortType; const AColumn: Integer;
 
807
  const ASortDirection: TSortDirection);
595
808
begin
596
809
  if not CheckHandle(ALV, Self, 'SetSort') then Exit;
597
810
  TCarbonListView(ALV.Handle).UpdateItems;