|
YCP UI Widget Reference
Back to the widget index
PartitionSplitter
|
Hard disk partition splitter tool ( optional widget )
|
|
Description
A very specialized widget to allow a user to comfortably split an existing
hard disk partition in two parts. Shows a bar graph that displays the used
space of the partition, the remaining free space ( before the split ) of the
partition and the space of the new partition ( as suggested ).
Below the bar graph is a slider with an input fields to the left and right
where the user can either input the desired remaining free space or the
desired size of the new partition or drag the slider to do this.
The total size is usedSize+freeSize.
The user can resize the new partition between minNewPartSize and
totalFreeSize-minFreeSize.
Note:
This is a "special" widget, i.e. not all UIs necessarily support it. Check
for availability with HasSpecialWidget( `PartitionSplitter ) before using it.
Arguments
integer
|
usedSize
|
size of the used part of the partition
|
integer
|
totalFreeSize
|
total size of the free part of the partition
( before the split )
|
integer
|
newPartSize
|
suggested size of the new partition
|
integer
|
minNewPartSize
|
minimum size of the new partition
|
integer
|
minFreeSize
|
minimum free size of the old partition
|
string
|
usedLabel
|
BarGraph label for the used part of the old partition
|
string
|
freeLabel
|
BarGraph label for the free part of the old partition
|
string
|
newPartLabel
|
BarGraph label for the new partition
|
string
|
freeFieldLabel
|
label for the remaining free space field
|
string
|
newPartFieldLabel
|
label for the new size field
|
Special Properties
integer
|
Value
|
the numerical value
|
Sample Usage
if ( HasSpecialWidget( `PartitionSplitter ) {...
`PartitionSplitter( 600, 1200, 800, 300, 50,
"Windows used\n%1 MB", "Windows used\n%1 MB", "Linux\n%1 MB", "Linux ( MB )" )
Examples
{
if ( ! UI::HasSpecialWidget(`PartitionSplitter) )
{
UI::OpenDialog(
`VBox(
`Label("Error: This UI doesn't support the PartitionSplitter widget!"),
`PushButton(`opt(`default), "&OK")
)
);
UI::UserInput();
UI::CloseDialog();
return;
}
string unit = "MB";
integer win_used = 350;
integer total_free = 1500;
integer min_free = 50;
integer linux_min = 300;
integer linux_size = 800;
UI::OpenDialog(
`VBox(
`HSpacing( 60 ), // wider default size
`PartitionSplitter( win_used, total_free,
linux_size, linux_min, min_free,
"Windows\nused\n%1 " + unit,
"Windows\nfree\n%1 " + unit,
"Linux\n%1 " + unit,
"Windows free (" + unit + ")",
"Linux (" + unit + ")"
),
`PushButton(`opt(`default), "&OK")
)
);
UI::UserInput();
UI::CloseDialog();
}
|
|
{
if ( ! UI::HasSpecialWidget(`Slider) ||
! UI::HasSpecialWidget(`BarGraph ) )
{
UI::OpenDialog(
`VBox(
`Label("Error: This UI doesn't support the required special widgets!"),
`PushButton(`opt(`default), "&OK")
)
);
UI::UserInput();
UI::CloseDialog();
return;
}
string unit = "MB";
integer win_used = 350;
integer total_free = 1500;
integer min_free = 50;
integer linux_min = 300;
integer linux_size = 800;
UI::OpenDialog(
`VBox(
`HSpacing( 60 ), // wider default size
`Left( `Label( "Now:") ),
`BarGraph( `opt(`vstretch),
[ win_used, total_free ],
[
"Windows\nused\n%1 " + unit,
"Windows\nfree\n%1 " + unit
]
),
`VSpacing(1),
`Left( `Label( "After installation:" ) ),
`PartitionSplitter( win_used, total_free,
linux_size, linux_min, min_free,
"Windows\nused\n%1 " + unit,
"Windows\nfree\n%1 " + unit,
"Linux\n%1 " + unit,
"Windows free (" + unit + ")",
"Linux (" + unit + ")"
),
`PushButton(`opt(`default), "&OK")
)
);
UI::UserInput();
UI::CloseDialog();
}
|
Back to the widget index
|