@@ -1536,8 +1536,12 @@ impl StyledDom {
1536
1536
}
1537
1537
1538
1538
/// Inject scroll bar DIVs with relevant event handlers into the DOM
1539
+ ///
1540
+ /// This function essentially takes
1539
1541
pub fn inject_scroll_bars ( & mut self ) {
1540
1542
1543
+ use azul_css_parser:: CssApiWrapper ;
1544
+
1541
1545
// allocate 14 nodes for every node
1542
1546
//
1543
1547
// 0: root component
@@ -1557,6 +1561,90 @@ impl StyledDom {
1557
1561
// 14: |- self.root
1558
1562
// |- ... self.children
1559
1563
1564
+ let dom_to_inject = Dom :: div ( )
1565
+ // .with_class("__azul-native-scroll-root-component".into())
1566
+ . with_inline_style ( "display:flex; flex-grow:1; flex-direction:column;" . into ( ) )
1567
+ . with_children ( vec ! [
1568
+
1569
+ Dom :: div( )
1570
+ // .with_class("__azul-native-scroll-vertical-container".into())
1571
+ . with_inline_style( "display:flex; flex-grow:1; flex-direction:column-reverse;" . into( ) )
1572
+ . with_children( vec![
1573
+
1574
+ Dom :: div( )
1575
+ // .with_class("__azul-native-scroll-horizontal-scrollbar".into())
1576
+ . with_inline_style( "display:flex; flex-grow:1; flex-direction:row; height:15px; background:grey;" . into( ) )
1577
+ . with_children( vec![
1578
+ Dom :: div( ) ,
1579
+ // .with_class("__azul-native-scroll-horizontal-scrollbar-track-left".into()),
1580
+ Dom :: div( )
1581
+ // .with_class("__azul-native-scroll-horizontal-scrollbar-track-middle".into())
1582
+ . with_children( vec![
1583
+ Dom :: div( )
1584
+ // .with_class("__azul-native-scroll-horizontal-scrollbar-track-thumb".into())
1585
+ ] . into( ) ) ,
1586
+ Dom :: div( )
1587
+ // .with_class("__azul-native-scroll-horizontal-scrollbar-track-right".into()),
1588
+ ] . into( ) ) ,
1589
+
1590
+ Dom :: div( )
1591
+ // .with_class("__azul-native-scroll-content-container-1".into())
1592
+ . with_inline_style( "display:flex; flex-grow:1; flex-direction:row-reverse;" . into( ) )
1593
+ . with_children( vec![
1594
+
1595
+ Dom :: div( )
1596
+ // .with_class("__azul-native-scroll-vertical-scrollbar".into())
1597
+ . with_inline_style( "display:flex; flex-grow:1; flex-direction:column; width:15px; background:grey;" . into( ) )
1598
+ . with_children( vec![
1599
+ Dom :: div( ) ,
1600
+ // .with_class("__azul-native-scroll-vertical-scrollbar-track-top".into()),
1601
+ Dom :: div( )
1602
+ // .with_class("__azul-native-scroll-vertical-scrollbar-track-middle".into())
1603
+ . with_children( vec![
1604
+ Dom :: div( )
1605
+ // .with_class("__azul-native-scroll-vertical-scrollbar-track-thumb".into())
1606
+ ] . into( ) ) ,
1607
+ Dom :: div( )
1608
+ // .with_class("__azul-native-scroll-vertical-scrollbar-track-bottom".into()),
1609
+ ] . into( ) ) ,
1610
+
1611
+ Dom :: div( )
1612
+ // .with_class("__azul-native-scroll-content-container-1".into())
1613
+ . with_inline_style( "display:flex; flex-grow:1; flex-direction:column;" . into( ) )
1614
+ . with_children( vec![
1615
+ Dom :: div( ) // <- this div is where the new children will be injected into
1616
+ ] . into( ) )
1617
+ ] . into( ) )
1618
+ ] . into( ) )
1619
+ ] . into ( ) )
1620
+ . style ( CssApiWrapper :: empty ( ) ) ;
1621
+
1622
+ // allocate new nodes
1623
+ let nodes_to_allocate = self . node_data . len ( )
1624
+ + ( self . non_leaf_nodes . len ( ) * dom_to_inject. node_data . len ( ) ) ;
1625
+
1626
+ // pre-allocate a new DOM tree with self.nodes.len() * dom_to_inject.nodes.len() nodes
1627
+
1628
+ let mut new_styled_dom = StyledDom {
1629
+ root : self . root ,
1630
+ node_hierarchy : vec ! [ NodeHierarchyItem :: zeroed( ) ; nodes_to_allocate] . into ( ) ,
1631
+ node_data : vec ! [ NodeData :: const_div( ) ; nodes_to_allocate] . into ( ) ,
1632
+ styled_nodes : vec ! [ StyledNode :: default ( ) ; nodes_to_allocate] . into ( ) ,
1633
+ cascade_info : vec ! [ CascadeInfo :: default ( ) ; nodes_to_allocate] ,
1634
+ nodes_with_window_callbacks : self . nodes_with_window_callbacks . clone ( ) ,
1635
+ nodes_with_not_callbacks : self . nodes_with_not_callbacks . clone ( ) ,
1636
+ nodes_with_datasets : self . nodes_with_datasets . clone ( ) ,
1637
+ tag_ids_to_node_ids : self . tag_ids_to_node_ids . clone ( ) ,
1638
+ non_leaf_nodes : self . non_leaf_nodes . clone ( ) ,
1639
+ css_property_cache : self . css_property_cache . clone ( ) ,
1640
+ } ;
1641
+
1642
+ // inject self.root as the nth node
1643
+ let inject_as_id = 0 ;
1644
+
1645
+ println ! ( "inject scroll bars:\r \n {}" , dom_to_inject. get_html_string( "" , "" , true ) ) ;
1646
+
1647
+ // *self = new_styled_dom;
1560
1648
}
1561
1649
1562
1650
/// Inject a menu bar into the root component
0 commit comments