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

« back to all changes in this revision

Viewing changes to lcl/include/controlscrollbar.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:
33
33
  OldPosition, MaxPos: Integer;
34
34
  ScrollInfo: TScrollInfo;
35
35
begin
 
36
  if csLoading in FControl.ComponentState then
 
37
  begin
 
38
    FPosition := Value;
 
39
    Exit;
 
40
  end;
 
41
 
36
42
  if Value < 0 then
37
43
  begin
38
44
    SetPosition(0);
127
133
  begin
128
134
    ScrollInfo.fMask := SIF_POS;
129
135
    GetScrollInfo(ControlHandle, IntfBarKind[Kind], ScrollInfo);
130
 
    if FPosition<>ScrollInfo.nPos then
 
136
    if FPosition <> ScrollInfo.nPos then
131
137
    begin
132
138
      FPosition := ScrollInfo.nPos;
133
139
      InvalidateScrollInfo;
146
152
    ScrollInfo.fMask := SIF_Range + SIF_Page;
147
153
    GetScrollInfo(ControlHandle, IntfBarKind[Kind], ScrollInfo);
148
154
    NewRange := ScrollInfo.nMax - ScrollInfo.nMin;
149
 
    if NewRange<>FRange then
 
155
    if NewRange <> FRange then
150
156
    begin
151
 
      FRange:=NewRange;
 
157
      FRange := NewRange;
152
158
      InvalidateScrollInfo;
153
159
    end;
154
160
  end;
190
196
procedure TControlScrollBar.SetRange(const AValue: Integer);
191
197
begin
192
198
  if not (csLoading in FControl.ComponentState) then
193
 
    SetAutoScroll(False);
 
199
    if FControl is TScrollingWinControl then
 
200
      TScrollingWinControl(FControl).FAutoScroll := False;
194
201
 
195
202
  InternalSetRange(AValue);
196
203
end;
197
204
 
198
 
procedure TControlScrollBar.SetSize(const AValue: integer);
199
 
begin
200
 
  raise EScrollBar.Create('[TControlScrollBar.SetSize] Size is readonly');
201
 
end;
202
 
 
203
205
procedure TControlScrollBar.SetVisible(const AValue: Boolean);
204
206
begin
205
207
  if FVisible = AValue then
377
379
  SetPosition(NewPos);
378
380
end;
379
381
 
380
 
procedure TControlScrollBar.SetAutoScroll(const AValue: Boolean);
381
 
begin
382
 
  if FControl is TScrollingWinControl then
383
 
    TScrollingWinControl(FControl).FAutoScroll := False;
384
 
end;
385
 
 
386
382
procedure TControlScrollBar.ControlUpdateScrollBars;
387
383
begin
388
384
  if ([csLoading, csDestroying] * FControl.ComponentState <> []) then
405
401
  FRange := AValue;
406
402
  {$IFDEF VerboseScrollingWinControl}
407
403
  //if DebugCondition then
408
 
    DebugLn(['TControlScrollBar.SetRange ',dbgs(Kind),' ',Self,' fRange=',FRange]);
 
404
    DebugLn(['TControlScrollBar.SetRange ',dbgs(Kind),' ',Self,' FRange=',FRange]);
409
405
  {$ENDIF}
410
406
  ControlUpdateScrollBars;
411
407
end;
443
439
constructor TControlScrollBar.Create(AControl: TWinControl;
444
440
  AKind: TScrollBarKind);
445
441
begin
446
 
  Inherited Create;
 
442
  inherited Create;
447
443
  FControl := AControl;
448
444
  FKind := AKind;
449
445
  FPage := 80;
475
471
 
476
472
function TControlScrollBar.IsScrollBarVisible: Boolean;
477
473
begin
478
 
  Result:=FVisible;
 
474
  Result := FVisible;
479
475
  if HandleAllocated then
480
476
    Result := GetScrollbarVisible(ControlHandle, IntfBarKind[Kind]);
481
477
end;
499
495
function TControlScrollBar.ClientSize: integer;
500
496
begin
501
497
  if Kind = sbVertical then
502
 
    Result:=FControl.ClientWidth
 
498
    Result := FControl.ClientWidth
503
499
  else
504
 
    Result:=FControl.ClientHeight;
 
500
    Result := FControl.ClientHeight;
505
501
end;
506
502
 
507
503
function TControlScrollBar.ClientSizeWithBar: integer;
508
504
begin
509
 
  Result:=ClientSize;
 
505
  Result := ClientSize;
510
506
  if not IsScrollBarVisible then
511
 
    dec(Result,GetSize);
 
507
    dec(Result, GetSize);
512
508
end;
513
509
 
514
510
function TControlScrollBar.ClientSizeWithoutBar: integer;
515
511
begin
516
512
  Result:=ClientSize;
517
513
  if IsScrollBarVisible then
518
 
    inc(Result,GetSize);
 
514
    inc(Result, GetSize);
519
515
end;
520
516
 
521
517
function TControlScrollBar.GetHorzScrollBar: TControlScrollBar;
523
519
  if FControl is TScrollingWinControl then
524
520
    Result := TScrollingWinControl(FControl).HorzScrollBar
525
521
  else
526
 
    Result:=nil;
 
522
    Result := nil;
527
523
end;
528
524
 
529
525
function TControlScrollBar.GetVertScrollBar: TControlScrollBar;
531
527
  if FControl is TScrollingWinControl then
532
528
    Result := TScrollingWinControl(FControl).VertScrollBar
533
529
  else
534
 
    Result:=nil;
 
530
    Result := nil;
535
531
end;
536
532
 
537
533
function TControlScrollBar.ScrollBarShouldBeVisible: Boolean;
538
534
begin
539
 
  Result:=FVisible and (FRange>FPage);
 
535
  Result := FVisible and (FRange > FPage);
540
536
end;
541
537
 
542
538
// included by forms.pp