ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/UI.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.198 by root, Fri May 12 02:08:52 2006 UTC vs.
Revision 1.200 by root, Sat May 13 00:27:09 2006 UTC

383sub set_parent { 383sub set_parent {
384 my ($self, $parent) = @_; 384 my ($self, $parent) = @_;
385 385
386 Scalar::Util::weaken ($self->{parent} = $parent); 386 Scalar::Util::weaken ($self->{parent} = $parent);
387 387
388
389 # TODO: req_w _does_change after ->reconfigure 388 # TODO: req_w _does_change after ->reconfigure
390 $self->check_size 389 $self->check_size
391 unless exists $self->{req_w}; 390 unless exists $self->{req_w};
392} 391}
393 392
777 $self->add ($self->{slider}); 776 $self->add ($self->{slider});
778 777
779 $self 778 $self
780} 779}
781 780
782#TODO# update range on size_allocate depeneing on child 781#TODO# update range on size_allocate depending on child
783# update viewport offset on scroll 782# update viewport offset on scroll
784 783
785############################################################################# 784#############################################################################
786 785
787package CFClient::UI::Frame; 786package CFClient::UI::Frame;
788 787
789our @ISA = CFClient::UI::Bin::; 788our @ISA = CFClient::UI::Bin::;
790 789
791use CFClient::OpenGL; 790use CFClient::OpenGL;
791
792sub new {
793 my $class = shift;
794
795 $class->SUPER::new (
796 bg => undef,
797 @_,
798 )
799}
800
801sub _draw {
802 my ($self) = @_;
803
804 if ($self->{bg}) {
805 my ($w, $h) = @$self{qw(w h)};
806
807 glEnable GL_BLEND;
808 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
809 glColor @{ $self->{bg} };
810
811 glBegin GL_QUADS;
812 glVertex 0 , 0;
813 glVertex 0 , $h;
814 glVertex $w, $h;
815 glVertex $w, 0;
816 glEnd;
817
818 glDisable GL_BLEND;
819 }
820
821 $self->SUPER::_draw;
822}
792 823
793############################################################################# 824#############################################################################
794 825
795package CFClient::UI::FancyFrame; 826package CFClient::UI::FancyFrame;
796 827
1449 my $sym = $ev->{sym}; 1480 my $sym = $ev->{sym};
1450 my $uni = $ev->{unicode}; 1481 my $uni = $ev->{unicode};
1451 1482
1452 my $text = $self->get_text; 1483 my $text = $self->get_text;
1453 1484
1454 if ($sym == 8) { 1485 if ($uni == 8) {
1455 substr $text, --$self->{cursor}, 1, "" if $self->{cursor}; 1486 substr $text, --$self->{cursor}, 1, "" if $self->{cursor};
1456 } elsif ($sym == 127) { 1487 } elsif ($uni == 127) {
1457 substr $text, $self->{cursor}, 1, ""; 1488 substr $text, $self->{cursor}, 1, "";
1458 } elsif ($sym == CFClient::SDLK_LEFT) { 1489 } elsif ($sym == CFClient::SDLK_LEFT) {
1459 --$self->{cursor} if $self->{cursor}; 1490 --$self->{cursor} if $self->{cursor};
1460 } elsif ($sym == CFClient::SDLK_RIGHT) { 1491 } elsif ($sym == CFClient::SDLK_RIGHT) {
1461 ++$self->{cursor} if $self->{cursor} < length $self->{text}; 1492 ++$self->{cursor} if $self->{cursor} < length $self->{text};
1462 } elsif ($sym == CFClient::SDLK_HOME) { 1493 } elsif ($sym == CFClient::SDLK_HOME) {
1463 $self->{cursor} = 0; 1494 $self->{cursor} = 0;
1464 } elsif ($sym == CFClient::SDLK_END) { 1495 } elsif ($sym == CFClient::SDLK_END) {
1465 $self->{cursor} = length $text; 1496 $self->{cursor} = length $text;
1466 } elsif ($sym == 27) { 1497 } elsif ($uni == 27) {
1467 $self->emit ('escape'); 1498 $self->emit ('escape');
1468 } elsif ($uni) { 1499 } elsif ($uni) {
1469 substr $text, $self->{cursor}++, 0, chr $uni; 1500 substr $text, $self->{cursor}++, 0, chr $uni;
1470 } 1501 }
1471 1502

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines