@@ -1280,6 +1280,90 @@ package body Gtkada.Tree_View is
12801280 end if ;
12811281 end Set_Expansion_Status ;
12821282
1283+ -- --------------------------------------
1284+ -- Set_Expansion_Status_Stop_On_Dummy --
1285+ -- --------------------------------------
1286+
1287+ procedure Set_Expansion_Status_Stop_On_Dummy
1288+ (Self : not null access Tree_Record'Class;
1289+ Status : in out Expansion_Status)
1290+ is
1291+ Stopped : Boolean := False;
1292+ -- Flag to stop expanding when we found a dummy node that means that
1293+ -- not all data is loaded
1294+
1295+ function Expand_Node
1296+ (Model : Gtk_Tree_Model;
1297+ Path : Gtk_Tree_Path;
1298+ Iter : Gtk_Tree_Iter) return Boolean;
1299+
1300+ -- ---------------
1301+ -- Expand_Node --
1302+ -- ---------------
1303+
1304+ function Expand_Node
1305+ (Model : Gtk_Tree_Model;
1306+ Path : Gtk_Tree_Path;
1307+ Iter : Gtk_Tree_Iter) return Boolean
1308+ is
1309+ pragma Unreferenced (Path);
1310+
1311+ Dummy : Boolean;
1312+ The_Id : constant Id := Get_Id (Self, Iter);
1313+ Sortable_Path : Gtk_Tree_Path;
1314+
1315+ begin
1316+ if Status.Expanded.Contains (The_Id) then
1317+
1318+ -- check whether the node contains the dummy node
1319+ if Model.Has_Child (Iter) then
1320+ Stopped := Get_Flag
1321+ (Self, Model.Children (Iter), Flag_Is_Dummy);
1322+ end if ;
1323+
1324+ Sortable_Path := Self.Get_Sortable_Path_For_Store_Iter (Iter);
1325+ Dummy := Self.Expand_Row (Sortable_Path, Open_All => False);
1326+ Path_Free (Sortable_Path);
1327+ end if ;
1328+
1329+ if not Stopped then
1330+ if Status.Selection.Contains (The_Id) then
1331+ Self.Get_Selection.Select_Iter
1332+ (Self.Convert_To_Sortable_Model_Iter (Iter));
1333+ end if ;
1334+ end if ;
1335+
1336+ -- Return True to stop iterating or False to continue
1337+ return Stopped;
1338+ end Expand_Node ;
1339+
1340+ begin
1341+ if Status = No_Expansion then
1342+ return ;
1343+ end if ;
1344+
1345+ Self.Collapse_All;
1346+ Self.Model.Foreach (Expand_Node'Unrestricted_Access);
1347+
1348+ if Stopped then
1349+ -- we found the dummy node, stop for now
1350+ return ;
1351+ end if ;
1352+
1353+ -- here we have all nodes created
1354+ if Status.Has_Scroll_Info then
1355+ Gtk_Tree_View_Record (Self.all ).Scroll_To_Cell
1356+ (Path => Status.Scroll_Y,
1357+ Column => null ,
1358+ Use_Align => False,
1359+ Row_Align => 0.0 ,
1360+ Col_Align => 0.0 );
1361+ Path_Free (Status.Scroll_Y);
1362+ end if ;
1363+
1364+ Status := No_Expansion;
1365+ end Set_Expansion_Status_Stop_On_Dummy ;
1366+
12831367 -- ---------------------
12841368 -- On_Tree_Destroyed --
12851369 -- ---------------------
0 commit comments