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

« back to all changes in this revision

Viewing changes to lcl/interfaces/carbon/carbonwsforms.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: carbonwsforms.pp 27247 2010-09-01 20:11:57Z dmitry $}
2
1
{
3
2
 *****************************************************************************
4
3
 *                             CarbonWSForms.pp                              *
32
31
uses
33
32
  // Libs
34
33
  MacOSAll,
35
 
  CarbonUtils,
36
34
  // LCL
37
 
  Controls, Forms, Graphics, LCLType, LMessages, LCLProc, Classes,
 
35
  Controls, Forms, Graphics, LCLType, LCLProc, Classes,
38
36
  // Widgetset
39
 
  WSForms, WSLCLClasses, WSProc,
 
37
  WSForms, WSLCLClasses,
40
38
  // LCL Carbon
41
 
  CarbonDef, CarbonPrivate, CarbonWSControls;
 
39
  CarbonDef, CarbonPrivate;
42
40
 
43
41
type
44
42
 
83
81
    class procedure SetFormBorderStyle(const AForm: TCustomForm; const AFormBorderStyle: TFormBorderStyle); override;
84
82
 
85
83
    class procedure SetAlphaBlend(const ACustomForm: TCustomForm; const AlphaBlend: Boolean; const Alpha: Byte); override;
86
 
    class procedure SetFormStyle(const ACustomForm: TCustomForm; const ANewFormStyle, AOldFormStyle: TFormStyle); override;
 
84
    class procedure SetFormStyle(const ACustomForm: TCustomForm; const ANewFormStyle, {%H-}AOldFormStyle: TFormStyle); override;
87
85
 
88
86
    class procedure SetPopupParent(const ACustomForm: TCustomForm;
89
 
      const APopupMode: TPopupMode; const APopupParent: TCustomForm); override;
 
87
      const {%H-}APopupMode: TPopupMode; const APopupParent: TCustomForm); override;
90
88
  end;
91
89
 
92
90
  { TCarbonWSForm }
208
206
class procedure TCarbonWSCustomForm.ShowHide(const AWinControl: TWinControl);
209
207
var
210
208
  nCmdShow : Integer;
 
209
  ModalForm: TCustomForm;
 
210
  ACurrentWindowClass: WindowClass;
 
211
  function HaveModalForms: Boolean;
 
212
  var
 
213
    i: Integer;
 
214
    AForm: TCustomForm;
 
215
  begin
 
216
    Result := False;
 
217
    for i := 0 to Screen.CustomFormZOrderCount - 1 do
 
218
    begin
 
219
      AForm := Screen.CustomFormsZOrdered[i];
 
220
      Result := AForm.Visible and AForm.HandleAllocated and (fsModal in AForm.FormState);
 
221
      if Result then
 
222
      begin
 
223
        ModalForm := AForm;
 
224
        break;
 
225
      end;
 
226
    end;
 
227
  end;
 
228
 
 
229
  function ShowNonModalOverModal(const AShowSheet: Boolean): Boolean;
 
230
  var
 
231
    AForm: TCustomForm;
 
232
  begin
 
233
    Result := False;
 
234
    AForm := TCustomForm(AWinControl);
 
235
    ModalForm := nil;
 
236
    if AWinControl.HandleObjectShouldBeVisible and
 
237
      not (csDesigning in AForm.ComponentState) and
 
238
      not (fsModal in AForm.FormState) and
 
239
      (AForm.FormStyle <> fsMDIChild) and
 
240
      not (AForm.FormStyle in fsAllStayOnTop) and
 
241
      HaveModalForms and
 
242
      (AForm.BorderStyle in [bsDialog, bsSingle, bsSizeable]) and
 
243
      (AForm.Parent = nil) and
 
244
      (AForm.PopupParent = nil) and (AForm.PopupMode = pmNone) then
 
245
    begin
 
246
      if AShowSheet then
 
247
      begin
 
248
        TCarbonWindow(ModalForm.Handle).SheetWin := TCarbonWindow(AForm.Handle).Window;
 
249
        OSError(ShowSheetWindow(TCarbonWindow(AForm.Handle).Window, TCarbonWindow(ModalForm.Handle).Window),
 
250
          Self,'ShowHide','ShowSheetWindow');
 
251
      end;
 
252
 
 
253
      Result := True;
 
254
    end;
 
255
  end;
211
256
begin
212
257
  if not CheckHandle(AWinControl, Self, 'ShowHide') then Exit;
213
258
 
 
259
  OSError(GetWindowClass(TCarbonWindow(AWinControl.Handle).Window, ACurrentWindowClass{%H-}),
 
260
    Self,'ShowHide','GetWindowClass');
 
261
 
214
262
  if AWinControl.HandleObjectShouldBeVisible then
215
263
  begin
216
264
    case TCustomForm(AWinControl).WindowState of
 
265
      wsFullScreen: nCmdShow := SW_SHOWFULLSCREEN;
217
266
      wsMaximized: nCmdShow := SW_SHOWMAXIMIZED;
218
267
      wsMinimized: nCmdShow := SW_SHOWMINIMIZED;
219
268
    else
220
269
      nCmdShow := SW_SHOW;
221
270
    end;
 
271
    if (ACurrentWindowClass <> kSheetWindowClass) and ShowNonModalOverModal(False) then
 
272
    begin
 
273
      CREATESHEETWINDOW := PtrUInt(AWinControl);
 
274
      RecreateWnd(AWinControl);
 
275
      exit;
 
276
    end;
 
277
    if (ACurrentWindowClass = kSheetWindowClass) and
 
278
      not ShowNonModalOverModal(False) then
 
279
    begin
 
280
      RecreateWnd(AWinControl);
 
281
      exit;
 
282
    end;
 
283
 
 
284
    if (ACurrentWindowClass = kSheetWindowClass) then
 
285
      ShowNonModalOverModal(True);
 
286
 
222
287
    TCarbonWindow(AWinControl.Handle).ShowHide(True);
223
288
    TCarbonWindow(AWinControl.Handle).Show(nCmdShow);
224
 
  end
225
 
  else
 
289
  end else
 
290
  begin
 
291
    if not (csDesigning in AWinControl.ComponentState) then
 
292
    begin
 
293
      if TCarbonWindow(AWinControl.Handle).SheetWin <> nil then
 
294
      begin
 
295
        HideSheetWindow(TCarbonWindow(AWinControl.Handle).SheetWin);
 
296
        TCarbonWindow(AWinControl.Handle).SheetWin := nil;
 
297
      end else
 
298
      if (ACurrentWindowClass = kSheetWindowClass) then
 
299
        HideSheetWindow(TCarbonWindow(AWinControl.Handle).Window);
 
300
    end;
226
301
    TCarbonWindow(AWinControl.Handle).ShowHide(False);
 
302
  end;
227
303
end;
228
304
 
229
305
{------------------------------------------------------------------------------