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.57 by root, Mon Apr 10 22:53:49 2006 UTC vs.
Revision 1.65 by root, Tue Apr 11 14:04:27 2006 UTC

1package Crossfire::Client::Widget; 1package CFClient::Widget;
2 2
3use strict; 3use strict;
4 4
5use Scalar::Util; 5use Scalar::Util;
6 6
7use SDL::OpenGL; 7use SDL::OpenGL;
8use SDL::OpenGL::Constants; 8use SDL::OpenGL::Constants;
9 9
10use Crossfire::Client; 10use CFClient;
11 11
12our ($FOCUS, $HOVER, $GRAB); # various widgets 12our ($FOCUS, $HOVER, $GRAB); # various widgets
13 13
14our $TOPLEVEL; 14our $TOPLEVEL;
15our $BUTTON_STATE; 15our $BUTTON_STATE;
34 $GRAB->update if $GRAB; 34 $GRAB->update if $GRAB;
35 } 35 }
36 36
37 $BUTTON_STATE |= 1 << ($ev->button - 1); 37 $BUTTON_STATE |= 1 << ($ev->button - 1);
38 38
39 $GRAB->button_down ($ev) if $GRAB; 39 $GRAB->button_down ($ev, $GRAB->translate ($x, $y)) if $GRAB;
40} 40}
41 41
42sub feed_sdl_button_up_event { 42sub feed_sdl_button_up_event {
43 my ($ev) = @_; 43 my ($ev) = @_;
44 my ($x, $y) = ($ev->motion_x, $ev->motion_y); 44 my ($x, $y) = ($ev->motion_x, $ev->motion_y);
45 45
46 my $widget = $GRAB || $TOPLEVEL->find_widget ($x, $y); 46 my $widget = $GRAB || $TOPLEVEL->find_widget ($x, $y);
47 47
48 $BUTTON_STATE &= ~(1 << ($ev->button - 1)); 48 $BUTTON_STATE &= ~(1 << ($ev->button - 1));
49
50 $GRAB->button_down ($ev, $GRAB->translate ($x, $y)) if $GRAB;
49 51
50 if (!$BUTTON_STATE) { 52 if (!$BUTTON_STATE) {
51 my $grab = $GRAB; undef $GRAB; 53 my $grab = $GRAB; undef $GRAB;
52 $grab->update if $grab; 54 $grab->update if $grab;
53 $GRAB->update if $GRAB; 55 $GRAB->update if $GRAB;
65 67
66 $hover->update if $hover; 68 $hover->update if $hover;
67 $HOVER->update if $HOVER; 69 $HOVER->update if $HOVER;
68 } 70 }
69 71
70 $HOVER->mouse_motion ($ev) if $HOVER; 72 $HOVER->mouse_motion ($ev, $HOVER->translate ($x, $y)) if $HOVER;
71} 73}
72 74
73sub new { 75sub new {
74 my $class = shift; 76 my $class = shift;
75 77
76 bless { @_ }, $class 78 bless {
79 x => 0,
80 y => 0,
81 z => 0,
82 @_
83 }, $class
77} 84}
78 85
79sub move { 86sub move {
80 my ($self, $x, $y, $z) = @_; 87 my ($self, $x, $y, $z) = @_;
81 $self->{x} = $x; 88 $self->{x} = $x;
95sub size_allocate { 102sub size_allocate {
96 my ($self, $w, $h) = @_; 103 my ($self, $w, $h) = @_;
97 104
98 $self->{w} = $w; 105 $self->{w} = $w;
99 $self->{h} = $h; 106 $self->{h} = $h;
107}
108
109# translate global koordinates to local coordinate system
110sub translate {
111 my ($self, $x, $y) = @_;
112
113 $self->{parent}->translate ($x - $self->{x}, $y - $self->{y});
100} 114}
101 115
102sub focus_in { 116sub focus_in {
103 my ($self) = @_; 117 my ($self) = @_;
104 118
201 #$self->deactivate; 215 #$self->deactivate;
202} 216}
203 217
204############################################################################# 218#############################################################################
205 219
206package Crossfire::Client::Widget::Container; 220package CFClient::Widget::Container;
207 221
208our @ISA = Crossfire::Client::Widget::; 222our @ISA = CFClient::Widget::;
209 223
210sub new { 224sub new {
211 my ($class, @widgets) = @_; 225 my ($class, %arg) = @_;
212 226
227 my $children = delete $arg{children} || [];
228
213 my $self = $class->SUPER::new (children => []); 229 my $self = $class->SUPER::new (children => [], %arg);
214 $self->add ($_) for @widgets; 230 $self->add ($_) for @$children;
215 231
216 $self 232 $self
217} 233}
218 234
219sub add { 235sub add {
260 $_->draw for @{$self->{children}}; 276 $_->draw for @{$self->{children}};
261} 277}
262 278
263############################################################################# 279#############################################################################
264 280
265package Crossfire::Client::Widget::Bin; 281package CFClient::Widget::Bin;
266 282
267our @ISA = Crossfire::Client::Widget::Container::; 283our @ISA = CFClient::Widget::Container::;
268 284
269sub child { $_[0]->{children}[0] } 285sub child { $_[0]->{children}[0] }
270 286
271sub size_request { 287sub size_request {
272 $_[0]{children}[0]->size_request if $_[0]{children}[0]; 288 $_[0]{children}[0]->size_request if $_[0]{children}[0];
280 if $self->{children}[0] 296 if $self->{children}[0]
281} 297}
282 298
283############################################################################# 299#############################################################################
284 300
285package Crossfire::Client::Widget::Window; 301package CFClient::Widget::Window;
286 302
287our @ISA = Crossfire::Client::Widget::Bin::; 303our @ISA = CFClient::Widget::Bin::;
288 304
289use SDL::OpenGL; 305use SDL::OpenGL;
290 306
291sub new { 307sub new {
292 my ($class, $x, $y, $z, $w, $h) = @_; 308 my ($class, %arg) = @_;
293 309
294 my $self = $class->SUPER::new; 310 my $self = $class->SUPER::new (%arg);
295
296 @$self{qw(x y z w h)} = ($x, $y, $z, $w, $h);
297} 311}
298 312
299sub update { 313sub update {
300 my ($self) = @_; 314 my ($self) = @_;
301 315
316 # we want to do this delayed...
302 $self->render_chld; 317 $self->render_chld;
303 $self->SUPER::update; 318 $self->SUPER::update;
304} 319}
305 320
306sub render_chld { 321sub render_chld {
307 my ($self) = @_; 322 my ($self) = @_;
308 323
309 $self->{texture} = 324 $self->{texture} =
310 Crossfire::Client::Texture->new_from_opengl ( 325 CFClient::Texture->new_from_opengl (
311 $self->{w}, $self->{h}, sub { $self->child->draw } 326 $self->{w}, $self->{h}, sub { $self->child->draw }
312 ); 327 );
313} 328}
314 329
315sub size_allocate { 330sub size_allocate {
341 glDisable GL_TEXTURE_2D; 356 glDisable GL_TEXTURE_2D;
342} 357}
343 358
344############################################################################# 359#############################################################################
345 360
346package Crossfire::Client::Widget::Frame; 361package CFClient::Widget::Frame;
347 362
348our @ISA = Crossfire::Client::Widget::Bin::; 363our @ISA = CFClient::Widget::Bin::;
349 364
350use SDL::OpenGL; 365use SDL::OpenGL;
351 366
352sub size_request { 367sub size_request {
353 my ($self) = @_; 368 my ($self) = @_;
387 $chld->draw; 402 $chld->draw;
388} 403}
389 404
390############################################################################# 405#############################################################################
391 406
392package Crossfire::Client::Widget::FancyFrame; 407package CFClient::Widget::FancyFrame;
393 408
394our @ISA = Crossfire::Client::Widget::Bin::; 409our @ISA = CFClient::Widget::Bin::;
395 410
396use SDL::OpenGL; 411use SDL::OpenGL;
397 412
398my @tex = 413my @tex =
399 map { new_from_file Crossfire::Client::Texture Crossfire::Client::find_rcfile $_ } 414 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
400 qw(d1_bg.png d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png); 415 qw(d1_bg.png d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png);
401 416
402sub size_request { 417sub size_request {
403 my ($self) = @_; 418 my ($self) = @_;
404 419
470 485
471} 486}
472 487
473############################################################################# 488#############################################################################
474 489
475package Crossfire::Client::Widget::Table; 490package CFClient::Widget::Table;
476 491
477our @ISA = Crossfire::Client::Widget::Bin::; 492our @ISA = CFClient::Widget::Bin::;
478 493
479use SDL::OpenGL; 494use SDL::OpenGL;
480 495
481sub add { 496sub add {
482 my ($self, $x, $y, $chld) = @_; 497 my ($self, $x, $y, $chld) = @_;
557 } 572 }
558} 573}
559 574
560############################################################################# 575#############################################################################
561 576
562package Crossfire::Client::Widget::VBox; 577package CFClient::Widget::VBox;
563 578
564our @ISA = Crossfire::Client::Widget::Container::; 579our @ISA = CFClient::Widget::Container::;
565 580
566use SDL::OpenGL; 581use SDL::OpenGL;
567 582
568sub size_request { 583sub size_request {
569 my ($self) = @_; 584 my ($self) = @_;
617 } 632 }
618} 633}
619 634
620############################################################################# 635#############################################################################
621 636
622package Crossfire::Client::Widget::Label; 637package CFClient::Widget::Label;
623 638
624our @ISA = Crossfire::Client::Widget::; 639our @ISA = CFClient::Widget::;
625 640
626use SDL::OpenGL; 641use SDL::OpenGL;
627 642
628sub new { 643sub new {
629 my ($class, $x, $y, $z, $height, $text) = @_; 644 my ($class, %arg) = @_;
630
631 $height ||= $::FONTSIZE;
632 645
633 # TODO: color, and make height, xyz etc. optional 646 # TODO: color, and make height, xyz etc. optional
634 my $self = $class->SUPER::new (x => $x, y => $y, z => $z, height => $height); 647 my $self = $class->SUPER::new (
648 color => [1, 1, 1],
649 height => $::FONTSIZE,
650 text => "",
651 layout => new CFClient::Layout,
652 %arg
653 );
635 654
636 $self->set_text ($text); 655 $self->set_text ($self->{text});
637 656
638 $self 657 $self
639} 658}
640 659
641sub set_text { 660sub set_text {
642 my ($self, $text) = @_; 661 my ($self, $text) = @_;
643 662
644 $self->{text} = $text; 663 $self->{text} = $text;
645 $self->{texture} = new_from_text Crossfire::Client::Texture $text, $self->{height}; 664 $self->{layout}->set_markup ($text);
646 665
647 $self->update; 666 delete $self->{texture};
648} 667}
649 668
650sub get_text { 669sub get_text {
651 my ($self, $text) = @_; 670 my ($self, $text) = @_;
652 671
654} 673}
655 674
656sub size_request { 675sub size_request {
657 my ($self) = @_; 676 my ($self) = @_;
658 677
678 $self->{layout}->set_width;
679 $self->{layout}->set_height ($self->{height});
680 $self->{layout}->size
659 if ($self->{texture}{width} > 1 && $self->{texture}{height} > 1) { #TODO: hack 681# if ($self->{texture}{width} > 1 && $self->{texture}{height} > 1) { #TODO: hack
660 ( 682# (
661 $self->{texture}{width}, 683# $self->{texture}{width},
662 $self->{texture}{height}, 684# $self->{texture}{height},
663 ) 685# )
664 } else { 686# } else {
665 my ($w, $h, $data) = Crossfire::Client::font_render "Yy", $self->{height}; 687# my ($w, $h, $data) = CFClient::font_render "Yy", $self->{height};
666 688#
667 ($w, $h) 689# ($w, $h)
668 } 690# }
691}
669 692
693sub size_allocate {
694 my ($self, $w, $h) = @_;
695
696 $self->SUPER::size_allocate ($w, $h);
697 delete $self->{texture};
670} 698}
671 699
672sub _draw { 700sub _draw {
673 my ($self) = @_; 701 my ($self) = @_;
674 702
675 my $tex = $self->{texture}; 703 my $tex = $self->{texture} ||= do {
704 $self->{layout}->set_width ($self->{w});
705 new_from_layout CFClient::Texture $self->{layout};
706 };
676 707
677 glEnable GL_BLEND; 708 glEnable GL_BLEND;
678 glEnable GL_TEXTURE_2D; 709 glEnable GL_TEXTURE_2D;
679 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 710 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
680 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 711 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
681 712
682 glColor 1, 0, 0, 1; # TODO color 713 glColor @{$self->{color}};
683 714
684 $tex->draw_quad (0, 0); 715 $tex->draw_quad (0, 0);
685 716
686 glDisable GL_BLEND; 717 glDisable GL_BLEND;
687 glDisable GL_TEXTURE_2D; 718 glDisable GL_TEXTURE_2D;
688} 719}
689 720
690############################################################################# 721#############################################################################
691 722
692package Crossfire::Client::Widget::Entry; 723package CFClient::Widget::Entry;
693 724
694our @ISA = Crossfire::Client::Widget::Label::; 725our @ISA = CFClient::Widget::Label::;
695 726
696use SDL; 727use SDL;
697use SDL::OpenGL; 728use SDL::OpenGL;
698 729
699sub key_down { 730sub key_down {
708 739
709 if ($sym == SDLK_BACKSPACE) { 740 if ($sym == SDLK_BACKSPACE) {
710 substr $text, -1, 1, ''; 741 substr $text, -1, 1, '';
711 } elsif ($uni) { 742 } elsif ($uni) {
712 $text .= chr $uni; 743 $text .= chr $uni;
713 print "$uni <$text>\n";#d#
714 } 744 }
715 745
716 $self->set_text ($text); 746 $self->set_text ($text);
717} 747}
718 748
719sub button_down { 749sub button_down {
720 my ($self, $ev) = @_; 750 my ($self, $ev) = @_;
721 751
722 $self->focus_in; 752 $self->focus_in;
753}
754
755sub mouse_motion {
756 my ($self, $ev, $x, $y) = @_;
757 printf "M %d,%d %d,%d\n", $ev->motion_x, $ev->motion_y, $x, $y;#d#
723} 758}
724 759
725sub _draw { 760sub _draw {
726 my ($self) = @_; 761 my ($self) = @_;
727 762
741 $self->SUPER::_draw; 776 $self->SUPER::_draw;
742} 777}
743 778
744############################################################################# 779#############################################################################
745 780
746package Crossfire::Client::Widget::MapWidget; 781package CFClient::Widget::MapWidget;
747 782
748use strict; 783use strict;
749 784
750use List::Util qw(min max); 785use List::Util qw(min max);
751 786
752use SDL; 787use SDL;
753use SDL::OpenGL; 788use SDL::OpenGL;
754use SDL::OpenGL::Constants; 789use SDL::OpenGL::Constants;
755 790
756our @ISA = Crossfire::Client::Widget::; 791our @ISA = CFClient::Widget::;
792
793sub new {
794 my $class = shift;
795
796 $class->SUPER::new (
797 z => -1,
798 list => (glGenLists 1),
799 @_
800 )
801}
757 802
758sub key_down { 803sub key_down {
759 print "MAPKEYDOWN\n"; 804 print "MAPKEYDOWN\n";
760} 805}
761 806
767 1 + int $::WIDTH / 32, 812 1 + int $::WIDTH / 32,
768 1 + int $::HEIGHT / 32, 813 1 + int $::HEIGHT / 32,
769 ) 814 )
770} 815}
771 816
817sub update {
818 my ($self) = @_;
819
820 $self->{need_update} = 1;
821}
822
772sub _draw { 823sub _draw {
773 my ($self) = @_; 824 my ($self) = @_;
774 825
826 if (delete $self->{need_update}) {
827 glNewList $self->{list}, GL_COMPILE;
828
775 my $mx = $::CONN->{mapx}; 829 my $mx = $::CONN->{mapx};
776 my $my = $::CONN->{mapy}; 830 my $my = $::CONN->{mapy};
777 831
778 my $map = $::CONN->{map}; 832 my $map = $::CONN->{map};
779 833
780 my ($xofs, $yofs); 834 my ($xofs, $yofs);
781 835
782 my $sw = 1 + int $::WIDTH / 32; 836 my $sw = 1 + int $::WIDTH / 32;
783 my $sh = 1 + int $::HEIGHT / 32; 837 my $sh = 1 + int $::HEIGHT / 32;
784 838
785 if ($::CONN->{mapw} > $sw) { 839 if ($::CONN->{mapw} > $sw) {
786 $xofs = $mx + ($::CONN->{mapw} - $sw) * 0.5; 840 $xofs = $mx + ($::CONN->{mapw} - $sw) * 0.5;
787 } else { 841 } else {
788 $xofs = $self->{xofs} = min $mx, max $mx + $::CONN->{mapw} - $sw + 1, $self->{xofs}; 842 $xofs = $self->{xofs} = min $mx, max $mx + $::CONN->{mapw} - $sw + 1, $self->{xofs};
789 } 843 }
790 844
791 if ($::CONN->{maph} > $sh) { 845 if ($::CONN->{maph} > $sh) {
792 $yofs = $my + ($::CONN->{maph} - $sh) * 0.5; 846 $yofs = $my + ($::CONN->{maph} - $sh) * 0.5;
793 } else { 847 } else {
794 $yofs = $self->{yofs} = min $my, max $my + $::CONN->{maph} - $sh + 1, $self->{yofs}; 848 $yofs = $self->{yofs} = min $my, max $my + $::CONN->{maph} - $sh + 1, $self->{yofs};
795 } 849 }
796 850
797 glEnable GL_TEXTURE_2D; 851 glEnable GL_TEXTURE_2D;
798 glEnable GL_BLEND; 852 glEnable GL_BLEND;
799 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 853 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
800 854
801 my $sw4 = ($sw + 3) & ~3; 855 my $sw4 = ($sw + 3) & ~3;
802 my $darkness = "\x00" x ($sw4 * $sh); 856 my $darkness = "\x00" x ($sw4 * $sh);
803 857
804 for my $x (0 .. $sw - 1) { 858 for my $x (0 .. $sw - 1) {
805 my $row = $map->[$x + $xofs]; 859 my $row = $map->[$x + $xofs];
806 for my $y (0 .. $sh - 1) { 860 for my $y (0 .. $sh - 1) {
807 861
808 my $cell = $row->[$y + $yofs] 862 my $cell = $row->[$y + $yofs]
809 or next; 863 or next;
810 864
811 my $dark = $cell->[0]; 865 my $dark = $cell->[0];
812 if ($dark < 0) { 866 if ($dark < 0) {
813 substr $darkness, $y * $sw4 + $x, 1, chr 224; 867 substr $darkness, $y * $sw4 + $x, 1, chr 224;
814 } else { 868 } else {
815 substr $darkness, $y * $sw4 + $x, 1, chr 255 - $dark; 869 substr $darkness, $y * $sw4 + $x, 1, chr 255 - $dark;
816 } 870 }
817 871
818 for my $num (grep $_, @$cell[1,2,3]) { 872 for my $num (grep $_, @$cell[1,2,3]) {
819 my $tex = $::CONN->{face}[$num]{texture} || next; 873 my $tex = $::CONN->{face}[$num]{texture} || next;
820 874
821 my $w = $tex->{width}; 875 my $w = $tex->{width};
822 my $h = $tex->{height}; 876 my $h = $tex->{height};
823 877
824 $tex->draw_quad (($x + 1) * 32 - $w, ($y + 1) * 32 - $h, $w, $h); 878 $tex->draw_quad (($x + 1) * 32 - $w, ($y + 1) * 32 - $h, $w, $h);
879 }
825 } 880 }
826 } 881 }
827 }
828 882
829# if (1) { # higher quality darkness 883# if (1) { # higher quality darkness
830# $lighting =~ s/(.)/$1$1$1/gs; 884# $lighting =~ s/(.)/$1$1$1/gs;
831# my $pb = new_from_data Gtk2::Gdk::Pixbuf $lighting, "rgb", 0, 8, $sw4, $sh, $sw4 * 3; 885# my $pb = new_from_data Gtk2::Gdk::Pixbuf $lighting, "rgb", 0, 8, $sw4, $sh, $sw4 * 3;
832# 886#
834# 888#
835# $lighting = $pb->get_pixels; 889# $lighting = $pb->get_pixels;
836# $lighting =~ s/(.)../$1/gs; 890# $lighting =~ s/(.)../$1/gs;
837# } 891# }
838 892
839 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 893 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
840 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 894 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
841 895
842 $darkness = new Crossfire::Client::Texture 896 $darkness = new CFClient::Texture
843 width => $sw4, 897 width => $sw4,
844 height => $sh, 898 height => $sh,
845 data => $darkness, 899 data => $darkness,
846 internalformat => GL_ALPHA, 900 internalformat => GL_ALPHA,
847 format => GL_ALPHA; 901 format => GL_ALPHA;
848 902
849 glColor 0.45, 0.45, 0.45, 1; 903 glColor 0.45, 0.45, 0.45, 1;
850 $darkness->draw_quad (0, 0, $sw4 * 32, $sh * 32); 904 $darkness->draw_quad (0, 0, $sw4 * 32, $sh * 32);
851 905
852 glDisable GL_TEXTURE_2D; 906 glDisable GL_TEXTURE_2D;
853 glDisable GL_BLEND; 907 glDisable GL_BLEND;
908
909 glEndList;
910 }
911
912 glCallList $self->{list};
854} 913}
855 914
856my %DIR = ( 915my %DIR = (
857 SDLK_KP8, [1, "north"], 916 SDLK_KP8, [1, "north"],
858 SDLK_KP9, [2, "northeast"], 917 SDLK_KP9, [2, "northeast"],
904 } 963 }
905} 964}
906 965
907############################################################################# 966#############################################################################
908 967
909package Crossfire::Client::Widget::Animator; 968package CFClient::Widget::Animator;
910 969
911use SDL::OpenGL; 970use SDL::OpenGL;
912 971
913our @ISA = Crossfire::Client::Widget::Bin::; 972our @ISA = CFClient::Widget::Bin::;
914 973
915sub moveto { 974sub moveto {
916 my ($self, $x, $y) = @_; 975 my ($self, $x, $y) = @_;
917 976
918 $self->{moveto} = [$self->{x}, $self->{y}, $x, $y]; 977 $self->{moveto} = [$self->{x}, $self->{y}, $x, $y];
923} 982}
924 983
925sub animate { 984sub animate {
926 my ($self, $interval) = @_; 985 my ($self, $interval) = @_;
927 986
928 printf "%5.2f\n", 1 / $interval if $interval;#d#
929
930 $self->{time} -= $interval * $self->{speed}; 987 $self->{time} -= $interval * $self->{speed};
931 if ($self->{time} <= 0) { 988 if ($self->{time} <= 0) {
932 $self->{time} = 0; 989 $self->{time} = 0;
933 ::animation_stop $self; 990 ::animation_stop $self;
934 } 991 }
948 glPopMatrix; 1005 glPopMatrix;
949} 1006}
950 1007
951############################################################################# 1008#############################################################################
952 1009
953package Crossfire::Client::Widget::Toplevel; 1010package CFClient::Widget::Toplevel;
954 1011
955our @ISA = Crossfire::Client::Widget::Container::; 1012our @ISA = CFClient::Widget::Container::;
956 1013
957sub size_request { 1014sub size_request {
958 ($::WIDTH, $::HEIGHT) 1015 ($::WIDTH, $::HEIGHT)
959} 1016}
960 1017
965 1022
966 $_->size_allocate ($_->size_request) 1023 $_->size_allocate ($_->size_request)
967 for @{$self->{children}}; 1024 for @{$self->{children}};
968} 1025}
969 1026
1027sub translate {
1028 my ($self, $x, $y) = @_;
1029
1030 ($x, $y)
1031}
1032
970sub update { 1033sub update {
971 my ($self) = @_; 1034 my ($self) = @_;
972 1035
973 $self->size_allocate ($self->size_request); 1036 $self->size_allocate ($self->size_request);
974 ::refresh (); 1037 ::refresh ();
988 $self->_draw; 1051 $self->_draw;
989} 1052}
990 1053
991############################################################################# 1054#############################################################################
992 1055
993package Crossfire::Client::Widget; 1056package CFClient::Widget;
994 1057
995$TOPLEVEL = new Crossfire::Client::Widget::Toplevel; 1058$TOPLEVEL = new CFClient::Widget::Toplevel;
996 1059
9971 10601
998 1061

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines