mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 09:35:28 +00:00
draft reorderPage method
This commit is contained in:
parent
9b5c434ad1
commit
6dc10404ce
1 changed files with 37 additions and 14 deletions
|
|
@ -85,9 +85,7 @@ class Tab
|
||||||
?\GtkWidget $child,
|
?\GtkWidget $child,
|
||||||
int $page_num
|
int $page_num
|
||||||
) {
|
) {
|
||||||
$this->reorderPage(
|
$this->reorderPage();
|
||||||
$page_num
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -180,7 +178,7 @@ class Tab
|
||||||
$this->gtk->remove_page(
|
$this->gtk->remove_page(
|
||||||
$page_num
|
$page_num
|
||||||
);
|
);
|
||||||
|
/*
|
||||||
// Free memory
|
// Free memory
|
||||||
$this->_page[$page_num] = null;
|
$this->_page[$page_num] = null;
|
||||||
|
|
||||||
|
|
@ -188,20 +186,45 @@ class Tab
|
||||||
unset(
|
unset(
|
||||||
$this->_page[$page_num]
|
$this->_page[$page_num]
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
// Reorder @TODO
|
// Reorder
|
||||||
|
$this->reorderPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reorderPage(
|
public function reorderPage(
|
||||||
int $page_num
|
?int $page_num = null
|
||||||
): void
|
): void
|
||||||
{
|
{
|
||||||
/* @TODO
|
// Reorder all pages
|
||||||
$this->_page = array_splice(
|
if (is_null($page_num))
|
||||||
$this->_page,
|
{
|
||||||
$page_num,
|
// Init new index
|
||||||
0,
|
$_page = [];
|
||||||
// @TODO get $page
|
|
||||||
); */
|
foreach ($this->_page as $page)
|
||||||
|
{
|
||||||
|
// Get current entity $page_num
|
||||||
|
$page_num = $this->gtk->page_num(
|
||||||
|
$page->gtk
|
||||||
|
);
|
||||||
|
|
||||||
|
// Skip deleted
|
||||||
|
if ($page_num === -1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update position
|
||||||
|
$_page[] = $this->_page[$page_num];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reorder
|
||||||
|
$this->_page = $_page;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reorder by $page_num
|
||||||
|
else throw new \Exception(
|
||||||
|
'Reorder by $page_num value not implemented'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue