~ubuntu-branches/ubuntu/vivid/lazarus/vivid-proposed

« back to all changes in this revision

Viewing changes to lcl/include/customlistview.inc

  • Committer: Package Import Robot
  • Author(s): Abou Al Montacir
  • Date: 2014-07-14 20:16:50 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20140714201650-ossm36rrsdomp379
Tags: 1.2.4+dfsg-1
* New upstream release with few fixes and official support of FPC 2.6.4.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/Lazarus_1.2_fixes_branch#Fixes_for_1.2.4_.28Merged.29

Show diffs side-by-side

added added

removed removed

Lines of Context:
1214
1214
  function GetItemStatesInternal(AItem: TListItem): TListItemStates;
1215
1215
  begin
1216
1216
    Result := [];
1217
 
    if AItem.GetState(Ord(lisCut)) then
1218
 
      ;
1219
 
    if AItem.GetState(Ord(lisDropTarget)) then
1220
 
      ;
1221
 
    if AItem.GetState(Ord(lisSelected)) then
1222
 
      ;
1223
 
    if AItem.GetState(Ord(lisFocused)) then
1224
 
      ;
 
1217
    if AItem.GetState(Ord(lisCut)) then ;
 
1218
    if AItem.GetState(Ord(lisDropTarget)) then ;
 
1219
    if AItem.GetState(Ord(lisSelected)) then ;
 
1220
    if AItem.GetState(Ord(lisFocused)) then ;
1225
1221
    Result := AItem.FStates;
1226
1222
  end;
1227
1223
 
1232
1228
    AIndex := StartItem.Index;
1233
1229
    ACount := Items.Count;
1234
1230
    case Direction of
1235
 
      sdAbove: if (AIndex -1) >= 0 then Result := Items[AIndex - 1];
1236
 
      sdBelow: if (Aindex + 1) < ACount then Result := Items[AIndex + 1];
 
1231
      sdAbove:
 
1232
        while AIndex>0 do
 
1233
        begin
 
1234
          dec(AIndex);
 
1235
          if States <= GetItemStatesInternal(Items[AIndex]) then
 
1236
          begin
 
1237
            Result := Items[AIndex];
 
1238
            exit;
 
1239
         end;
 
1240
        end;
 
1241
      sdBelow:
 
1242
        while AIndex < ACount-1 do
 
1243
        begin
 
1244
          inc(AIndex);
 
1245
          if States <= GetItemStatesInternal(Items[AIndex]) then
 
1246
          begin
 
1247
            Result := Items[AIndex];
 
1248
            exit;
 
1249
          end;
 
1250
        end;
1237
1251
      sdAll:
1238
1252
        while True do
1239
1253
        begin
1240
1254
          inc(AIndex);
1241
 
          if AIndex = StartItem.Index then
 
1255
          if AIndex = StartItem.Index then Exit;
 
1256
          if AIndex > ACount-1 then
1242
1257
          begin
1243
 
            Result := nil;
1244
 
            Exit;
1245
 
          end;
1246
 
          if AIndex >= ACount then
1247
1258
            AIndex := -1;
1248
 
          if (AIndex >= 0) and (AIndex < ACount) then
 
1259
            continue;
 
1260
          end;
 
1261
          if States <= GetItemStatesInternal(Items[AIndex]) then
1249
1262
          begin
1250
1263
            Result := Items[AIndex];
1251
 
            if GetItemStatesInternal(Result) - States = [] then
1252
 
              Exit;
 
1264
            exit;
1253
1265
          end;
1254
1266
        end;
1255
1267
    end;
1256
 
    if Result = nil then
1257
 
      exit;
1258
 
    if (GetItemStatesInternal(Result) * States = []) then
1259
 
      Result := nil;
1260
 
  end
 
1268
  end;
1261
1269
end;
1262
1270
 
1263
1271
procedure TCustomListView.ClearSelection;