Enlightenment CVS committal
Author : codewarrior
Project : e17
Module : proto
Dir : e17/proto/etk-perl/lib/Etk
Modified Files:
Combobox.pm
Log Message:
- work on combobox .pm
- implement wrappers for combo in xs, we have a 10 item compromise for now on
co
mbobox models (10 items per entry)
- general fixes
- formatting
===================================================================
RCS file: /cvs/e/e17/proto/etk-perl/lib/Etk/Combobox.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- Combobox.pm 7 Jun 2006 11:58:33 -0000 1.1
+++ Combobox.pm 11 Jun 2006 18:13:53 -0000 1.2
@@ -3,6 +3,14 @@
use vars qw(@ISA);
require Etk::Widget;
@ISA = ("Etk::Widget");
+
+use constant
+{
+ ColumnTypeLabel => 0,
+ ColumnTypeImage => 1,
+ ColumnTypeOther => 2
+};
+
sub new
{
my $class = shift;
@@ -12,6 +20,15 @@
return $self;
}
+sub new_default
+{
+ my $class = shift;
+ my $self = $class->SUPER::new();
+ $self->{WIDGET} = Etk::etk_combobox_new_default();
+ bless($self, $class);
+ return $self;
+}
+
sub HeightSet
{
my $self = shift;
@@ -31,11 +48,12 @@
my $col_type = shift;
my $size = shift;
my $expand = shift;
+ my $hfill = shift;
my $vfill = shift;
my $xalign = shift;
my $yalign = shift;
Etk::etk_combobox_column_add($self->{WIDGET}, $col_type, $size, $expand,
- $vfill, $xalign, $yalign);
+ $hfill, $vfill, $xalign, $yalign);
}
sub Build
@@ -54,52 +72,111 @@
sub ActiveItemGet
{
my $self = shift;
- return Etk::etk_combobox_active_item_get($self->{WIDGET});
+ my $item = Etk::Combobox::Item->new();
+ $item->{WIDGET} = Etk::etk_combobox_active_item_get($self->{WIDGET});
+ return $item;
}
sub NthItemGet
{
my $self = shift;
- my $item = shift;
- return Etk::etk_combobox_nth_item_get($self->{WIDGET}, $item);
+ my $n = shift;
+ my $item = Etk::Combobox::Item->new();
+ $item->{WIDGET} = Etk::etk_combobox_nth_item_get($self->{WIDGET}, $n);
+ return $item;
}
sub ItemPrepend
{
- # TODO: make this work with as many items as we want
my $self = shift;
- my $item = shift;
+ my $item = Etk::Combobox::Item->new();
+ my @args;
- Etk::etk_combobox_prepend($self->{WIDGET}, $item->{WIDGET});
+ for my $arg (@_)
+ {
+ if($arg->isa("Etk::Widget"))
+ {
+ push @args, $arg->{WIDGET};
+ }
+ else
+ {
+ push @args, $arg;
+ }
+ }
+ $item->{WIDGET} = Etk::etk_combobox_prepend_complex($self->{WIDGET},
+ @args);
+ return $item;
}
sub ItemAppend
{
- # TODO: make this work with as many items as we want
my $self = shift;
- my $item = shift;
+ my $item = Etk::Combobox::Item->new();
+ my @args;
+
+ for my $arg (@_)
+ {
+ if($arg->isa("Etk::Widget"))
+ {
+ push @args, $arg->{WIDGET};
+ }
+ else
+ {
+ push @args, $arg;
+ }
+ }
- Etk::etk_combobox_append($self->{WIDGET}, $item->{WIDGET});
+ $item->{WIDGET} = Etk::etk_combobox_item_append_complex($self->{WIDGET},
+ @args);
+ return $item;
}
sub ItemPrependRelative
{
- # TODO: make this work with as many items as we want
my $self = shift;
my $relative = shift;
- my $item = shift;
+ my $item = Etk::Combobox::Item->new();
+ my @args;
- Etk::etk_combobox_prepend_relative($self->{WIDGET}, $relative->{WIDGET},
$item->{WIDGET});
+ for my $arg (@_)
+ {
+ if($arg->isa("Etk::Widget"))
+ {
+ push @args, $arg->{WIDGET};
+ }
+ else
+ {
+ push @args, $arg;
+ }
+ }
+
+ $item->{WIDGET} = Etk::etk_combobox_prepend_relative_complex(
+ $self->{WIDGET}, $relative->{WIDGET}, @args);
+ return $item;
}
sub ItemAppendRelative
{
- # TODO: make this work with as many items as we want
my $self = shift;
my $relative = shift;
- my $item = shift;
+ my $item = Etk::Combobox::Item->new();
+ my @args;
- Etk::etk_combobox_append_relative($self->{WIDGET}, $relative->{WIDGET},
$item->{WIDGET});
+ for my $arg (@_)
+ {
+ if($arg->isa("Etk::Widget"))
+ {
+ push @args, $arg->{WIDGET};
+ }
+ else
+ {
+ push @args, $arg;
+ }
+ }
+
+ $item->{WIDGET} = Etk::etk_combobox_append_relative_complex(
+ $self->{WIDGET}, $relative->{WIDGET}, @args);
+ return $item;
}
sub ItemRemove
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs