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

« back to all changes in this revision

Viewing changes to lcl/interfaces/carbon/carbonwsextctrls.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: carbonwsextctrls.pp 26295 2010-06-27 14:29:29Z dmitry $}
2
1
{
3
2
 *****************************************************************************
4
3
 *                              CarbonWSExtCtrls.pp                          *
37
36
  appkit, foundation, lobjc,
38
37
  {$endif CarbonUseCocoa}
39
38
  // LCL
40
 
  Classes, Controls, ExtCtrls, LCLType, LCLProc, Graphics, Math, SysUtils,
 
39
  Classes, Controls, ExtCtrls, LCLType, LCLProc, Graphics, SysUtils,
41
40
  Menus,
42
41
  // widgetset
43
 
  WSExtCtrls, WSLCLClasses, WSControls, WSProc,
 
42
  WSExtCtrls, WSLCLClasses,
44
43
  // LCL Carbon
45
 
  carbongdiobjects, CarbonWSControls;
 
44
  carbongdiobjects;
46
45
 
47
46
type
48
47
 
49
 
  { TCarbonWSCustomPage }
50
 
 
51
 
  TCarbonWSCustomPage = class(TWSCustomPage)
52
 
  published
53
 
    class function  CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
54
 
    class procedure UpdateProperties(const ACustomPage: TCustomPage); override;
55
 
  end;
56
 
 
57
 
  { TCarbonWSCustomNotebook }
58
 
 
59
 
  TCarbonWSCustomNotebook = class(TWSCustomNotebook)
60
 
  published
61
 
    class function  CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
62
 
 
63
 
    class procedure AddPage(const ANotebook: TCustomNotebook; const AChild: TCustomPage; const AIndex: integer); override;
64
 
    class procedure MovePage(const ANotebook: TCustomNotebook; const AChild: TCustomPage; const NewIndex: integer); override;
65
 
    class procedure RemovePage(const ANotebook: TCustomNotebook; const AIndex: integer); override;
66
 
 
67
 
    //class function GetNotebookMinTabHeight(const AWinControl: TWinControl): integer; override;
68
 
    //class function GetNotebookMinTabWidth(const AWinControl: TWinControl): integer; override;
69
 
    //class function GetPageRealIndex(const ANotebook: TCustomNotebook; AIndex: Integer): Integer; override;
70
 
    class function GetTabIndexAtPos(const ANotebook: TCustomNotebook; const AClientPos: TPoint): integer; override;
71
 
    class procedure SetPageIndex(const ANotebook: TCustomNotebook; const AIndex: integer); override;
72
 
    class procedure SetTabPosition(const ANotebook: TCustomNotebook; const ATabPosition: TTabPosition); override;
73
 
    class procedure ShowTabs(const ANotebook: TCustomNotebook; AShowTabs: boolean); override;
74
 
  end;
75
 
 
76
48
  { TCarbonWSPage }
77
49
 
78
50
  TCarbonWSPage = class(TWSPage)
167
139
 
168
140
  TCarbonWSCustomPanel = class(TWSCustomPanel)
169
141
  published
170
 
    class procedure GetPreferredSize(const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); override;
 
142
    class procedure GetPreferredSize(const {%H-}AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer; {%H-}WithThemeSpace: Boolean); override;
171
143
  end;
172
144
 
173
145
  { TCarbonWSPanel }
184
156
    class function Hide(const ATrayIcon: TCustomTrayIcon): Boolean; override;
185
157
    class function Show(const ATrayIcon: TCustomTrayIcon): Boolean; override;
186
158
    class procedure InternalUpdate(const ATrayIcon: TCustomTrayIcon); override;
187
 
    class function ShowBalloonHint(const ATrayIcon: TCustomTrayIcon): Boolean; override;
188
 
    class function GetPosition(const ATrayIcon: TCustomTrayIcon): TPoint; override;
 
159
    class function ShowBalloonHint(const {%H-}ATrayIcon: TCustomTrayIcon): Boolean; override;
 
160
    class function GetPosition(const {%H-}ATrayIcon: TCustomTrayIcon): TPoint; override;
189
161
    class function IsTrayIconMenuVisible(const ATrayIcon: TCustomTrayIcon): Boolean;
190
162
    {$endif CarbonUseCocoa}
191
163
  end;
193
165
implementation
194
166
 
195
167
uses
196
 
  CarbonProc, CarbonDef, CarbonTabs, CarbonCanvas;
197
 
 
198
 
{ TCarbonWSCustomPage }
199
 
 
200
 
{------------------------------------------------------------------------------
201
 
  Method:  TCarbonWSCustomPage.CreateHandle
202
 
  Params:  AWinControl - LCL control
203
 
           AParams     - Creation parameters
204
 
  Returns: Handle to the control in Carbon interface
205
 
 
206
 
  Creates new custom page in Carbon interface with the specified parameters
207
 
 ------------------------------------------------------------------------------}
208
 
class function TCarbonWSCustomPage.CreateHandle(const AWinControl: TWinControl;
209
 
  const AParams: TCreateParams): TLCLIntfHandle;
210
 
begin
211
 
  Result := TLCLIntfHandle(TCarbonTab.Create(AWinControl, AParams));
212
 
end;
213
 
 
214
 
{------------------------------------------------------------------------------
215
 
  Method:  TCarbonWSCustomPage.UpdateProperties
216
 
  Params:  ACustomPage - LCL custom page
217
 
 
218
 
  Update properties of the specified custom page in Carbon interface
219
 
 ------------------------------------------------------------------------------}
220
 
class procedure TCarbonWSCustomPage.UpdateProperties(const ACustomPage: TCustomPage);
221
 
begin
222
 
  if not CheckHandle(ACustomPage, Self, 'UpdateProperties') then Exit;
223
 
  
224
 
  TCarbonTab(ACustomPage.Handle).UpdateTab;
225
 
end;
226
 
 
227
 
{ TCarbonWSCustomNotebook }
228
 
 
229
 
{------------------------------------------------------------------------------
230
 
  Method:  TCarbonWSCustomNotebook.CreateHandle
231
 
  Params:  AWinControl - LCL control
232
 
           AParams     - Creation parameters
233
 
  Returns: Handle to the control in Carbon interface
234
 
 
235
 
  Creates new custom notebook in Carbon interface with the specified parameters
236
 
 ------------------------------------------------------------------------------}
237
 
class function TCarbonWSCustomNotebook.CreateHandle(const AWinControl: TWinControl;
238
 
  const AParams: TCreateParams): TLCLIntfHandle;
239
 
begin
240
 
  Result := TLCLIntfHandle(TCarbonTabsControl.Create(AWinControl, AParams));
241
 
end;
242
 
 
243
 
{------------------------------------------------------------------------------
244
 
  Method:  TCarbonWSCustomNotebook.AddPage
245
 
  Params:  ANotebook - LCL custom notebook
246
 
           AChild    - New tab
247
 
           AIndex    - New tab index
248
 
 
249
 
  Adds tab with the specified index in notebook in Carbon interface
250
 
 ------------------------------------------------------------------------------}
251
 
class procedure TCarbonWSCustomNotebook.AddPage(const ANotebook: TCustomNotebook;
252
 
  const AChild: TCustomPage; const AIndex: integer);
253
 
begin
254
 
  if not CheckHandle(ANotebook, Self, 'AddPage') then Exit;
255
 
  if AChild.HandleAllocated and not CheckHandle(AChild, Self, 'AddPage AChild') then Exit;
256
 
  
257
 
  // create child handle
258
 
  AChild.HandleNeeded;
259
 
  // add page
260
 
  TCarbonTabsControl(ANotebook.Handle).Add(TCarbonTab(AChild.Handle), AIndex);
261
 
  // sync PageIndex with LCL
262
 
  TCarbonTabsControl(ANotebook.Handle).SetPageIndex(ANotebook.PageIndex);
263
 
end;
264
 
 
265
 
{------------------------------------------------------------------------------
266
 
  Method:  TCarbonWSCustomNotebook.MovePage
267
 
  Params:  ANotebook - LCL custom notebook
268
 
           AChild    - Moved tab
269
 
           AIndex    - New tab index
270
 
 
271
 
  Moves tab to the specified index in notebook in Carbon interface
272
 
 ------------------------------------------------------------------------------}
273
 
class procedure TCarbonWSCustomNotebook.MovePage(const ANotebook: TCustomNotebook;
274
 
  const AChild: TCustomPage; const NewIndex: integer);
275
 
begin
276
 
  if not CheckHandle(ANotebook, Self, 'MovePage') then Exit;
277
 
  if not CheckHandle(AChild, Self, 'MovePage AChild') then Exit;
278
 
 
279
 
  TCarbonTabsControl(ANotebook.Handle).Remove(AChild.PageIndex);
280
 
  TCarbonTabsControl(ANotebook.Handle).Add(TCarbonTab(AChild.Handle), NewIndex);
281
 
end;
282
 
 
283
 
{------------------------------------------------------------------------------
284
 
  Method:  TCarbonWSCustomNotebook.RemovePage
285
 
  Params:  ANotebook - LCL custom notebook
286
 
           AIndex    - Removed tab index
287
 
 
288
 
  Removes tab with the specified index from notebook in Carbon interface
289
 
 ------------------------------------------------------------------------------}
290
 
class procedure TCarbonWSCustomNotebook.RemovePage(const ANotebook: TCustomNotebook;
291
 
  const AIndex: integer);
292
 
begin
293
 
  if not CheckHandle(ANotebook, Self, 'RemovePage') then Exit;
294
 
  
295
 
  TCarbonTabsControl(ANotebook.Handle).Remove(AIndex);
296
 
  // sync PageIndex with LCL
297
 
  TCarbonTabsControl(ANotebook.Handle).SetPageIndex(ANotebook.PageIndex);
298
 
end;
299
 
 
300
 
 
301
 
class function TCarbonWSCustomNotebook.GetTabIndexAtPos(const ANotebook: TCustomNotebook; const AClientPos: TPoint): integer;
302
 
var
303
 
  p : TPoint;
304
 
begin
305
 
  if not CheckHandle(ANotebook, Self, 'GetTabIndexAtPos') then Exit;
306
 
  p := AClientPos;
307
 
  inc(p.y, 35); // todo: find out why AClientPos incorrect for TNotebook
308
 
  Result := TCarbonTabsControl(ANotebook.Handle).GetPageIndexAtCursor(p);
309
 
end;
310
 
 
311
 
{------------------------------------------------------------------------------
312
 
  Method:  TCarbonWSCustomNotebook.SetPageIndex
313
 
  Params:  ANotebook - LCL custom notebook
314
 
           AIndex    - New tab index
315
 
 
316
 
  Selects tab with the specified index in notebook in Carbon interface
317
 
 ------------------------------------------------------------------------------}
318
 
class procedure TCarbonWSCustomNotebook.SetPageIndex(const ANotebook: TCustomNotebook;
319
 
  const AIndex: integer);
320
 
begin
321
 
  if not CheckHandle(ANotebook, Self, 'SetPageIndex') then Exit;
322
 
 
323
 
  TCarbonTabsControl(ANotebook.Handle).SetPageIndex(AIndex);
324
 
end;
325
 
 
326
 
{------------------------------------------------------------------------------
327
 
  Method:  TCarbonWSCustomNotebook.SetTabPosition
328
 
  Params:  ANotebook    - LCL custom notebook
329
 
           ATabPosition - New position of tabs
330
 
 
331
 
  Changes position of the tabs of notebook in Carbon interface
332
 
 ------------------------------------------------------------------------------}
333
 
class procedure TCarbonWSCustomNotebook.SetTabPosition(const ANotebook: TCustomNotebook;
334
 
  const ATabPosition: TTabPosition);
335
 
begin
336
 
  if not CheckHandle(ANotebook, Self, 'SetTabPosition') then Exit;
337
 
  
338
 
  TCarbonTabsControl(ANotebook.Handle).SetTabPosition(ATabPosition);
339
 
end;
340
 
 
341
 
{------------------------------------------------------------------------------
342
 
  Method:  TCarbonWSCustomNotebook.ShowTabs
343
 
  Params:  ANotebook - LCL custom notebook
344
 
           AShowTabs - Tabs visibility
345
 
 
346
 
  Changes visibility of all tabs of notebook in Carbon interface
347
 
 ------------------------------------------------------------------------------}
348
 
class procedure TCarbonWSCustomNotebook.ShowTabs(const ANotebook: TCustomNotebook;
349
 
  AShowTabs: boolean);
350
 
begin
351
 
  if not CheckHandle(ANotebook, Self, 'ShowTabs') then Exit;
352
 
 
353
 
  TCarbonTabsControl(ANotebook.Handle).ShowTabs(AShowTabs);
354
 
end;
 
168
  CarbonProc;
355
169
 
356
170
{ TCarbonWSCustomPanel }
357
171