diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-01-28 13:26:16 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-01-28 13:26:16 +0000 |
commit | 40510f6ae00159369bb9886b6fe3ae5f19a3c615 (patch) | |
tree | a7a75075ff26e86040e0127f11bae9d65fbf3230 | |
parent | 1191f921a177b6793e873166dd499d20c8c72ac3 (diff) | |
download | drakx-backup-do-not-use-40510f6ae00159369bb9886b6fe3ae5f19a3c615.tar drakx-backup-do-not-use-40510f6ae00159369bb9886b6fe3ae5f19a3c615.tar.gz drakx-backup-do-not-use-40510f6ae00159369bb9886b6fe3ae5f19a3c615.tar.bz2 drakx-backup-do-not-use-40510f6ae00159369bb9886b6fe3ae5f19a3c615.tar.xz drakx-backup-do-not-use-40510f6ae00159369bb9886b6fe3ae5f19a3c615.zip |
simplify API (always -1,-1 for left,top when creating widget, it means auto-placement)
-rw-r--r-- | perl-install/Newt/Newt.xs | 68 | ||||
-rw-r--r-- | perl-install/interactive/newt.pm | 12 |
2 files changed, 38 insertions, 42 deletions
diff --git a/perl-install/Newt/Newt.xs b/perl-install/Newt/Newt.xs index 6ffdb1e63..0b1a757ff 100644 --- a/perl-install/Newt/Newt.xs +++ b/perl-install/Newt/Newt.xs @@ -115,28 +115,30 @@ addCallback(co, callback) newtComponentAddCallback(co, componentCallback, callback); Newt::Component -newtCompactButton(left,top,text) - int left; - int top; +newtCompactButton(text) const char * text; + CODE: + RETVAL = newtCompactButton(-1, -1, text); + OUTPUT: + RETVAL Newt::Component -newtButton(left,top,text) - int left; - int top; +newtButton(text) const char * text; + CODE: + RETVAL = newtButton(-1, -1, text); + OUTPUT: + RETVAL Newt::Component -newtCheckbox(left,top,text,defValue,seq) - int left; - int top; +newtCheckbox(text,defValue,seq) const char * text; char *defValue; const char * seq; - CODE: - RETVAL = newtCheckbox(left, top, text, defValue[0], seq, NULL); - OUTPUT: - RETVAL + CODE: + RETVAL = newtCheckbox(-1, -1, text, defValue[0], seq, NULL); + OUTPUT: + RETVAL int newtCheckboxGetValue(co) @@ -150,10 +152,12 @@ newtCheckboxSetValue(co, value) newtCheckboxSetValue(co, value[0]); Newt::Component -newtLabel(left,top,text) - int left; - int top; +newtLabel(text) const char * text; +CODE: + RETVAL = newtLabel(-1, -1, text); +OUTPUT: + RETVAL void newtLabelSetText(co,text) @@ -161,12 +165,14 @@ newtLabelSetText(co,text) const char * text; Newt::Component -newtVerticalScrollbar(left,top,height,normalColorset,thumbColorset) - int left; - int top; +newtVerticalScrollbar(height,normalColorset,thumbColorset) int height; int normalColorset; int thumbColorset; +CODE: + RETVAL = newtVerticalScrollbar(-1, -1, height,normalColorset,thumbColorset); +OUTPUT: + RETVAL void newtScrollbarSet(co,where,total) @@ -175,11 +181,13 @@ newtScrollbarSet(co,where,total) int total; Newt::Component -newtListbox(left,top,height,flags) - int left; - int top; +newtListbox(height,flags) int height; int flags; +CODE: + RETVAL = newtListbox(-1, -1, height, flags); +OUTPUT: + RETVAL SV * newtListboxGetCurrent(co) @@ -211,16 +219,6 @@ OUTPUT: RETVAL Newt::Component -newtTextboxReflowed(left,top,text,width,flexDown,flexUp,flags) - int left; - int top; - char * text; - int width; - int flexDown; - int flexUp; - int flags; - -Newt::Component newtTextbox(left,top,width,height,flags) int left; int top; @@ -307,16 +305,14 @@ newtDrawForm(form) Newt::Component form; Newt::Component -newtEntry(left,top,initialValue,width,flag) - int left; - int top; +newtEntry(initialValue,width,flag) const char * initialValue; int width; int flag; CODE: { char *result; - RETVAL = newtEntry(left,top,initialValue,width,&result,flag); + RETVAL = newtEntry(-1, -1, initialValue,width,&result,flag); } OUTPUT: RETVAL diff --git a/perl-install/interactive/newt.pm b/perl-install/interactive/newt.pm index fba57874c..58d03d251 100644 --- a/perl-install/interactive/newt.pm +++ b/perl-install/interactive/newt.pm @@ -129,18 +129,18 @@ sub ask_fromW_real { my ($w, $real_w, $set, $get, $expand, $size); if ($e->{type} eq 'bool') { - $w = Newt::Component::Checkbox(-1, -1, $e->{text} || '', checkval(${$e->{val}}), " *"); + $w = Newt::Component::Checkbox($e->{text} || '', checkval(${$e->{val}}), " *"); $set = sub { $w->CheckboxSetValue(checkval($_[0])) }; $get = sub { $w->CheckboxGetValue == ord '*' }; } elsif ($e->{type} eq 'button') { - $w = Newt::Component::Button(-1, -1, simplify_string(may_apply($e->{format}, ${$e->{val}}))); + $w = Newt::Component::Button(simplify_string(may_apply($e->{format}, ${$e->{val}}))); } elsif ($e->{type} =~ /list/) { my ($h) = @$l == 1 && $height > 30 ? 10 : 5; my $scroll = @{$e->{list}} > $h ? 1 << 2 : 0; $has_scroll = 1; $size = min(int @{$e->{list}}, $h); - $w = Newt::Component::Listbox(-1, -1, $size, $scroll); #- NEWT_FLAG_SCROLL + $w = Newt::Component::Listbox($size, $scroll); #- NEWT_FLAG_SCROLL my @l = map { my $t = simplify_string(may_apply($e->{format}, $_), $width - 10); @@ -157,7 +157,7 @@ sub ask_fromW_real { } @{$e->{list}}; }; } else { - $w = Newt::Component::Entry(-1, -1, '', 20, ($e->{hidden} && 1 << 11) | (1 << 2)); + $w = Newt::Component::Entry('', 20, ($e->{hidden} && 1 << 11) | (1 << 2)); $get = sub { $w->EntryGetValue }; $set = sub { $w->EntrySet($_[0], 1) }; } @@ -177,7 +177,7 @@ sub ask_fromW_real { my $grid = Newt::Grid::CreateGrid(3, max(1, int @$l)); each_index { - $grid->GridSetField(0, $::i, 1, ${Newt::Component::Label(-1, -1, $_->{e}{label})}, 0, 0, 1, 0, 1, 0); + $grid->GridSetField(0, $::i, 1, ${Newt::Component::Label($_->{e}{label})}, 0, 0, 1, 0, 1, 0); $grid->GridSetField(1, $::i, 1, ${$_->{real_w}}, 0, 0, 0, 0, 1, 0); } @widgets; @@ -192,7 +192,7 @@ sub ask_fromW_real { $grid->GridPlace(1, 1); #- Uh?? otherwise the size allocated is bad $has_scroll = 1; - my $scroll = Newt::Component::VerticalScrollbar(-1, -1, $height, 9, 10); # 9=NEWT_COLORSET_CHECKBOX, 10=NEWT_COLORSET_ACTCHECKBOX + my $scroll = Newt::Component::VerticalScrollbar($height, 9, 10); # 9=NEWT_COLORSET_CHECKBOX, 10=NEWT_COLORSET_ACTCHECKBOX my $subf = $scroll->Form('', 0); $subf->FormSetHeight($height); $subf->FormAddGrid($grid, 0); |