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

« back to all changes in this revision

Viewing changes to lcl/interfaces/fpgui/fpguiobject.inc

  • 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:
84
84
  inherited Destroy;
85
85
end;
86
86
 
 
87
function TFpGuiWidgetSet.DrawFrameControl(DC: HDC; const Rect: TRect; uType,
 
88
  uState: Cardinal): Boolean;
 
89
var
 
90
  ADC: TFPGUIDeviceContext absolute DC;
 
91
  ControlType: Cardinal;
 
92
  ControlStyle: Cardinal;
 
93
  fpgRect: TfpgRect;
 
94
  Style: TfpgButtonFlags;
 
95
  (*
 
96
  DFC_CAPTION = $01;
 
97
  DFC_MENU = $02;
 
98
  DFC_SCROLL = $03;
 
99
  DFC_BUTTON =  $04;
 
100
  DFCS_BUTTONCHECK = 0;
 
101
  DFCS_BUTTONRADIOIMAGE = 1;
 
102
  DFCS_BUTTONRADIOMASK = 2;
 
103
  DFCS_BUTTONRADIO = 4;
 
104
  DFCS_BUTTON3STATE = 8;
 
105
  DFCS_BUTTONPUSH = 16;
 
106
  *)
 
107
const
 
108
  DFCS_ALLSTATES=DFCS_BUTTONCHECK or DFCS_BUTTONRADIOIMAGE or DFCS_BUTTONRADIOMASK
 
109
                or DFCS_BUTTONRADIO or DFCS_BUTTON3STATE or DFCS_BUTTONPUSH;
 
110
begin
 
111
  Result:=false;
 
112
  if Assigned(ADC.fpgCanvas) then begin
 
113
    ControlType:=uType;
 
114
    ControlStyle:=uState and DFCS_ALLSTATES;
 
115
    TRectTofpgRect(Rect,fpgRect);
 
116
    AdjustRectToOrg(fpgRect,ADC.FOrg);
 
117
    Case ControlType of
 
118
      DFC_BUTTON:
 
119
        begin
 
120
          if (ControlStyle and DFCS_BUTTONPUSH)=DFCS_BUTTONPUSH then begin
 
121
            Style:=[];
 
122
            if (uState and DFCS_INACTIVE) <> 0 then
 
123
              Style:=Style+[btfIsEmbedded] //Disabled ?
 
124
            else
 
125
            if (uState and DFCS_PUSHED) <> 0 then
 
126
              Style:=Style+[btfIsPressed]
 
127
            else
 
128
            if (uState and DFCS_HOT) <> 0 then
 
129
              Style:=Style+[btfHover];
 
130
            ADC.fpgCanvas.DrawButtonFace(fpgRect,Style);
 
131
            Result:=true;
 
132
          end;
 
133
        end;
 
134
      else
 
135
        Result:=false;
 
136
    end;
 
137
  end;
 
138
end;
 
139
 
87
140
{------------------------------------------------------------------------------
88
141
  Method: TFpGuiWidgetSet.CreateTimer
89
142
  Params:  None
245
298
//  Include(AComponent.ComponentState, csDesigning);
246
299
end;
247
300
 
 
301
function TFpGuiWidgetSet.RawImage_CreateBitmaps(const ARawImage: TRawImage; out
 
302
  ABitmap, AMask: HBitmap; ASkipMask: Boolean): Boolean;
 
303
var
 
304
  OutBitmap: TFPGUIWinAPIBitmap;
 
305
  fpgBitmap: TfpgImage;
 
306
  ImgData: Pointer absolute ARawImage.Data;
 
307
  ImgMask: Pointer absolute ARawImage.Mask;
 
308
  ImgWidth: Cardinal absolute ARawImage.Description.Width;
 
309
  ImgHeight: Cardinal absolute ARawImage.Description.Height;
 
310
  ImgDepth: Byte absolute ARawImage.Description.Depth;
 
311
  ImgDataSize: PtrUInt absolute ARawImage.DataSize;
 
312
  function min(const a,b: SizeInt): SizeInt;
 
313
  begin
 
314
    if a>b then Result:=b else Result:=a;
 
315
  end;
 
316
begin
 
317
  ABitmap:=0;
 
318
  AMask:=0;
 
319
  Result:=false;
 
320
  OutBitmap:=TFPGUIWinAPIBitmap.Create(ARawImage.Description.BitsPerPixel,ARawImage.Description.Width,ARawImage.Description.Height);
 
321
  fpgBitmap:=OutBitmap.Image;
 
322
  ABitmap:=HBITMAP(OutBitmap);
 
323
  move(ARawImage.Data^,pbyte(fpgBitmap.ImageData)^,min(ARawImage.DataSize,fpgBitmap.ImageDataSize));
 
324
  fpgBitmap.UpdateImage;
 
325
  Result:=true;
 
326
end;
 
327
 
 
328
function TFpGuiWidgetSet.RawImage_DescriptionFromDevice(ADC: HDC; out
 
329
  ADesc: TRawImageDescription): Boolean;
 
330
var
 
331
  DC: TFPGUIDeviceContext;
 
332
  r: TfpgRect;
 
333
begin
 
334
  DC:=TFPGUIDeviceContext(ADC);
 
335
  ADesc.Init;
 
336
  with ADesc do begin
 
337
    Format:=      ricfRGBA;
 
338
    if Assigned(DC) and Assigned(DC.fpgCanvas) then begin
 
339
      dc.fpgCanvas.GetWinRect(r);
 
340
      Width:=     r.Width;
 
341
      Height:=    r.Height;
 
342
    end else begin
 
343
      Width:=     0;
 
344
      Height:=    0;
 
345
    end;
 
346
    Depth:=       24; // used bits per pixel
 
347
    BitOrder:=    riboBitsInOrder;
 
348
    ByteOrder:=   riboMSBFirst;
 
349
    LineOrder:=   riloTopToBottom;
 
350
    LineEnd:=     rileByteBoundary;
 
351
    BitsPerPixel:=32; // bits per pixel. can be greater than Depth.
 
352
    RedPrec:=     8;      // red or gray precision. bits for red
 
353
    RedShift:=    8;     // bitshift. Direction: from least to most significant
 
354
    GreenPrec:=   8;
 
355
    GreenShift:=  16;
 
356
    BluePrec:=    8;
 
357
    BlueShift:=   24;
 
358
    AlphaPrec:=   0;
 
359
    AlphaShift:=  0;
 
360
  end;
 
361
  Result:=true;
 
362
end;
 
363
 
248
364
{------------------------------------------------------------------------------
249
365
  Function: TFpGuiWidgetSet.IsValidDC
250
366
  Params:   DC     -  handle to a device context (TFpGuiDeviceContext)